Skip to content

Instantly share code, notes, and snippets.

@1328
1328 / t.py
Created June 23, 2015 19:03
Tic_tac_toe
import random
import collections
import logging
from pprint import pprint
SAVEFILE = 't1'
class Board(object):
template = '''
@1328
1328 / x.py
Created May 28, 2015 20:01
menus
def get_input(valid):
while True:
choice = input('->')
if choice not in valid:
print('not a valid option')
else:
return choice
@1328
1328 / x.py
Last active August 29, 2015 14:21
griddy
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]
@1328
1328 / x.py
Last active August 29, 2015 14:21
ecg
from random import randint, choice
class Race(object):
_races = [
{
'stats':{
'INT':-1,
'LEA':-1,
'ROB':1,
@1328
1328 / checkers.py
Created April 30, 2015 16:42
checkers
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()
@1328
1328 / p2.py
Last active August 29, 2015 14:19
parser 2
from collections import namedtuple
Action = namedtuple('Action', ['verb', 'noun', 'adjective', 'indirect'])
NOUNS = ['sword', 'dog', 'hat']
VERBS = ['get', 'go', 'eat', 'north', 'east']
PREPOSITIONS = [
@1328
1328 / y.pu
Created April 24, 2015 13:54
matie
#!/usr/bin/python
import random
import string
from functools import partial
from pprint import pprint
TARGET = "Michael Kilby"
@1328
1328 / x.py
Created April 24, 2015 01:19
x
from collections import namedtuple
Action = namedtuple('Action', ['verb', 'noun', 'adjective', 'indirect'])
nouns = ['sword', 'dog', 'hat']
verbs = ['get', 'go', 'eat', 'north', 'east']
@1328
1328 / x.py
Last active August 29, 2015 14:19
sequence matcher
from collections import defaultdict
from functools import partial
from pprint import pprint
match = {
'abc': {
'123':1,
'234':2,
'333':3,
@1328
1328 / test.py
Created April 19, 2015 02:39
tester
import time
import os.path
from pprint import pprint
from fsearch.index import FastaIndex, MemIndex
TASK = '''
Here is a link to some sample data. I want to find where each datapoint from
sequence column of inputfile can be found in the RefSeq file, and extract other