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
english :: BoardSpec | |
english = [ ((x, y), not $ all (==3) [x,y]) | |
| x <- [0..6] | |
, y <- [0..6] | |
, (x,y) `notElem` [ (x',y') | |
| let xs = [0,1,5,6] | |
, x' <- xs | |
, y' <- xs | |
] | |
] |
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
module Euler13 where | |
numbers :: [Integer] | |
numbers = | |
[ 37107287533902102798797998220837590246510135740250 | |
, 46376937677490009712648124896970078050417018260538 | |
, 74324986199524741059474233309513058123726617309629 | |
, 91942213363574161572522430563301811072406154908250 | |
, 23067588207539346171171980310421047513778063246676 | |
, 89261670696623633820136378418383684178734361726757 |
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
public Bst delete(int e) { | |
return e == root ? left.isEmpty() ? right : right.isEmpty() ? left : new Fork(left.largest(), left.deleteLargest(), right) : e < root ? new Fork(root, left.delete(e), right) : new Fork(root, left, right.delete(e)); | |
} |
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
# Use this version if you have Python 2.7 | |
from itertools import permutations | |
for perm in permutations([1,2,3,4]): | |
print perm | |
raw_input() |
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 xml.etree import ElementTree as ET | |
import urllib | |
import itertools, random | |
plus = "%2B" | |
neg = "-" | |
def getText(nodelist): | |
rc = [] | |
for node in nodelist: |
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
// The vertex/face lists. | |
// In your code these are called | |
// "vectors" and "walls" | |
List<Vector> vertices = new ArrayList<Vector>(); | |
List<Wall> faces = new ArrayList<Wall>(); | |
// Now to parse the file | |
public void parseObjFile(String fileName) { | |
try { | |
FileReader fr = new FileReader(fileName); |