Browse Source

Add circuit_delay.png

master
Stefan Bühler 9 years ago
parent
commit
09e41db6b1
2 changed files with 3 additions and 2 deletions
  1. 3
    2
      Circuit.hs
  2. BIN
      circuit_delay.png

+ 3
- 2
Circuit.hs View File

@@ -33,11 +33,14 @@ key_circuit_str = "19L:12R13R0#1R12R,14R0L0#4R9L,9R10R0#3L8L,2L17R0#5L9R,15R1L0#
-- goal: Find a circuit with test_key_circ circ == True
test_key_circ :: Circuit -> Bool
test_key_circ circ = (key == execcirc circ)
-- key: 11021210112101221

factory0 = parseCircuit "0L:X0R0#X0R:0L"
fact0_output = readstream "02120112100002120"
test0 = fact0_output == execcirc factory0

-- known server input stream (from factory "X::X")
input = readstream "01202101210201202"

data Circuit = Circuit { outPin :: Int, inPins :: [Int] } deriving (Eq)

@@ -123,7 +126,5 @@ execcirc circ = execfactory (circfactory circ) input
readstream :: String -> [Int]
readstream = map (\c -> read [c] :: Int)

input = readstream "01202101210201202"

key_input = [0,2,2,2,2,2,2,0,2,1,0,1,1,0,0,1,1]
key = execfactory (circfactory key_circuit) key_input

BIN
circuit_delay.png View File


Loading…
Cancel
Save