diff --git a/game/board.cpp b/game/board.cpp index 32c6daf..33211f8 100644 --- a/game/board.cpp +++ b/game/board.cpp @@ -287,20 +287,13 @@ int Board::checkRoundAux(const Matrix &iTilesMx, t = iRound.getTile(i); if (!iTilesMx[row][col + i].isEmpty()) { - // There is already a letter on the board - if (iTilesMx[row][col + i] != t) + // Using a joker tile to emulate the letter on the board is not allowed, + // the plain letter should be used instead. + // Also, make sure the played letter is the same as the one on the board + if (iRound.isJoker(i) || iTilesMx[row][col+i].toCode() != t.toCode()) { - // Check if it is only a joker - if ((iTilesMx[row][col+i].toCode() == t.toCode()) && iTilesMx[row][col+i].isJoker()) - { - // Do nothing, we don't need to change the tile in the round - //iRound.setJoker(i,true); - } - else - { - // Trying to overwrite a placed letter - return 2; - } + // Trying to overwrite a placed letter + return 2; } isolated = false; diff --git a/test/training_play.input b/test/training_play.input index eec6356..95b8b5e 100644 --- a/test/training_play.input +++ b/test/training_play.input @@ -26,8 +26,12 @@ a t t ADEEPSS j DEPASSE b12 a t -t W? +t WE? j WuS i5 +j JEUX H6 +j JEUx H6 +j Ex 9G +j EX 9G a t a g q diff --git a/test/training_play.ref b/test/training_play.ref index 71feee7..a862754 100644 --- a/test/training_play.ref +++ b/test/training_play.ref @@ -72,11 +72,17 @@ commande> j DEPASSE b12 Mot incorrect ou mal placé (12) commande> a t ADEEPSS -commande> t W? +commande> t WE? commande> j WuS i5 Mot incorrect ou mal placé (7) +commande> j JEUX H6 +Mot incorrect ou mal placé (4) +commande> j JEUx H6 +commande> j Ex 9G +Mot incorrect ou mal placé (6) +commande> j EX 9G commande> a t -W? +W commande> a g 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A - - - - - - - - - - - - - - - @@ -85,8 +91,8 @@ commande> a g D - - - - - - I - - - - - - - - E - - - - - - E - - - - - - - - F - - - - - - G - - - - - - - - - G - - - - - - E - - - - - - - - - H - - - - - J E U - - - - - - - + G - - - - - - E - E - - - - - - + H - - - - - J E U x - - - - - - I - - - - - - S - - - - - - - - J - - - - - - - - - - - - - - - K - - - - - - - - - - - - - - -