BYTE Memory
' Initialization
randomize timer
dim delay as integer
dim number as string
dim digit as integer
dim gameOver as integer
dim answer as string
gameOver = 0
delay = 4000
for i = 1 to 9
number = number + str(int(rnd(1)*2))
next i
digit = 1
' Instructions
print "Would you like instructions? (y or n)"
do while answer = "" : answer = inkey : loop
if lcase(answer) = "y" then
cls
print "BYTE Memory is a sequence memory game. It is designed to help you"
print "learn to read and recognize bytes."
print
print "The computer will select a random byte for each game. It will then"
print "give you the numbers of the byte one by one. After each time a digit"
print "is given, you must repeat the entire sequence."
print
print "If you miss one digit, you lose the game."
print
print "(press any key)"
sleep
end if
'game loop
do
cls
print "The number is :"
print " > ";left(number,digit)
delay = delay - 100
sleep delay,1
answer = ""
do
while inkey <> "" : wend
cls
print "What was the number?"
input " > ", answer
if answer = "" then
print
print "Please at least try to guess the number."
sleep 3000, 1
end if
loop until answer <> ""
if answer <> left(number,digit) then
print
print "I'm sorry. That is incorrect. You lose."
print "You managed to memorize ";digit;" digits."
sleep 4000, 1
gameOver = 1
elseif digit < 8 then
digit = digit + 1
delay = delay - 200
elseif digit = 8 then
print
print "Congratulations, you win."
sleep 4000, 1
gameOver = 1
end if
loop until gameOver




