home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
logo
/
labybug
/
target.bug
< prev
next >
Wrap
Text File
|
1989-12-31
|
1KB
|
71 lines
to "poly :d :a
forward :d
right :a
poly :d :a
end
to "ask
print [Can you hit the target?] wait 20
print [Give me an x- and a y- coordinate.]
wait 20
print [x = ] make "x1 request
print [y = ] make "y1 request
test and :x1 > abs 250 :y1 < abs 150
iftrue print [Your number is too big. Try again.] wait 20 ask
iffalse pd st setxy :x1 :y1
if or ( :x1 > ( :x + 5 ) ) ( :x1 < ( :x - 5 ) ) pu home pd ask
if or ( :y1 > ( :y + 5 ) ) ( :y1 < ( :y - 5 ) ) pu home pd ask
cheers
end
to "and :a :b
if :a = "true [output :b = "true]
output "false
end
to "or :a :b
if :a = "true [output "true]
output :b = "true
end
to "wait :seconds
tone 32000 20 * :seconds
tone 32000 1 ;above times the wait; this makes us wait
end
to "target
pu ht
setxy ( random 350 ) - 225 ( random 250 ) - 100
make "x xcor + 6
make "y ycor
pd
repeat 36 [fd 1 rt 10]
pu home st
end
to "game
draw cleartext
target
ask
end
to "cheers
cleartext
repeat 24 [print [Congratulations!]]
wait 10
print1 [Want to play again? (Y/N) ]
make "ans request
if :ans = "y [game]
if :ans = "n [print [Bye for now!]]
end
make "x "'5
make "y "'17
make "x1 "'5
make "y1 "'15
uest
if :ans = "y [game]
if :ans = "n [print [Bye for now!]]
end
make "