cell-image-path ( cell won? lost? -- image-path )


Vocabulary
minesweeper

Inputs
cellan object
won?an object
lost?an object


Outputs
image-pathan object


Definition


:: cell-image-path ( cell won? lost? -- image-path )
won? lost? or cell mined?>> and [
cell state>> {
{ +flagged+ [ "flagged.gif" ] }
{ +clicked+ [ "mineclicked.gif" ] }
[ drop won? "flagged.gif" "mine.gif" ? ]
} case
] [
cell state>> {
{ +question+ [ "question.gif" ] }
{
+flagged+
[ lost? "misflagged.gif" "flagged.gif" ? ]
}
{
+clicked+
[
cell #adjacent>> 0 or
number>string "open" ".gif" surround
]
}
{ f [ "blank.gif" ] }
} case
] if "vocab:minesweeper/_resources/" prepend ;