Handbook
Glossary
sokoban-move ( board move -- )
Vocabulary
gamelib
.
demos
.
sokoban
Inputs
board
an
object
move
an
object
Outputs
None
Definition
USING:
combinators
gamelib.board
gamelib.demos.sokoban.layouts
kernel
math.vectors
;
IN:
gamelib.demos.sokoban
::
sokoban-move
( board move -- )
board
[
player
=
]
find-cell-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
;