minesweeper: re-use click-cells-around.

windows-high-dpi
John Benediktsson 2018-03-05 09:05:20 -08:00
parent 3c7b0825db
commit 1386489bbc
1 changed files with 3 additions and 10 deletions

View File

@ -88,10 +88,8 @@ DEFER: click-cell-at
neighbors [ neighbors [
first2 [ row + ] [ col + ] bi* :> ( row' col' ) first2 [ row + ] [ col + ] bi* :> ( row' col' )
cells row' col' cell-at [ cells row' col' cell-at [
mined?>> [ cells row' col' click-cell-at drop
cells row' col' click-cell-at drop ] when
] unless
] when*
] each ; ] each ;
:: click-cell-at ( cells row col -- ? ) :: click-cell-at ( cells row col -- ? )
@ -125,12 +123,7 @@ DEFER: click-cell-at
cells row col cell-at [ cells row col cell-at [
state>> +clicked+ = [ state>> +clicked+ = [
cells row col [ adjacent-flags ] [ adjacent-mines ] 3bi = [ cells row col [ adjacent-flags ] [ adjacent-mines ] 3bi = [
neighbors [ cells row col click-cells-around
first2 [ row + ] [ col + ] bi* :> ( row' col' )
cells row' col' cell-at [
cells row' col' click-cell-at drop
] when
] each
] when ] when
] when t ] when t
] [ f ] if* ; ] [ f ] if* ;