Created
October 2, 2012 20:20
-
-
Save bjhomer/3823041 to your computer and use it in GitHub Desktop.
drawing cards
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import random | |
if __name__ == "__main__": | |
cardcount = int(sys.argv[1]) | |
drawcount = 8 | |
cards_not_seen = set(range(cardcount)) | |
draws = 0 | |
while len(cards_not_seen) > 0: | |
draws += 1 | |
cards = range(cardcount) | |
hand = random.sample(cards, drawcount) | |
print cards_not_seen | |
for card in hand: | |
cards_not_seen.discard(card) | |
print draws |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment