document some fuel experiments

This commit is contained in:
Stefan Bühler 2010-06-19 01:03:37 +02:00
parent ac5fb44cac
commit 531942cf1d
2 changed files with 19 additions and 2 deletions

17
Car.hs
View File

@ -8,5 +8,22 @@ data Pipe = Pipe { sections :: [Section] }
data Section = Section { tank, inComp, outComp :: Int } data Section = Section { tank, inComp, outComp :: Int }
data Fuel = Matrix 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

View File

@ -9,7 +9,7 @@ type Nat = Int
-- * build -- * build
-- create a circuit for a desired fuel output -- create a circuit for a desired fuel output
-- example: -- example:
-- build key -- build ""
-- Circuit Syntax: -- Circuit Syntax:
-- <inPin>:[<gates>]:<outPin> -- <inPin>:[<gates>]:<outPin>
@ -57,7 +57,7 @@ block2 = 2:(init input)
-- 1: 2L:2R1R0#2R1R,2L0R0#X0R,X0L0#1L0L:1L -- 1: 2L:2R1R0#2R1R,2L0R0#X0R,X0L0#1L0L:1L
-- 2: 2R:2R1R0#2L1L,0R2L0#X0R,0LX0#1R0L:1L -- 2: 2R:2R1R0#2L1L,0R2L0#X0R,0LX0#1R0L:1L
-- build circuit for needed output -- 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 [] = (p, gates)
step p gates (x:xs) = let k = length gates in case x of 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 0 -> step k (gates ++ [k+4,k+2,k+5,p,k+1,k+3]) xs