Skip to content

Instantly share code, notes, and snippets.

@lf-
Created July 15, 2017 18:24
Show Gist options
  • Save lf-/b41e64d9f62826fa8d62714cd565c6be to your computer and use it in GitHub Desktop.
Save lf-/b41e64d9f62826fa8d62714cd565c6be to your computer and use it in GitHub Desktop.
A little randomizer script for Settlers of Catan
from __future__ import print_function
import random
board = ['wheat', 'wood', 'sheep'] * 4 + ['rock', 'brick'] * 3 + ['desert']
random.shuffle(board)
slices = [
board[0:3],
board[3:7],
board[7:12],
board[12:16],
board[16:19],
]
formatted_slices = [' '.join(s) for s in slices]
longest_slice = max(len(s) for s in formatted_slices)
for formatted_slice in formatted_slices:
print(formatted_slice.center(longest_slice))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment