Created
December 5, 2014 14:43
-
-
Save drvinceknight/53697e1dcfbff865699e to your computer and use it in GitHub Desktop.
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 random | |
deck = ['1S','2S','3S','4S', '1H', '2H', '3H', '4H'] | |
p1 = [] | |
p2 = [] | |
random.shuffle(deck) | |
while len(deck) > 0: | |
p1.append(deck.pop()) | |
p2.append(deck.pop()) | |
print p1 | |
print p2 | |
slam_prob = .5 | |
table = [p1.pop(), p2.pop()] | |
for k in range(3): | |
table.append(p1.pop()) | |
table.append(p2.pop()) | |
if table[-1][0] == table[-2][0]: | |
if random.random() < slam_prob: | |
print 'p1 wins' | |
else: | |
print 'p2 wins' | |
print 'Game is over' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment