%Declaration section
var choice : string
var reply : string (1)
var font1, font2 : int
var A : string
var letter : string
var score : int
%Program title
procedure title
drawfillbox (0, 0, 640, 400, 53)
locate (1, 40)
color (white)
colorback (53)
font1 := Font.New ("Script MT Bold:24")
assert font1 > 0
Font.Draw ("~!Compic!~", 270, 370, font1, black)
Font.Free (font1)
end title
title
%pauseProgram
procedure pauseProgram
cls
title
font2 := Font.New ("Swis721 BdCnOul BT:24")
assert font2 > 0
Font.Draw ("Press any key...", 100, 300, font2, black)
Font.Free (font2)
locate (6, 39)
getch (reply)
end pauseProgram
pauseProgram
%Program Introduction
procedure intro
title
locate (5, 1)
colorback (9)
color (black)
put "Test your ability at recognizing different parts of a computer as input, output, CPU or storage. 'Compic' is the one ideal game for that skill. Recognize away...!"
end intro
intro
%Procedure mainMenu
procedure mainMenu
title
for x : 1 .. 10
locate (3, 1)
put "1: Test away!"
locate (4, 1)
put "2: Too afraid...go while you got the chance!"
locate (5, 1)
put "Please enter your choice '1: Enter.. 2: Leave..': " ..
get choice
if choice < "1" or choice > "2" then
locate (13, 1)
put "Please enter the choice you wish to the corresponding number beside it. "
else
exit
end if
end for
end mainMenu
mainMenu
procedure pic1
Pic.ScreenLoad ("keyboard2.bmp", 270, 130, picCopy)
end pic1
procedure pic2
Pic.ScreenLoad ("printer.bmp", 320, 100, picCopy)
end pic2
procedure pic3
Pic.ScreenLoad ("hard drive.bmp", 320, 100, picCopy)
end pic3
procedure pic4
Pic.ScreenLoad ("CPU.bmp", 320, 100, picCopy)
end pic4
procedure pic5
Pic.ScreenLoad ("speakers.bmp", 320, 100, picCopy)
end pic5
procedure pic6
Pic.ScreenLoad ("floppy drive.bmp", 320, 100, picCopy)
end pic6
%Procedure goodBye
procedure bye
title
if choice = "2" then
locate (20, 17)
put " This is the way out.. Thanks for trying!"
locate (10, 20)
put "Program created By:"
locate (11, 24)
put "Mario!"
end if
end bye
bye
%Procedure userInput
procedure userInput
cls
title
pic1
locate (4, 3)
put "A = Input"
locate (5, 3)
put "B = Output"
locate (6, 3)
put "C = Storage"
locate (7, 3)
put "D = CPU"
locate (20, 6)
put "Match the picture with the name..: " ..
get letter
if choice = "1" then
else
end if
end userInput
userInput
procedure userInput2
cls
title
pic2
locate (4, 3)
put "E = Input"
locate (5, 3)
put "F = CPU"
locate (6, 3)
put "G = Storage"
locate (7, 3)
put "H = Output"
locate (20, 6)
put "Match the picture with the name..: " ..
get letter
if letter = "A" or letter = "B" or letter = "C" or letter = "D" then
elsif letter = "A" then
score := score + 1
else
end if
end userInput2
userInput2
procedure userInput3
cls
title
pic3
locate (4, 3)
put "I = Output"
locate (5, 3)
put "J = CPU"
locate (6, 3)
put "K = Storage"
locate (7, 3)
put "L = Input"
locate (20, 6)
put "Match the picture with the name..: " ..
get letter
if letter = "H" or letter = "E" or letter = "F" or letter = "G" then
elsif letter = "H" then
score = score + 1
else
end if
end userInput3
userInput3
procedure userInput4
cls
title
pic4
locate (4, 3)
put "M = Storage"
locate (5, 3)
put "N = Output "
locate (6, 3)
put "O = CPU"
locate (7, 3)
put "P = Input"
locate (20, 6)
put "Match the picture with the name..: " ..
get letter
if letter = "K" or letter = "I" or letter = "J" or letter = "L" then
elsif letter = "K" then
score = score + 1
else
end if
end userInput4
userInput4
procedure userInput5
cls
title
pic5
locate (4, 3)
put "Q = CPU"
locate (5, 3)
put "R = Input"
locate (6, 3)
put "S = Storage"
locate (7, 3)
put "T = Output"
locate (20, 6)
put "Match the picture with the name..: " ..
get letter
if letter = "O" or letter = "M" or letter = "N" or letter = "P" then
elsif letter = "O" then
score = score + 1
else
end if
end userInput5
userInput5
procedure userInput6
cls
title
pic6
locate (4, 3)
put "U = CPU"
locate (5, 3)
put "V = Storage"
locate (6, 3)
put "AB = Output"
locate (7, 3)
put "BC = Input"
locate (20, 6)
put "Match the picture with the name..: " ..
get letter
if letter = "T" or letter = "Q" or letter = "R" or letter = "S" then
elsif letter = "T" then
score := score + 1
else
end if
end userInput6
userInput6
procedure display
cls
title
if letter = "U" or letter = "V" or letter = "AB" or letter = "BC" then
put "Congratulations! You have finished the great computer challenge!"
put "Your Score is...............................: ", score
pauseProgram
else
end if
end display
%Main Program
intro
pauseProgram
loop
mainMenu
exit when choice = "2"
userInput
userInput2
userInput3
userInput4
userInput5
userInput6
display
end loop
|