Shuffling cards (proof of concept)

LineCutter

Active Member
Licensed User
This cropped up in discussion a week or two ago, & I had some quiet time while I was on holiday.
The code is really just a proof of concept, but should be worth a look if anyone is planning a card game.
There are no docs!
The 1-13 are the card values, with H/C/D/S appended to represent suit. Reset recreates an unshuffled deck. Sort... well it sorts the contents of the listbox. Shuffle shouldn't be a challenge!
Filter is the slightly strange option (I need it for something else - not to do with cards). It takes the value of the NumUpDown control & uses that to remove that % of the cards, with positive values removing cards from the low half of the values & negative ones from the high end.
 

Attachments

Top