Last active
August 29, 2015 14:13
-
-
Save inky/d8b17641c030409e1785 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
Random Scrabble tiles! | |
""" | |
from __future__ import unicode_literals | |
from random import shuffle | |
TILES = ('AAAAAAAAABBCCDDDDEEEEEEEEEEEEFFGGGHHIIIIIIIIIJKLLL' | |
'LMMNNNNNNOOOOOOOOPPQRRRRRRSSSSTTTTTTUUUUVVWWXYYZ__') | |
def random_tiles(): | |
tiles = list(TILES) | |
shuffle(tiles) | |
return ''.join(tiles[:7]) | |
def format_tile(tile): | |
assert len(tile) == 1 | |
return '(blank)' if tile == '_' else tile | |
if __name__ == '__main__': | |
print ', '.join(format_tile(tile) for tile in random_tiles()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment