icfp13/Car.hs

30 lines
1.6 KiB
Haskell

import Data.Packed
import Data.Maybe
data Car = Car { chambers :: [Chamber] }
data Chamber = MainChamber { upperPipe, lowerPipe :: Pipe } | AuxChamber { upperPipe, lowerPipe :: Pipe }
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