Skip to content

Instantly share code, notes, and snippets.

@NeatMonster
Created June 27, 2013 18:41
Show Gist options
  • Save NeatMonster/70e8a2f0fc74326214f6 to your computer and use it in GitHub Desktop.
Save NeatMonster/70e8a2f0fc74326214f6 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from random import randint, shuffle
squares, position = [0 for i in xrange(40)], 0
cc_cards = [0, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
shuffle(cc_cards)
ch_cards = [0, 10, 11, 24, 39, 5, 'R', 'R', 'U', -3, -1, -1, -1, -1, -1, -1]
shuffle(ch_cards)
def cc():
global cc_cards, position
card = cc_cards[0]
if card >= 0:
position = card
cc_cards = cc_cards[1:] + cc_cards[:1]
def ch():
global ch_cards, position
card = ch_cards[0]
if card == 'R':
if position == 7:
position = 15
if position == 22:
position == 25
if position == 36:
position = 5
elif card == 'U':
if position == 22:
position = 28
else:
position = 12
elif card == -3:
position -= 3
elif card >= 0:
position = card
ch_cards = ch_cards[1:] + ch_cards[:1]
def main():
global position, squares
for i in xrange(1000000):
dice = randint(1, 4) + randint(1, 4)
position += dice
position %= 40
if position in [7, 22, 36]:
ch()
if position in [2, 17, 33]:
cc()
if position == 30:
position = 10
squares[position] += 1
print "".join([str(squares.index(sorted(squares)[::-1][i])) for i in xrange(3)])
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment