Re: D&D Dice
- To: mathgroup at smc.vnet.net
- Subject: [mg37498] Re: [mg37457] D&D Dice
- From: BobHanlon at aol.com
- Date: Fri, 1 Nov 2002 01:44:12 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 10/31/2002 6:36:22 AM, no_spam_anglewyrm at hotmail.com writes: >Consider yer basic 3d6 stat roll: What are the possibilities? >This gives a table of all 6^3 = 216 rolls: > >Table[i + i2 + i3, {i, 6}, {i2, 6}, {i3, 6}] // MatrixForm > >My question is this: How shall I set up a formula to list the count of >each >total? > lst = Table[i + i2 + i3, {i, 6}, {i2, 6}, {i3, 6}] // Flatten; ans1 = ({#1, Count[lst, #1]} &) /@ Range[3, 18] {{3, 1}, {4, 3}, {5, 6}, {6, 10}, {7, 15}, {8, 21}, {9, 25}, {10, 27}, {11, 27}, {12, 25}, {13, 21}, {14, 15}, {15, 10}, {16, 6}, {17, 3}, {18, 1}} ans1 == ({First[#], Length[#]} & /@ (lst // Sort // Split)) True Needs["Statistics`DataManipulation`"]; ans1 == Reverse /@ Frequencies[lst] True Bob Hanlon