Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- runTrafficLight1 :: [[Int]] -> IO ()
- runTrafficLight1 input = runAllInput input output
- where reset = getbit input 0
- (g,a,r) = controller1 reset
- output = [string "Input reset = ", bit reset,
- string " Output green = ", bit g,
- string " amber = ", bit a,
- string " red = ", bit r]
- runTrafficLight2 :: [[Int]] -> IO ()
- runTrafficLight2 input = runAllInput input output
- where reset = getbit input 0
- walkRq = getbit input 1
- (g,a,r,w1,w2,c) = controller2 reset walkRq
- output = [string "Input reset = ", bit reset,
- string " Output green = ", bit g,
- string " amber = ", bit a,
- string " red = ", bit r,
- string " wait = ", bit w1,
- string " walk = ", bit w2,
- string " count = ", bindec 5 c]
Advertisement
Add Comment
Please, Sign In to add comment