Skip to content

Instantly share code, notes, and snippets.

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
]
]
@Duta
Duta / Euler13.hs
Created September 22, 2014 15:40
Euler problem 13 in Haskell
module Euler13 where
numbers :: [Integer]
numbers =
[ 37107287533902102798797998220837590246510135740250
, 46376937677490009712648124896970078050417018260538
, 74324986199524741059474233309513058123726617309629
, 91942213363574161572522430563301811072406154908250
, 23067588207539346171171980310421047513778063246676
, 89261670696623633820136378418383684178734361726757
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));
}
@Duta
Duta / perm27.py
Created February 6, 2014 15:39
Printing all permutations of {1, 2, 3, 4} in python
# 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()
@Duta
Duta / heroname.py
Last active December 18, 2015 20:48 — forked from gamesbyangelina/heroname.py
from xml.etree import ElementTree as ET
import urllib
import itertools, random
plus = "%2B"
neg = "-"
def getText(nodelist):
rc = []
for node in nodelist:
// 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);