Handbook
Glossary
sokoban-move ( board move -- )
Vocabulary
gamelib
.
demos
.
parent-demo
Inputs
board
an
object
move
an
object
Outputs
None
Definition
USING:
combinators
gamelib.board
kernel
math.vectors
;
IN:
gamelib.demos.parent-demo
::
sokoban-move
( board move -- )
board
player
get-pos
:>
player-pos player-pos move
v+
:>
new-pos board new-pos
get-cell
:>
adjacent-cell
{
{
[
adjacent-cell
crate-cell
cell-contains-instance?
]
[
adjacent-cell
crate-cell
get-instance-from-cell
:>
crate board player-pos move crate
move-crate
]
}
{
[
adjacent-cell
is-empty?
adjacent-cell
goal
cell-contains?
or
]
[
board player-pos move
player
move-object
drop
]
}
[
]
}
cond
;