@@ -12,7 +12,7 @@ defmodule Lora.Contracts.Lora do
1212 @ impl true
1313 def is_legal_move? ( state , seat , { suit , rank } ) do
1414 layout = state . lora_layout
15- hand = state . hands [ seat ]
15+ _hand = state . hands [ seat ]
1616
1717 # If this is the first card played in Lora, any card is legal
1818 if Enum . all? ( layout , fn { _ , cards } -> cards == [ ] end ) do
@@ -32,8 +32,10 @@ defmodule Lora.Contracts.Lora do
3232 |> Enum . find ( fn _ -> true end )
3333
3434 case any_laid_card do
35- nil -> true # No cards played yet
36- { _ , first_rank } -> rank == first_rank # Must match the first played card's rank
35+ # No cards played yet
36+ nil -> true
37+ # Must match the first played card's rank
38+ { _ , first_rank } -> rank == first_rank
3739 end
3840
3941 # Cards of this suit already played, card must be the next in sequence
@@ -59,11 +61,7 @@ defmodule Lora.Contracts.Lora do
5961 { next_player , can_anyone_play } = find_next_player_who_can_play ( state , hands , seat )
6062
6163 if can_anyone_play do
62- { :ok , % { state |
63- hands: hands ,
64- lora_layout: lora_layout ,
65- current_player: next_player
66- } }
64+ { :ok , % { state | hands: hands , lora_layout: lora_layout , current_player: next_player } }
6765 else
6866 # No one can play, the deal is over
6967 deal_over_state = handle_lora_winner ( state , hands , seat )
@@ -156,20 +154,17 @@ defmodule Lora.Contracts.Lora do
156154
157155 # Check if the game is over
158156 if Game . game_over? ( state ) do
159- % { state |
160- hands: hands ,
161- scores: updated_scores ,
162- phase: :finished
163- }
157+ % { state | hands: hands , scores: updated_scores , phase: :finished }
164158 else
165159 # Move to the next contract or dealer
166160 { next_dealer , next_contract } = Game . next_dealer_and_contract ( state )
167161
168162 # Deal the next contract
169- Game . deal_new_contract ( % { state |
170- dealer_seat: next_dealer ,
171- contract_index: next_contract ,
172- scores: updated_scores
163+ Game . deal_new_contract ( % {
164+ state
165+ | dealer_seat: next_dealer ,
166+ contract_index: next_contract ,
167+ scores: updated_scores
173168 } )
174169 end
175170 end
0 commit comments