Skip to content

Instantly share code, notes, and snippets.

@Vages
Last active December 26, 2016 20:03
Show Gist options
  • Save Vages/1c5e9edfbc18d3b710fa6bb1759976ac to your computer and use it in GitHub Desktop.
Save Vages/1c5e9edfbc18d3b710fa6bb1759976ac to your computer and use it in GitHub Desktop.
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()
print
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