Microsoft Small Basic
Program Listing: RKCP997.000
List Program
GraphicsWindow.Title = "Concentration test"
GraphicsWindow.BackgroundColor = "white"
GraphicsWindow.Width = 450
GraphicsWindow.Height = 520
GraphicsWindow.FontSize = 50
GraphicsWindow.FontBold = "true"
GraphicsWindow.BrushColor = "black"
GraphicsWindow.Left = 0.5 * (Desktop.Width - GraphicsWindow.Width)
GraphicsWindow.Top = 0.5 * (Desktop.Height - GraphicsWindow.Height)
'For n = 1 to 10
InitialNumber = Math.GetRandomNumber(26)+64
GraphicsWindow.DrawText(200, 200, text.GetCharacter(InitialNumber))
Program.Delay(500)
GraphicsWindow.Clear()
GraphicsWindow.DrawText(200, 200, "#")
Program.Delay(500)
'DoesItExist = 0 if it does not exist, and 1 if it exists
DoesItExist = 0
For n = 1 To 4
CaractereAleatoire[n] = Math.GetRandomNumber(26)+64
If InitialNumber = CaractereAleatoire[n] Then
DoesItExist = 1
EndIf
EndFor
GraphicsWindow.DrawText(100, 100, text.GetCharacter(CaractereAleatoire[1]))
GraphicsWindow.DrawText(300, 100, text.GetCharacter(CaractereAleatoire[2]))
GraphicsWindow.DrawText(100, 300, text.GetCharacter(CaractereAleatoire[3]))
GraphicsWindow.DrawText(300, 300, text.GetCharacter(CaractereAleatoire[4]))
T0 = Clock.ElapsedMilliseconds
GraphicsWindow.KeyDown = test
'endfor
Sub test
GraphicsWindow.FontSize = 12
frappe = GraphicsWindow.LastKey
If frappe = "Left" then
if DoesItExist = 0 then
GraphicsWindow.BrushColor = "green"
GraphicsWindow.DrawText(180, 450, "bravo !!!")
endif
if DoesItExist = 1 then
GraphicsWindow.BrushColor = "red"
GraphicsWindow.DrawText(180, 450, "lost...")
endif
EndIf
If frappe = "Right" then
if DoesItExist = 1 then
GraphicsWindow.BrushColor = "green"
GraphicsWindow.DrawText(180, 450, "bravo !!!")
endif
if DoesItExist = 0 then
GraphicsWindow.BrushColor = "red"
GraphicsWindow.DrawText(180, 450, "lost...")
endif
EndIf
T1 = Clock.ElapsedMilliseconds
GraphicsWindow.DrawText(120,470,"reaction time = " + (T1 - T0)/1000)
GraphicsWindow.FontSize = 50
GraphicsWindow.BrushColor = "black"
'Program.Delay(2500)
EndSub