sokoban-move ( board move -- )


Vocabulary
gamelib.demos.sokoban

Inputs
boardan object
movean object


Outputs
None

Definition


:: 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 ;