- Do not allow vertical words for the first turn in duplicate mode

- Adapted unit tests
This commit is contained in:
Olivier Teulière 2009-03-18 18:54:41 +00:00
parent 3bde966efb
commit 7f1c0def1a
6 changed files with 9 additions and 6 deletions

View file

@ -543,6 +543,12 @@ int Game::checkPlayedWord(const wstring &iCoord,
int res = m_board.checkRound(oRound);
if (res != 0)
return res + 4;
// In duplicate mode, the first word must be horizontal
if (getMode() == kDUPLICATE && m_board.isVacant(8, 8))
{
if (oRound.getCoord().getDir() == Coord::VERTICAL)
return 10;
}
// Check that the word can be formed with the tiles in the rack:
// we first create a copy of the rack, then we remove the tiles

View file

@ -160,7 +160,7 @@ public:
* 7: invalid crosscheck
* 8: word already present on the board (no new letter from the rack)
* 9: isolated word (not connected to the rest)
* (10: first word not horizontal) <-- this one has been deactivated
* 10: first word not horizontal (can only happen in duplicate mode)
* 11: first word not covering the H8 square
* 12: word going out of the board
*/

View file

@ -1,7 +1,7 @@
s b duplicate/reject-invalid 0
d 2 0
a t
j ERROR H1
j RELIEUR 8E
j ERROR H2
a T
a S

View file

@ -6,7 +6,7 @@ mode duplicate
[?] pour l'aide
commande> a t
ILERERU
commande> j ERROR H1
commande> j RELIEUR 8E
commande> j ERROR H2
commande> a T
Joueur 0: EEILRRU

View file

@ -4,7 +4,6 @@ j INVéLID h4
j INVALID XX
j INVALID H5
j MAUVAIS H5
j JEUDI 8E
j JEUDI A6
r
a r

View file

@ -12,8 +12,6 @@ commande> j INVALID H5
Mot incorrect ou mal placé (3)
commande> j MAUVAIS H5
Mot incorrect ou mal placé (4)
commande> j JEUDI 8E
Mot incorrect ou mal placé (10)
commande> j JEUDI A6
Mot incorrect ou mal placé (11)
commande> r