This file contains 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 shuffle | |
from random import randint | |
''' | |
shuffle_trial is a set of functions used to shuffle a set of labeled files | |
into order by counting the number of repeated fields in each file (see | |
comment documentation on the generate_repeats function) | |
Max Scribner | |
December 13, 2018 | |
''' |
This file contains 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 shuffle | |
''' | |
shuffle_trial is a set of functions used to shuffle a set of labeled files | |
into order by counting the number of repeated fields in each file (see | |
comment documentation on the generate_repeats function) | |
Max Scribner | |
December 13, 2018 | |
''' |
This file contains 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
class Vec{constructor(angle,r){this.x=r*Math.cos(angle);this.y=r*Math.sin(angle);}add(vec){return new Vec(Math.atan2(this.y+vec.y, this.x+vec.x), Math.sqrt(Math.pow(this.x+vec.x, 2) + Math.pow(this.y + vec.y, 2)))}} | |
function deg(x){return x/Math.PI*180;} |
This file contains 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
class Vec{constructor(angle,r){this.x=r*Math.cos(angle);this.y=r*Math.sin(angle);}add(vec){return new Vec(Math.atan2(this.y+vec.y, this.x+vec.x), Math.sqrt(Math.pow(this.x+vec.x, 2) + Math.pow(this.y + vec.y, 2)))}} | |
function deg(x){return x/Math.PI*180;} |
This file contains 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
function perm(x){ | |
acc = [[0]]; | |
for(var i=1; i<x; i++){ | |
add = []; | |
for(var j=0; j<acc.length; j++){ | |
for(var k=0; k<acc[j].length+1; k++){ | |
add.push(acc[j].slice(0, k).concat([i]).concat(acc[j].slice(k, acc[j].length))); | |
} | |
} | |
acc = add; |
This file contains 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
<html> | |
<head> | |
<title>WebGL</title> | |
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | |
<script type="text/javascript" src="glMatrix-0.9.5.min.js"></script> | |
<script type="text/javascript" src="webgl-utils.js"></script> | |
<script type="text/javascript" src="keyregisterer.js"></script> |
This file contains 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 math | |
for i in range(2*10**10): | |
k = i**2 | |
#m**2+m-2*k | |
q = (-1+math.sqrt(1+8*k))/2#quadratic formula | |
if(q==int(q)): | |
print(k) |
This file contains 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 p_and(x,y): | |
return x*y | |
def p_or(x,y): | |
return x+y - p_and(x,y) | |
def p_xor(x,y): | |
return x+y - 2*p_and(x,y) |
This file contains 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 prompt(inp): | |
return input(inp+"\n>") | |
state = 0 | |
end = False | |
while end!=True: | |
if state == 0: | |
print("You are sitting in a room. There is a door and a table.") | |
value = prompt("Press 1 to look at the door, Press 2 to look at the desk, press 3 to sit still") | |
if value == "1": |
This file contains 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
class Step: | |
def __init__(self, text, options): | |
self.text = text | |
self.options = options | |
def __call__(self): | |
if len(self.options)>0: | |
return self.options[input(self.text+"\n"+"\n".join([str(i+1)+" to "+self.options[i].name for i in range(len(self.options))])$ | |
else: | |
print(self.text) | |
return -1 |
NewerOlder