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
| 0x72575B18AF7e47E2264ab55D90B6960a29673968 |
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 | |
| def avg(x): | |
| if type(x) != int: | |
| return sum(x)/float(len(x)) | |
| else: | |
| return x | |
| class liver(object): | |
| """containes genes and probability of life""" | |
| def __init__(self, genes=0): | |
| self.genes = genes |
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
| #gradient ascent test | |
| def linear(theta0,theta1,x): | |
| return theta0+theta1*x | |
| def cost(theta0,theta1,xm): | |
| L=0 | |
| for i in xm: | |
| Z=0 | |
| Z= linear(theta0,theta1,i[0])-i[1] | |
| Z*=Z |
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
| #remember top left is 0,0 left right is X is first,up down is Y is second | |
| # whitespaces, dataflow, and DRY, also use a vector class for positions | |
| # newpos = simulateMovement(char, dir); if gmap[newpos.x][newpos.y] = stone | |
| import sys,pygame | |
| pygame.init() | |
| Grass = pygame.image.load("grass.png") | |
| Person = pygame.image.load("person.png") | |
| class Vector: | |
| def __init__(self, x, y): |
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 | |
| def say(msg): | |
| print ":", msg | |
| def rnd(min, max): | |
| return random.randint(min, max) | |
| def dice(Xd,Y): | |
| l=[] | |
| for i in range(Xd): |
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 sys, os, glob, re, pickle | |
| if len(sys.argv) != 2: | |
| print "USAGE: %s DIR" % sys.argv[0] | |
| sys.exit(1) | |
| DIR = sys.argv[1] | |
| INDEX = {} | |
| FILES = [] |