var x, y, x1, x2, x3, x4, x5, x0, num, col, win, score : int
var chars : array char of boolean
x := 0
y := 0
x0 := 0
x1 := 0
x2 := 0
x3 := 0
x4 := 0
x5 := 0
win := 0
score := 10000
drawfillbox (50, 0, 650, 50, 7)
drawfillbox (0, 351, 50, 400, 7)
drawfillbox (100, 351, 650, 400, 7)
drawfillbox (x, y, x + 50, y + 50, 5)
loop
if x = 50 and y = 350 then
win := 1
exit
end if
drawline(0,100,650,100,7)
drawline(0,150,650,150,7)
drawline(0,200,650,200,7)
drawline(0,250,650,250,7)
drawline(0,300,650,300,7)
Input.KeyDown (chars)
locate (1, 1)
if chars (KEY_UP_ARROW) and x = 50 and y = 300 then
drawfillbox (x, y, x + 50, y + 50, 0)
y := y + 50
drawfillbox (x, y, x + 50, y + 50, 5)
delay (51)
elsif chars (KEY_UP_ARROW) and y <= 250 then
drawfillbox (x, y, x + 50, y + 50, 0)
y := y + 50
drawfillbox (x, y, x + 50, y + 50, 5)
delay (51)
elsif chars (KEY_RIGHT_ARROW) and x <= 520 and y >= 50 then
drawfillbox (x, y, x + 50, y + 50, 0)
x := x + 50
drawfillbox (x, y, x + 50, y + 50, 5)
delay (51)
elsif chars (KEY_LEFT_ARROW) and x >= 50 then
drawfillbox (x, y, x + 50, y + 50, 0)
x := x - 50
drawfillbox (x, y, x + 50, y + 50, 5)
delay (51)
elsif chars (KEY_DOWN_ARROW) and x < 50 and y > 0 then
drawfillbox (x, y, x + 50, y + 50, 0)
y := y - 50
drawfillbox (x, y, x + 50, y + 50, 5)
delay (51)
elsif chars (KEY_DOWN_ARROW) and y > 50 then
drawfillbox (x, y, x + 50, y + 50, 0)
y := y - 50
drawfillbox (x, y, x + 50, y + 50, 5)
delay (51)
end if
delay (50)
randint (num, 0, 6)
if num = 0 then
drawfillbox (x0, 50, x0 + 100, 100, 2)
drawfillbox (x0 - 300, 50, x0 + 100 - 300, 100, 1)
drawfillbox (x0 - 600, 50, x0 + 100 - 600, 100, 45)
if x >= x0 - 50 and y >= 50 and x + 50 <= x0 + 100 and y <= 99 then
exit
elsif x > x0 - 400 and y >= 50 and x + 50 <= x0 + 100 - 300 and y <= 99 then
exit
elsif x > x0 - 700 and y >= 50 and x + 50 <= x0 + 100 - 600 and y <= 99 then
exit
end if
x0 := x0 + 50
drawfillbox (x0 - 50, 50, x0 - 100, 100, 0)
drawfillbox (x0 - 50 - 300, 50, x0 - 100 - 300, 100, 0)
drawfillbox (x0 - 50 - 600, 50, x0 - 100 - 600, 100, 0)
delay (5)
if x0 >= 1270 then
x0 := 0
end if
elsif num = 1 then
drawfillbox (x1, 100, x1 + 100, 150, 3)
drawfillbox (x1 - 300, 100, x1 + 100 - 300, 150, 4)
drawfillbox (x1 - 600, 100, x1 + 100 - 600, 150, 3)
if x >= x1 - 50 and y >= 100 and x + 50 <= x1 + 150 and y <= 149 then
exit
elsif x > x1 - 400 and y >= 100 and x + 50 <= x1 + 150 - 300 and y <= 149 then
exit
elsif x > x1 - 700 and y >= 100 and x + 50 <= x1 + 150 - 600 and y <= 149 then
exit
end if
x1 := x1 + 50
drawfillbox (x1 - 50, 100, x1 - 100, 150, 0)
drawfillbox (x1 - 50 - 300, 100, x1 - 100 - 300, 150, 0)
drawfillbox (x1 - 50 - 600, 100, x1 - 100 - 600, 150, 0)
delay (5)
if x1 >= 1270 then
x1 := 0
end if
elsif num = 2 then
drawfillbox (x2, 150, x2 + 100, 200, 94)
drawfillbox (x2 - 300, 150, x2 + 100 - 300, 200, 78)
drawfillbox (x2 - 600, 150, x2 + 100 - 600, 200, 68)
if x >= x2 - 50 and y >= 150 and x + 50 <= x2 + 150 and y <= 199 then
exit
elsif x > x2 - 400 and y >= 150 and x + 50 <= x2 + 150 - 300 and y <= 199 then
exit
elsif x > x2 - 700 and y >= 150 and x + 50 <= x2 + 150 - 600 and y <= 199 then
exit
end if
x2 := x2 + 50
drawfillbox (x2 - 50, 150, x2 - 100, 200, 0)
drawfillbox (x2 - 50 - 300, 150, x2 - 100 - 300, 200, 0)
drawfillbox (x2 - 50 - 600, 150, x2 - 100 - 600, 200, 0)
delay (5)
if x2 >= 1270 then
x2 := 0
end if
elsif num = 3 then
drawfillbox (x3, 200, x3 + 100, 250, 6)
drawfillbox (x3 - 300, 200, x3 + 100 - 300, 250, 38)
drawfillbox (x3 - 600, 200, x3 + 100 - 600, 250, 97)
if x >= x3 - 50 and y >= 200 and x + 50 <= x3 + 150 and y <= 249 then
exit
elsif x > x3 - 400 and y >= 200 and x + 50 <= x3 + 150 - 300 and y <= 249 then
exit
elsif x > x3 - 700 and y >= 200 and x + 50 <= x3 + 150 - 600 and y <= 249 then
exit
end if
x3 := x3 + 50
drawfillbox (x3 - 50, 200, x3 - 100, 250, 0)
drawfillbox (x3 - 50 - 300, 200, x3 - 100 - 300, 250, 0)
drawfillbox (x3 - 50 - 600, 200, x3 - 100 - 600, 250, 0)
delay (5)
if x3 >= 1270 then
x3 := 0
end if
elsif num = 4 then
drawfillbox (x4, 250, x4 + 100, 300, 9)
drawfillbox (x4 - 300, 250, x4 + 100 - 300, 300, 10)
drawfillbox (x4 - 600, 250, x4 + 100 - 600, 300, 9)
if x >= x4 - 50 and y >= 250 and x + 50 <= x4 + 150 and y <= 299 then
exit
elsif x > x4 - 400 and y >= 250 and x + 50 <= x4 + 150 - 300 and y <= 299 then
exit
elsif x > x4 - 700 and y >= 250 and x + 50 <= x4 + 150 - 600 and y <= 299 then
exit
end if
x4 := x4 + 50
drawfillbox (x4 - 50, 250, x4 - 100, 300, 0)
drawfillbox (x4 - 50 - 300, 250, x4 - 100 - 300, 300, 0)
drawfillbox (x4 - 50 - 600, 250, x4 - 100 - 600, 300, 0)
delay (5)
if x4 >= 1270 then
x4 := 0
end if
elsif num = 5 then
drawfillbox (x5, 300, x5 + 100, 350, 57)
drawfillbox (x5 - 300, 300, x5 + 100 - 300, 350, 3)
drawfillbox (x5 - 600, 300, x5 + 100 - 600, 350, 50)
if x >= x4 - 50 and y >= 300 and x + 50 <= x4 + 150 and y <= 349 then
exit
elsif x > x5 - 400 and y >= 300 and x + 50 <= x5 + 150 - 300 and y <= 349 then
exit
elsif x > x5 - 700 and y >= 300 and x + 50 <= x5 + 150 - 600 and y <= 349 then
exit
end if
x5 := x5 + 50
drawfillbox (x5 - 50, 300, x5 - 100, 350, 0)
drawfillbox (x5 - 50 - 300, 300, x5 - 100 - 300, 350, 0)
drawfillbox (x5 - 50 - 600, 300, x5 - 100 - 600, 350, 0)
delay (5)
if x5 >= 1270 then
x5 := 0
end if
end if
if score > 0 then
score := score - 1
end if
end loop
delay (500)
cls
if win = 1 then
put "You Win! Your Score was: ", score
else
put "Game Over"
end if
|