This program asks the user to think of a number. It then tells the user the number he is thinking of.
Geoff.
Rem My DISPLAY SETTINGS are Fullscreen, 800x600x16
Randomize Timer()
Global rand
Global click
Global door
Global colour$
Global number
Global shutter
Global shutter1
Global shutter2
Global shutter3
Dim BoxA(25) As String
Dim BoxB(25) As String
Dim BoxC(25) As String
Dim BoxD(25) As String
Dim BoxE(25) As String
`Set a font and a background
Cls RGB(100,100,100)
Ink RGB(0,0,0),RGB(200,255,200)
Set Text Font "Arial"
Set Text To Bold
Set Text Size 30
BoxArrays() `Fill the arrays.
`****Set up for first screen***************************
`******************************************************
Text 200,50,"(1)Think of one of these numbers:-"
DrawGrid()
Text 50,400,"(2)Click the box which is the same colour as your number:-"
DrawBoxes()
NumbersInGrid()
`*******************************************************
`*******************************************************
`Get the colour of the box clicked by the user:-
choiceOfColour()
`Draw the second display of numbers in boxes:-
Boxes()
`Get number of the box clicked by the user:-
choiceOfSecondBox()
Wait Key
End
Function DrawGrid()
Ink RGB(0,0,0),RGB(0,0,0)
`Horizontals:-
x1 = 260
x2 = 510
y2 = 50
For y1 = 100 To 350 Step 50
y2 = y2 + 50
Line x1,y1,x2,y2
Next y1
`Verticals:-
y1 = 100
y2 = 350
For x1 = 260 To 510 Step 50
x2 = x1
Line x1,y1,x2,y2
Next x1
EndFunction
Function NumbersInGrid()
Ink RGB(0,255,0),RGB(200,255,200) `green
Text 280,112," 9"
Ink RGB(255,130,150),RGB(200,255,200) `pink
Text 327,112,"21"
Ink RGB(0,0,255),RGB(200,255,200) `blue
Text 373,112," 4"
Ink RGB(255,130,150),RGB(200,255,200) `pink
Text 421,112,"22"
Ink RGB(0,0,0),RGB(200,255,200) `black
Text 470,112," 7"
Ink RGB(255,0,0),RGB(200,255,200) `red
Text 274,157,"13"
Ink RGB(0,0,255),RGB(200,255,200) `blue
Text 325,157,"18"
Ink RGB(0,0,0),RGB(200,255,200) `black
Text 370,157,"11"
Ink RGB(0,255,0),RGB(200,255,200) `green
Text 420,157,"23"
Ink RGB(255,0,0),RGB(200,255,200) `red
Text 465,157,"15"
Ink RGB(0,0,0),RGB(200,255,200) `black
Text 280,208," 8"
Ink RGB(255,130,150),RGB(200,255,200) `pink
Text 325,208," 1"
Ink RGB(0,255,0),RGB(200,255,200) `green
Text 370,208,"25"
Ink RGB(255,0,0),RGB(200,255,200) `red
Text 425,208," 5"
Ink RGB(0,255,0),RGB(200,255,200) `green
Text 468,208,"16"
Ink RGB(255,130,150),RGB(200,255,200) `pink
Text 272,260,"14"
Ink RGB(0,0,0),RGB(200,255,200) `black
Text 325,260,"24"
Ink RGB(0,0,255),RGB(200,255,200) `blue
Text 370,260,"17"
Ink RGB(0,0,255),RGB(200,255,200) `blue
Text 426,260," 3"
Ink RGB(255,0,0),RGB(200,255,200) `red
Text 472,260," 2"
Ink RGB(255,0,0),RGB(200,255,200) `red
Text 273,308,"20"
Ink RGB(0,0,255),RGB(200,255,200) `blue
Text 325,308,"10"
Ink RGB(0,255,0),RGB(200,255,200) `green
Text 370,308,"12"
Ink RGB(0,0,0),RGB(200,255,200) `black
Text 415,308," 19"
Ink RGB(255,130,150),RGB(200,255,200) `pink
Text 470,308," 6"
EndFunction
Function DrawBoxes()
Ink RGB(255,130,150),RGB(200,255,200) `pink
Box 150,450,210,500
Ink RGB(255,0,0),RGB(200,255,200) `red
Box 260,450,320,500
Ink RGB(0,255,0),RGB(200,255,200) `green
Box 370,450,430,500
Ink RGB(0,0,255),RGB(200,255,200) `blue
Box 480,450,540,500
Ink RGB(0,0,0),RGB(200,255,200) `black
Box 590,450,650,500
EndFunction
Function choiceOfColour()
Wait Mouse
x = MouseX()
If x >150 And x<210 Then colour$ = "pink"
If x >260 And x<320 Then colour$ = "red"
If x >370 And x<430 Then colour$ = "green"
If x >480 And x<540 Then colour$ = "blue"
If x >590 And x<650 Then colour$ = "black"
`Cls
print colour$
EndFunction
Function Boxes()
Cls RGB(100,100,100)
Ink RGB(0,0,0),RGB(200,255,200)
Set Text Font "Arial"
Set Text To Bold
Set Text Size 30
drawTargets()
Center Text 400,100, "Click inside the target below the column which holds your number :-"
Set Cursor 105,210
Print 4
Set Cursor 105,240
Print 12
Set Cursor 105,270
Print 1
Set Cursor 105,300
Print 30
Set Cursor 105,330
Print 11
Set Cursor 105,360
Print 13
Set Cursor 245,210
Print 10
Set Cursor 245,240
Print 26
Set Cursor 245,270
Print 24
Set Cursor 245,300
Print 9
Set Cursor 245,330
Print 21
Set Cursor 245,360
Print 2
Set Cursor 385,210
Print 17
Set Cursor 385,240
Print 25
Set Cursor 385,270
Print 14
Set Cursor 385,300
Print 20
Set Cursor 385,330
Print 8
Set Cursor 385,360
Print 28
Set Cursor 525,210
Print 3
Set Cursor 525,240
Print 23
Set Cursor 525,270
Print 22
Set Cursor 525,300
Print 27
Set Cursor 525,330
Print 19
Set Cursor 525,360
Print 5
Set Cursor 665,210
Print 18
Set Cursor 665,240
Print 16
Set Cursor 665,270
Print 29
Set Cursor 665,300
Print 15
Set Cursor 665,330
Print 7
Set Cursor 665,360
Print 6
EndFunction
Function choiceOfSecondBox()
Wait Mouse
x = MouseX()
If x >85 And x<155 Then box1()
If x >225 And x<295 Then box2()
If x >365 And x<435 Then box3()
If x >505 And x<575 Then box4()
If x >645 And x<715 Then box5()
`Cls
EndFunction
Function BoxArrays()
BoxA(4) = "blue"
BoxA(12) = "green"
BoxA(1) = "pink"
BoxA(11) = "black"
BoxA(13) = "red"
BoxB(10) = "blue"
BoxB(24) = "black"
BoxB(9) = "green"
BoxB(21) = "pink"
BoxB(2) = "red"
BoxC(17) = "blue"
BoxC(25) = "green"
BoxC(14) = "pink"
BoxC(20) = "red"
BoxC(8) = "black"
BoxD(3) = "blue"
BoxD(23) = "green"
BoxD(22) = "pink"
BoxD(19) = "black"
BoxD(5) = "red"
BoxE(18) = "blue"
BoxE(16) = "green"
BoxE(6) = "pink"
BoxE(15) = "red"
BoxE(7) = "black"
EndFunction
Function box1()
For i = 1 To 25
If BoxA(i) = colour$
number = i
showResult()
EndIf
Next i
EndFunction
Function box2()
For i = 1 To 25
If BoxB(i) = colour$
number = i
showResult()
EndIf
Next i
EndFunction
Function box3()
For i = 1 To 25
If BoxC(i) = colour$
number = i
showResult()
EndIf
Next i
EndFunction
Function box4()
For i = 1 To 25
If BoxD(i) = colour$
number = i
showResult()
EndIf
Next i
EndFunction
Function box5()
For i = 1 To 25
If BoxE(i) = colour$
number = i
showResult()
EndIf
Next i
EndFunction
Function showResult()
Cls RGB(100,100,100)
Ink RGB(0,0,0),RGB(200,255,200)
Set Text Font "Arial"
Set Text To Bold
Set Text Size 30
Center Text 400,150, "Click on the boxes in any order"
Center Text 400,300, "(Your number will appear in the FIRST box you click)"
Ink RGB(0,100,0),0
Box 280,210,340,300
Box 370,210,430,300
Box 460,210,520,300
Do
Wait Mouse
x = MouseX()
If x >280 And x <340
shutter1clicked()
EndIf
If x >370 And x <430
shutter2clicked()
EndIf
If x >460 And x <520
shutter3clicked()
EndIf
Loop
EndFunction
Function shutter1clicked()
click = click+1
door = 1
Select click
Case 1
click1(number,door)
EndCase
Case 2
click2(number,door)
EndCase
Case 3
click3(number,door)
Center Text 400,500,"The End (press Esc)"
EndCase
EndSelect
EndFunction
Function shutter2clicked()
click = click+1
door = 2
Select click
Case 1
click1(number,door)
EndCase
Case 2
click2(number,door)
EndCase
Case 3
click3(number,door)
Center Text 400,500,"The End (press Esc)"
EndCase
EndSelect
EndFunction
Function shutter3clicked()
click = click+1
door = 3
Select click
Case 1
click1(number,door)
EndCase
Case 2
click2(number,door)
EndCase
Case 3
click3(number,door)
Center Text 400,500,"The End (press Esc)"
EndCase
EndSelect
EndFunction
`************************************************
Function click1(number,door)
Select door
Case 1
Ink rgb(0,0,250),rgb(100,100,100)
Box 280,210,340,300
Ink rgb(255,255,0),0 `rgb(20,250,20),0
Text 295,250, Str$(number)
Set Text Size 20
Text 255,210, "Your number"
EndCase
Case 2
Ink rgb(0,0,250),rgb(100,100,100)
Box 370,210,430,300
Ink rgb(255,255,0),0
Text 385,250, Str$(number)
Set Text Size 20
Text 345,210, "Your number"
EndCase
Case 3
Ink rgb(0,0,250),rgb(100,100,100)
Box 460,210,520,300
Ink rgb(255,255,0),0
Text 475,250, Str$(number)
Set Text Size 20
Text 435,210, "Your number"
EndCase
EndSelect
EndFunction
Function click2(number,door)
`Randomize Timer()
Select door
Case 1
Repeat
rand = Rnd(24)+1
Until rand <> number
Ink rgb(0,0,0),0
Box 280,210,340,300
Ink rgb(20,250,20),0
Text 295,250, Str$(rand)
EndCase
Case 2
Repeat
rand = Rnd(24)+1
Until rand <> number
Ink rgb(0,0,0),0
Box 370,210,430,300
Ink rgb(20,250,20),0
Text 385,250, Str$(rand)
EndCase
Case 3
Repeat
rand = Rnd(24)+1
Until rand <> number
Ink rgb(0,0,0),0
Box 460,210,520,300
Ink rgb(20,250,20),0
Text 475,250, Str$(rand)
EndCase
EndSelect
EndFunction
Function click3(number,door)
Select door
Case 1
Repeat
rand = Rnd(24)+1
Until rand <> number
Ink rgb(0,0,0),0
Box 280,210,340,300
Ink rgb(20,250,20),0
Text 295,250, Str$(rand)
Hide Mouse
EndCase
Case 2
Repeat
rand = Rnd(24)+1
Until rand <> number
Ink rgb(0,0,0),0
Box 370,210,430,300
Ink rgb(20,250,20),0
Text 385,250, Str$(rand)
Hide Mouse
EndCase
Case 3
Repeat
rand = Rnd(24)+1
Until rand <> number
Ink rgb(0,0,0),0
Box 460,210,520,300
Ink rgb(20,250,20),0
Text 475,250, Str$(rand)
Hide Mouse
EndCase
EndSelect
EndFunction
Function drawTargets()
Circle 120,440,30
Circle 250,440,30
Circle 400,440,30
Circle 540,440,30
Circle 680,440,30
Circle 120,440,20
Circle 250,440,20
Circle 400,440,20
Circle 540,440,20
Circle 680,440,20
Circle 120,440,10
Circle 250,440,10
Circle 400,440,10
Circle 540,440,10
Circle 680,440,10
EndFunction
[MODEDIT - Please remember to close your code tags]