If this is turning into a feature request thread, I'd like to throw out a few suggestions for discussion.
[*:1qrzmewx]Action: return card to deck (card number).
Append the parameter to the end of the list of not-yet-drawn cards. (Perhaps perform a sanity check and complain via the debugger if the parameter is on that list already? But what if multiple decks are implemented?)
Useful for games where cards can be drawn but not actually put into play, e.g. Solitaire. Also for games where you occasionally need to shuffle the cards that have been played, but not the players' hands (Crazy 8s and its five hundred million variants spring to mind).
Alternative: maintain two lists. The "draw pile" is what is called the "deck" in the current implementation; the "discard pile" is initially empty and can have specific cards added to it via an action. Another action appends the discard pile (maintaining the order) to the draw pile and clears the discard. Problem: sanity checks become even more complicated ("User wants to add card #15 to the discard pile, so if the number of cards #15 in the draw pile plus the number of cards #15 in the discard pile equals the number of decks in use, throw an error message on the debugger.")[/*:1qrzmewx]
[*:1qrzmewx]Conditions: same rank (card number, card number), same suit (card number, card number).
Return true if the two parameters refer to cards of the same rank or suit respectively. For bonus points, accept an arbitrary number of parameters and return true only if they all match.[/*:1qrzmewx]
[*:1qrzmewx]For convenience and readability, add "suit" and "rank" expressions that basically do card%13 and floor(card/13) respectively. (Or (card%13)+1 and ceil(card/13), if you prefer to number the ranks and suits from 1 rather than 0).[/*:1qrzmewx]
[*:1qrzmewx]Allow multiple decks. This probably shouldn't be runtime-editable because removing a deck in mid-air is messy and underdefined. A property "number of decks" that defaults to 1 seems more plausible. Also, I don't expect users to want to know which specific deck a card came from; so a "draw pile" with two decks could simply(?) have two copies each of the numbers 1..52.[/*:1qrzmewx]
[*:1qrzmewx]As an alternative, ignore everything I said above and go for flexibility: have a property "number of cards" that can be set to an arbitrary number. Remove all the conditions and let the users calculate (or look up in an array) what each number means in card terms. This would open the object as a shuffling mechanism for games with non-standard deck sizes (CCGs, Tarock and many more), but make it slightly less convenient for actual traditional card games.[/*:1qrzmewx][/list:u:1qrzmewx]