From 8967f65573b6ae3c68b4cce67d6de4f5b5ca49df Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Tue, 4 Nov 2014 05:00:41 +0000 Subject: [PATCH] Change order of error messages This way the other players don't learn information about your hand (i.e. that you do not have a card) if you accidentally play the wrong suit. --- spades.awk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spades.awk b/spades.awk index 2ca0e37..50952f1 100644 --- a/spades.awk +++ b/spades.awk @@ -709,9 +709,6 @@ sp_state == "play" && if (!(_card in sp_deck)) { reply("Invalid card") } - else if (!(_card in sp_hands[sp_from])) { - reply("You do not have that card") - } else if (sp_suit && _card !~ sp_suit && sp_hasa(sp_from, sp_suit)) { reply("You must follow suit (" sp_suit ")") } @@ -721,6 +718,9 @@ sp_state == "play" && else if (_card ~ /s/ && length(sp_pile) == 0 && sp_hasa(sp_from, "[^s]$") && !sp_broken) { reply("Spades have not been broken") } + else if (!(_card in sp_hands[sp_from])) { + reply("You do not have that card") + } else { sp_play(_card) if (sp_state == "play") { -- 2.43.2