home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
proglang
/
ladybug1.arj
/
BASKET.BUG
< prev
next >
Wrap
Text File
|
1991-01-13
|
4KB
|
200 lines
; basket.bug - basketball game
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 "while :condition :list
if ( run :condition ) = "false then stop
run :list
while :condition :list
end
to "forever :list
repeat 32000 :list
forever :list
end
to "xor :a :b
if :a = "true [output :b = "false]
output :b = "true
end
to "wait :seconds
tone 32000 20 * :seconds
tone 32000 1 ;above times the wait; this makes us wait
end
to "max :a :b
if :a > :b [output :a]
output :b
end
to "min :a :b
if :a > :b [output :b]
output :a
end
to "teams
print [Enter Home Team Nickname]
make "ht request
print [Enter Visiting Team Nickname]
make "vt request
score :hs :vs :ht :vt
make "p 0
jump :p
end
to "start
nodraw
make "hs 0
make "vs 0
make "t 0
make "Q 1
teams
end
to "foul
make "x integer random 6
if :x = 0 [print [Three point play!] 3pt :p stop]
if or ( :x = 1 ) ( :x = 2 ) [print [Two shots made] 2pt :p stop]
if or ( :x = 3 ) ( :x = 4 ) [print [One shot made] 1pt :p stop]
if :x = 5 [print [Missed foul shot] rebound stop]
end
to "2pt :P
if :P = 0 [make "vs :vs + 2 score :hs :vs :ht :vt turnover :p stop]
make "hs :hs + 2
score :hs :vs :ht :vt
turnover :p
stop
end
to "jump :P
make "x integer random 3
if :x = 0 [make "P 1 turnover :p stop]
make "P 0
turnover :p
stop
end
to "center
make "x integer random 14
if :x = 0 [print [Basket scored!] 2pt :p stop]
if :x = 1 [print [Foul] foul stop]
if and :x > 1 :x < 4 [print [Lose ball] turnover :p]
fwd
end
to "print2
print []
print []
end
to "final
print [Game Over]
score :hs :vs :ht :vt
end
to "fwd
make "x random 11
if :x < 4 [print [Basket scored!] 2pt :p stop]
if and :x > 3 :x < 6 [print [Shot missed] rebound stop]
if and :x > 5 :x < 8 [print [Lose ball!] turnover :p stop]
if and :x > 7 :x < 10 [print [Foul] foul :p stop]
if :x = 10 [print [Forward dribbles - Pass again] timer :t :q stop]
end
to "timer :t :q
make "t ( :t + 1 )
if :T < 7 [pass stop]
if :Q = 4 [final stop]
( print [End of quarter] :Q )
make "t 0
make "q :q + 1
score :hs :vs :ht :vt
print [Jump ball starts quarter.]
jump :p
stop
end
to "guard
make "x random 14
if :x < 3 [print [Guard dribbles - pass again] timer :t :q stop]
fwd
end
to "pass
print2
print [C - Pass to Center]
print [G - Pass to Guard]
print [F - Pass to Forward]
print2
print [Choose - C G F]
print2
make "x request
if :x = "c then center stop
if :x = "g then guard stop
if :x = "f then fwd stop
print [Type C G or F] pass
end
to "3pt :p
if :p = 0 [make "vs :vs + 3 score :hs :vs :ht :vt turnover :p stop]
make "hs :hs + 3 turnover :p score :hs :vs :ht :vt stop
end
to "score :hs :vs :ht :vt
print2
print se :ht :hs
print se :vt :vs
print2
end
to "1pt :P
if :p = 0 [make "vs :vs + 1 score :hs :vs :ht :vt fsreb stop]
make "hs :hs + 1
score :hs :vs :ht :vt
fsreb
stop
end
to "turnover :P
if :P = 0 [print :ht print [Ball] make "p 1 pass stop]
print :vt
print [Ball]
make "P 0
PASS
stop
end
to "rebound
make "x random 3
if :x < 2 [print [Rebound to defense] turnover :p stop]
print [offense reboundS]
pass
stop
end
to "fsreb
make "x random 2
if :x = 0 [print [Second shot missed] rebound stop]
turnover :p
end
make "hs "'0
make "vs "'0
make "t "'0
make "q "'1
make "ht "'Jims
make "vt "'Joes
make "p "'0
make "x "'6
make "description [Basketball - type start to begin ]
print :description