I'm writing a playing card simulator of sorts, and everything works fine, but some Modules use a disgusting amount of variables. For Example:
randomHand[x_] :=
Module[{hand, kings, cards, suits, value, suitsK, valueK, cardList},
hand = PadLeft[IntegerDigits[RandomInteger[{1, 52}, x], 13]];
kings = Cases[hand, {___, 0}, 2];
cards = DeleteCases[hand, {___, 0}, 2];
suits = First /@ cards;
value = Last /@ cards;
suitsK = First /@ kings;
valueK = ReplaceAll[Last /@ kings, 0 -> "King"];
suits = suits /. {0 -> "Hearts", 1 -> "Diamonds", 2 -> "Clubs",
3 -> "Spades"};
suitsK = suitsK /. {1 -> "Hearts", 2 -> "Diamonds", 3 -> "Clubs",
4 -> "Spades"};
value = value /. {11 -> "Jack", 12 -> "Queen"};
cardList = Partition[Riffle[value, suits], 2];
Map[ToString[cardList[[#]][[1]]] <> " of " <> cardList[[#]][[2]] &, Range[Length[cardList]]]]
My Mathematica knowledge is not as fluent as I'd like it to be, so I'm wondering if it is bad to use so many variables, and if it is, how would I go about cleaning up the above excerpt?