Skip to content

Commit 2ecf560

Browse files
committed
fixed suit validation issue
1 parent bcf98de commit 2ecf560

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Sheepshead.wl

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
(* ::Package:: *)
22

3-
(*MakeIndentable["IndentCharacter"\[Rule]" "]*)
4-
5-
63
(* ::Section:: *)
74
(*Sheepshead*)
85

@@ -229,22 +226,20 @@ sheepsheadTrumpQ[card_]
229226
sheepsheadTrumpQ[card_] :=
230227

231228
MemberQ[ {"Queen", "Jack"}, card["Value"]] ||
232-
233229
card["Suit"] == "Diamonds";
234230
(*
235231
sheepsheadValidateCard[leadCard_, hand_, card_]
236232
-- validates an attempted play
237233
*)
238234
sheepsheadValidateCard[leadCard_, hand_, card_, calledCard_] :=
239235

240-
If[leadCard["Suit"] == calledCard["Suit"] &&
241-
236+
If[!sheepsheadTrumpQ[leadCard]&&
237+
leadCard["Suit"] == calledCard["Suit"] &&
242238
MemberQ[hand, calledCard],
243239
card == calledCard,
244240
If[sheepsheadTrumpQ[leadCard],
245241
sheepsheadTrumpQ[card] || Not[AnyTrue[hand, sheepsheadTrumpQ]],
246-
leadCard["Suit"] == card["Suit"] ||
247-
242+
(!sheepsheadTrumpQ[card] && leadCard["Suit"] == card["Suit"]) ||
248243
Not[AnyTrue[hand, leadCard["Suit"] == #["Suit"] &]]
249244
]
250245
];

0 commit comments

Comments
 (0)