Card No Repeat Help

So I’m writing a program to predict probabilities in Texas holdem (with some other fun things).

At the moment, you can choose your two cards for the initial deal. Cards are chosen by swiping horizontal to change the number and vertical to change the suit. It’s coming along quite well (400 lines in a day) and this will be one of the apps that I bring to completion…but I’m having an issue and I can’t seem to resolve it and I’m afraid it will haunt be down the line. Can one of you pro Codeans write a function for me, or at least break it down into steps as to how and where you’d write it (if you feel that’d be cheating otherwise)…

Basically I want to make it so cards in your hand cannot repeat. Meaning if one card is a jack of spades and the other card is a 10 of spades, if the user were to swipe appropriately, instead of ending up with a jack of spades on the second card (and repeating), it’d skip over to the queen of spades (or king if queen is used up, and so on, looping ace to 2). And likewise if the user has a jack of spades and a jack of hearts, swiping vertical would skip the spades suit and go straight to diamonds or the next available suits.

Anyway, please take a look, someone with 15 minutes to dedicate to this issue… I’ve been working hard on this, maybe 8-9 hours of conceptualization/problem solving/writing actual code…I’d really appreciate it if someone could solve this enigmatic road block… I’m going to put another couple hours into solving this issue tomorrow, but it would really help if someone could make this contribution to my project, or at least point me in the right direction.

Thank you ^.^


I think you’ve answered your own question - do a check each time the currently selected card changes against the other one. If it is the same then advance by an extra “slot” in the chose direction

there is a dicuscussion on permutations on the forum, with code examples.