VII: The Programmatic Side of Mathematica: Dealing Cards

You might recall in our last post, we had a way of declaring a deck of cards: deck = Flatten[Outer[List, {s, h, c, d}, Join[Range[2, 10], {J, Q, K, A}]], 1] {{s,2},{s,3},{s,4},{s,5},{s,6},{s,7},{s,8},{s,9},{s,10},{s,J}, {s,Q},{s,K},{s,A},{h,2},{h,3},{h,4},{h,5},{h,6},{h,7},{h,8},{h,9}, {h,10},{h,J},{h,Q},{h,K},{h,A},{c,2},{c,3},{c,4},{c,5},{c,6}, {c,7},{c,8},{c,9},{c,10},{c,J},{c,Q},{c,K},{c,A},{d,2},{d,3},{d,4}, {d,5},{d,6},{d,7},{d,8},{d,9},{d,10},{d,J},{d,Q},{d,K},{d,A}} … but alas, no Continue Reading

VI: The Programmatic Side of Mathematica: The perfect shuffle of a deck of cards

Making a deck of cards requires making a the basic thirteen card values: Join[Range[2,10], {J, Q, K, A}] {2,3,4,5,6,7,8,9,10,J,Q,K,A} Then, you need to distribute these values among the four suits: Outer[List, {c, d, h, s}, %] {{{c,2},{c,3},{c,4},{c,5},{c,6},{c,7},{c,8},{c,9},{c,10},{c,J},{c,Q},{c,K},{c,    A}},{{d,2},{d,3},{d,4},{d,5},{d,6},{d,7},{d,8},{d,9},{d,10},{d,J},{d,    Continue Reading