Handbook
Glossary
move-object ( board object-pos move object -- board )
Vocabulary
gamelib
.
board
Inputs
board
an
object
object-pos
an
object
move
an
object
object
an
object
Outputs
board
an
object
Definition
USING:
accessors
kernel
math
math.vectors
sequences
;
IN:
gamelib.board
::
move-object
( board object-pos move object -- board )
object-pos move
v+
:>
dest
{
object-pos dest
}
[
first
board
width>>
<
]
all?
{
object-pos dest
}
[
second
board
height>>
<
]
all?
and
object-pos
[
0
>=
]
all?
and
dest
[
0
>=
]
all?
and
[
board object-pos object
delete-from-cell
dest object
add-to-cell
drop
]
when
board
;