Commit 842d9296 authored by Bas Lijnse's avatar Bas Lijnse

Updated game examples

parent 1bc8dbb8
Pipeline #30014 passed with stage
in 4 minutes and 35 seconds
......@@ -74,7 +74,7 @@ pile_image side pile
row_images :: !Bool !RowPlayer -> [Image GameSt]
row_images interactive row
= [ tuneIf interactive (card_image Front row_card)
{onclick = play_row_card row_card.back no, local = False}
{onclick = \_ st -> play_row_card row_card.back no st, local = False}
\\ row_card <- row
& no <- [1..]
]
......@@ -83,8 +83,8 @@ hand_images :: !Bool !Hand !Color -> [Image GameSt]
hand_images interactive {conceal,discard} color
#! conceal_pile = pile_image Back conceal
#! discard_pile = pile_image Front discard
= [ tuneIf interactive conceal_pile {onclick = play_concealed_pile color, local = False}
, tuneIf interactive discard_pile {onclick = play_hand_card color, local = False}
= [ tuneIf interactive conceal_pile {onclick = \_ st -> play_concealed_pile color st, local = False}
, tuneIf interactive discard_pile {onclick = \_ st -> play_hand_card color st, local = False}
]
player_arc :== 0.45 * pi
......
......@@ -44,7 +44,7 @@ board :: Bool Span TraxSt -> Image TraxSt
board it_is_my_turn d st=:{trax}
| no_of_tiles trax == zero
| it_is_my_turn = grid (Rows 2) (RowMajor, LeftToRight, TopToBottom) [] [] [] []
[ tileImage d tile <@< {onclick = start_with_this tile, local = False}
[ tileImage d tile <@< {onclick = \_ st -> start_with_this tile st, local = False}
\\ tile <- gFDomain{|*|}
] NoHost
| otherwise = voidImage d
......@@ -73,9 +73,9 @@ unselectedImage d = tileShape d <@< {fill = freeTileColor}
freeImage :: Span Coordinate TraxSt -> Image TraxSt
freeImage d coord {trax,choice}
| isEmpty candidates = illegalImage d
| maybe True ((<>) coord) choice = unselectedImage d <@< {onclick = setcell coord, local = False}
| maybe True ((<>) coord) choice = unselectedImage d <@< {onclick = \_ st -> setcell coord st, local = False}
| otherwise = above (repeat AtMiddleX) [] (Just d) []
[tileImage (d /. no_of_candidates) tile <@< {onclick = settile coord tile, local = False} \\ tile <- candidates]
[tileImage (d /. no_of_candidates) tile <@< {onclick = \_ st -> settile coord tile st, local = False} \\ tile <- candidates]
(Host (unselectedImage d))
where
candidates = [tile \\ tile <- possible_tiles trax coord | isJust (mandatory_moves (add_tile coord tile trax) coord)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment