define Start(p)
{
   gWin <- MakeWindow("black")
   lab <- EasyLabel("Welcome. Press any key to begin.", gVideoWidth/2,200,gWin,30)
   Draw()
   WaitForAnyKeyPress()
   RemoveObject(lab,gWin)
  MessageBox("These are the instructions for the test.  In this test, you must decide whether a number of even or odd. Try to do this as quickly and accurately as possible.  For example:
  
  1121334141:   odd
  1411561632:   even
  3:            odd
  4:            even
  
  When a number is odd, press the LEFT shift key.  When a number is even press the RIGHT shift key.  
  
  Ready? ",gWin)
  

  
 out <-  Trial(3)
 Print(out)
 out <-   Trial(4)
  Print(out)
  out <-  Trial(1000)
  Print(out)
}


define Trial(number)
{

  header <- Easylabel("Decide whether even or odd",gVideoWidth/2,100,gWin,40)
  stim <-   EasyLabel(number+"",gVideoWidth/2,gVideoHeight/2,gWin,80)
  footer <- EasyLabel("<left shift> ODD                                   EVEN <right shift>",gVideoWidth/2,gVideoHeight-200,gWin,30)
  
  Draw()
  time1 <- GetTime()
  resp <- WaitForListKeyPress(["<lshift>","<rshift>"])
  time2 <- GetTime()
   rt <- (time2-time1)
   odd <- IsOdd(number)
   corr <- (odd and resp=="<lshift>") or ((not odd) and resp=="<rshift>")

  return [number,odd,resp,corr,rt] 
}

define IsOdd(number)
{
    return Mod(number,2)
}