From 531942cf1d771d10c63260caa198765811a73556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Sat, 19 Jun 2010 01:03:37 +0200 Subject: [PATCH] document some fuel experiments --- Car.hs | 17 +++++++++++++++++ Circuit.hs | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Car.hs b/Car.hs index e5b79c3..1bd8daf 100644 --- a/Car.hs +++ b/Car.hs @@ -8,5 +8,22 @@ data Pipe = Pipe { sections :: [Section] } data Section = Section { tank, inComp, outComp :: Int } data Fuel = Matrix Int +-- 22 11 22 00010 22 100100 22 00110 22 1001011 22 100101110 22 110101011 22 101010010 22 0010 +-- 22 111001101111010 22 010010111 22 011010 22 1001011 +-- 22 11100 22 01011 22 001010 22 0100 22 001110 22 0110 22 0121110 22 0120 +-- 22 10 22 0000 22 01011 22 010100 22 0011 22 011110 22 0010 +-- 11100000: for 1 tanks, using 1 ingredients of air, check fuel for tank 0, c_{1,1} must be >= 1 +-- 111220000: for 1 tanks, using 1 ingredients of air, fuel coefficients missing for tank 1 +-- 1111220000: for 1 tanks, using 1 ingredients of air, fuel coefficients missing for tank 1 + +-- 1220000: for 1 tanks, using 2 ingredients of air, dimension mismatch +-- 12210000: for 1 tanks, using 3 ingredients of air, dimension mismatch +-- 122220000000000000: for 1 tanks, using 6 ingredients of air, dimension mismatch +-- 2200: for 2 tanks, using 0 ingredients of air, dimension mismatch +-- 2202200: for 2 tanks, using 2 ingredients of air, dimension mismatch +-- 220222202200: for 2 tanks, using 14 ingredients of air, dimension mismatch +-- 22102200000000: for 3 tanks, using 2 ingredients of air, dimension mismatch +-- 2210100220101: for 3 Tanks, using 1 ingredients of air, dimension mismatch +-- 221102200000000: for 4 tanks, using 0 ingredients of air, dimension mismatch diff --git a/Circuit.hs b/Circuit.hs index 2710347..c72c304 100644 --- a/Circuit.hs +++ b/Circuit.hs @@ -9,7 +9,7 @@ type Nat = Int -- * build -- create a circuit for a desired fuel output -- example: --- build key +-- build "" -- Circuit Syntax: -- :[]: @@ -57,7 +57,7 @@ block2 = 2:(init input) -- 1: 2L:2R1R0#2R1R,2L0R0#X0R,X0L0#1L0L:1L -- 2: 2R:2R1R0#2L1L,0R2L0#X0R,0LX0#1R0L:1L -- build circuit for needed output -build s = let (p, pins) = step (-1) [] (reverse s) in Circuit p pins where +build s = let (p, pins) = step (-1) [] (reverse (key ++ (readstream s))) in Circuit p pins where step p gates [] = (p, gates) step p gates (x:xs) = let k = length gates in case x of 0 -> step k (gates ++ [k+4,k+2,k+5,p,k+1,k+3]) xs