Handbook
Glossary
move-computer ( GADGET -- )
Vocabulary
pong
Inputs
GADGET
an
object
Outputs
None
Definition
USING:
accessors
kernel
math
math.order
random
ranges
sequences
;
IN:
pong
::
move-computer
( GADGET -- )
GADGET
ball>>
pos>>
first
:>
X GADGET
computer>>
PADDLE-SIZE
2/
+
:>
COMPUTER X
BALL-SIZE
+
COMPUTER
-
dup
0
<
[
>integer
-10
max
0
[a..b]
random
GADGET
swap
move-computer-by
]
[
drop
]
if
X COMPUTER
-
dup
0
>
[
>integer
10
min
[0..b]
random
GADGET
swap
move-computer-by
]
[
drop
]
if
;