heatherhb

tests

Feb 8th, 2012
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. runTrafficLight1 :: [[Int]] -> IO ()
  2. runTrafficLight1 input = runAllInput input output
  3.     where reset   = getbit input 0
  4.           (g,a,r) = controller1 reset
  5.           output  = [string "Input reset = ", bit reset,
  6.                      string "  Output green = ", bit g,
  7.                      string " amber = ", bit a,
  8.                      string " red = ", bit r]
  9.  
  10. runTrafficLight2 :: [[Int]] -> IO ()
  11. runTrafficLight2 input = runAllInput input output
  12.     where reset   = getbit input 0
  13.           walkRq  = getbit input 1
  14.           (g,a,r,w1,w2,c) = controller2 reset walkRq
  15.           output  = [string "Input reset = ", bit reset,
  16.                      string "  Output green = ", bit g,
  17.                      string " amber = ", bit a,
  18.                      string " red = ", bit r,
  19.                      string " wait = ", bit w1,
  20.                      string " walk = ", bit w2,
  21.                      string " count = ", bindec 5 c]
Advertisement
Add Comment
Please, Sign In to add comment