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
| from collections import defaultdict | |
| from pprint import pprint | |
| class Effect(object): | |
| def __init__(self, what, how): | |
| self.what = what | |
| self.how = how | |
| def apply(self, base): |
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
| import random | |
| import collections | |
| import logging | |
| from pprint import pprint | |
| SAVEFILE = 't1' | |
| class Board(object): | |
| template = ''' |
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
| def get_input(valid): | |
| while True: | |
| choice = input('->') | |
| if choice not in valid: | |
| print('not a valid option') | |
| else: | |
| return choice | |
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
| from pprint import pprint | |
| points = [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), | |
| (0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1), | |
| (0, 2), (1, 2), (2, 2), (3, 2), (4, 2), (5, 2), | |
| (0, 3), (1, 3), (2, 3), (3, 3), (4, 3), (5, 3), | |
| (0, 4), (1, 4), (2, 4), (3, 4), (4, 4), (5, 4), | |
| (0, 5), (1, 5), (2, 5), (3, 5), (4, 5), (5, 5)] | |
| grid = [3, 2] |
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
| from random import randint, choice | |
| class Race(object): | |
| _races = [ | |
| { | |
| 'stats':{ | |
| 'INT':-1, | |
| 'LEA':-1, | |
| 'ROB':1, |
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
| from itertools import product | |
| from pprint import pprint | |
| class Board(object): | |
| def __init__(self): | |
| self.board = {(a,b):None for a,b in product(range(10),repeat = 2)} | |
| self.place_black() | |
| self.place_white() |
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
| from collections import namedtuple | |
| Action = namedtuple('Action', ['verb', 'noun', 'adjective', 'indirect']) | |
| NOUNS = ['sword', 'dog', 'hat'] | |
| VERBS = ['get', 'go', 'eat', 'north', 'east'] | |
| PREPOSITIONS = [ |
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/python | |
| import random | |
| import string | |
| from functools import partial | |
| from pprint import pprint | |
| TARGET = "Michael Kilby" |
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
| from collections import namedtuple | |
| Action = namedtuple('Action', ['verb', 'noun', 'adjective', 'indirect']) | |
| nouns = ['sword', 'dog', 'hat'] | |
| verbs = ['get', 'go', 'eat', 'north', 'east'] |
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
| from collections import defaultdict | |
| from functools import partial | |
| from pprint import pprint | |
| match = { | |
| 'abc': { | |
| '123':1, | |
| '234':2, | |
| '333':3, |