Last active
December 26, 2016 20:03
-
-
Save Vages/1c5e9edfbc18d3b710fa6bb1759976ac to your computer and use it in GitHub Desktop.
This file contains 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
from random import randint, sample | |
def enough_distance(m, t): | |
return not ((m + t) < 4 or ((12 - m) + (12 - t)) < 4) | |
def get_meeple_placements(): | |
""" | |
Generates and prints the board game arrangement | |
""" | |
occupied_temple_spaces = set() | |
occupied_meeple_spaces = set() | |
colors = ["yellow", "brown", "blue", "purple"] | |
for c in colors: | |
meeple_space = 0 | |
temple_space = 0 | |
while not enough_distance(meeple_space, temple_space): | |
meeple_space = randint(1, 11) | |
temple_space = randint(1, 11) | |
while meeple_space in occupied_meeple_spaces: | |
meeple_space = randint(1, 11) | |
while temple_space in occupied_temple_spaces: | |
temple_space = randint(1, 11) | |
print c.ljust(6), "|", str(meeple_space*10).rjust(3), "|", str(temple_space*10).rjust(3) | |
occupied_meeple_spaces.add(meeple_space) | |
occupied_temple_spaces.add(temple_space) | |
if __name__ == "__main__": | |
get_meeple_placements() | |
remaining_tile_numbers = set(range(1, 37)) | |
while remaining_tile_numbers: | |
_ = raw_input("Press enter to draw next number") | |
num = sample(remaining_tile_numbers, 1)[0] | |
print num | |
remaining_tile_numbers.remove(num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment