- off by one in History. corrected. all regression tests ok.

Scenario: training_dict
Scenario: training_bag
Scenario: training_search
Scenario: training_play
Scenario: duplicate_2_ai
Scenario: freegame_passing
Scenario: freegame_change
Scenario: freegame_3_ai

Summary: Everything was OK.
This commit is contained in:
Antoine Fraboulet 2005-12-27 00:06:23 +00:00
parent 41e90acadc
commit d3e9d1e0ac
4 changed files with 10 additions and 10 deletions

View file

@ -133,7 +133,7 @@ public:
* Methods to access already played words.
* The int parameter should be 0 <= int < getNTurns()
*/
const History& getHistory() { return m_history; }
const History& getHistory() const { return m_history; }
/**
* Methods to access players.

View file

@ -60,7 +60,7 @@ History::~History()
int History::getSize() const
{
return m_history.size();
return m_history.size() - 1;
}
@ -79,7 +79,7 @@ void History::setCurrentRack(const PlayedRack &iPld)
const Turn& History::getPreviousTurn() const
{
int idx = m_history.size() - 2;
ASSERT(0 <= idx , "Wrong turn number");
ASSERT(0 <= idx , "No previous turn");
return *(m_history[idx]);
}

View file

@ -28,10 +28,9 @@
#define _HISTORY_H
#include <vector>
class Turn;
class PlayedRack;
class Round;
#include "pldrack.h"
#include "round.h"
#include "turn.h"
/**
* History stores all the turns that have been played
@ -39,9 +38,11 @@ class Round;
* - one for the complete game
* - one for each of the players
*
* A History is never empty (getSize() can be used as the is the current turn
* A History is never void (getSize() can be used as the is the current turn
* number for the complete game history).
*
* History starts at zero.
*
* The top of the history is an empty
* Turn until it has been filled and game is up to a new round.
*

View file

@ -58,8 +58,7 @@ void Results::search(const Dictionary &iDic, Board &iBoard,
{
clear();
/* we start at round 1 */
if (iTurn == 1)
if (iTurn == 0)
{
iBoard.searchFirst(iDic, iRack, *this);
}