Skip to content

Instantly share code, notes, and snippets.

@Zimmux
Zimmux / solver.py
Last active July 1, 2019 14:29
gameaboutsquares solver
from collections import deque
class hashabledict(dict):
def __hash__(self):
return hash(tuple(sorted(self.items())))
def dictFromChar2D(c2d=[], filtr=lambda _:True):
return {
(x,y):c
for y,c1d in zip(range(len(c2d)),c2d)
def Integers():
n = 0
while True:
yield n
n += 1
def Universe():
for s in Integers():
for a in Integers():
if a>s: break
-- Forked from http://stackoverflow.com/a/21246951
{-# LANGUAGE Arrows #-}
import Text.XML.HXT.Core
import qualified Data.Map.Strict as M
-- data types
type Color = String
type Coord = (Double,Double,Double,Double) -- (x,y,w,h)
type Visual = (String,Maybe Color,Stroke) -- (glyph,fill,stroke)
type Stroke = (Maybe Color,Double) -- (color,width)