Skip to content

Instantly share code, notes, and snippets.

@drvinceknight
Created December 5, 2014 14:43
Show Gist options
  • Save drvinceknight/53697e1dcfbff865699e to your computer and use it in GitHub Desktop.
Save drvinceknight/53697e1dcfbff865699e to your computer and use it in GitHub Desktop.
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