[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] Changes to eliot/game/training.cpp [antoine-1]
From: |
eliot-dev |
Subject: |
[Eliot-dev] Changes to eliot/game/training.cpp [antoine-1] |
Date: |
Sun, 23 Oct 2005 16:59:18 -0400 |
Index: eliot/game/training.cpp
diff -u eliot/game/training.cpp:1.8.2.2 eliot/game/training.cpp:1.8.2.3
--- eliot/game/training.cpp:1.8.2.2 Sun Oct 23 18:38:18 2005
+++ eliot/game/training.cpp Sun Oct 23 20:58:20 2005
@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/
-/* $Id: training.cpp,v 1.8.2.2 2005/10/23 18:38:18 afrab Exp $ */
-
#include "dic.h"
#include "tile.h"
#include "rack.h"
@@ -27,6 +25,7 @@
#include "pldrack.h"
#include "player.h"
#include "training.h"
+#include "turn.h"
#include "debug.h"
@@ -42,25 +41,25 @@
}
-int Training::play(int player, Round& round)
+int Training::play(int player, Round& oRound)
{
gdebug("Training::play\n");
- int res = checkPlayedWord(round);
+ int res = checkPlayedWord(oRound);
if (res != 0)
- {
- gdebug("Training::play - error in checkPlayedWord (code %d)\n",res);
- return res;
- }
+ {
+ gdebug("Training::play - error in checkPlayedWord (code
%d)\n",res);
+ return res;
+ }
int player_num = 0;
int turn_num = m_history.getSize();
/* Update the board */
- m_board.addRound(m_dic,round);
+ m_board.addRound(m_dic, oRound);
/* Update the game history */
m_history.setCurrentRack(m_players[player_num]->getHistory().getCurrentRack());
- m_history.playRound(player_num,turn_num,round);
+ m_history.playRound(player_num,turn_num, oRound);
/* Update the rack and the score of the current player */
- m_players[player_num]->playRound(turn_num,round);
+ m_players[player_num]->playRound(turn_num, oRound);
/* reset the search */
m_results.clear();
return 0;
@@ -73,37 +72,37 @@
int res = 0;
int player_num = 0;
if (m_history.getSize() > 1)
- {
- const PlayedRack current_rack = m_history.getCurrentRack();
- const Turn last_turn = m_history.getPreviousTurn();
-
- /* remove the turn for the player */
- ASSERT(0,"player history\n");
- // m_players[player_num]->getHistory().removeLastTurn();
-
- /* remove the turn for the game history */
- m_history.removeLastTurn();
- /* Remove the word from the board */
- m_board.removeRound(m_dic, last_turn.getRound());
- /* Put back the letter in the bag */
- ASSERT(0,"put back tiles in bag\n");
+ {
+ const PlayedRack current_rack = m_history.getCurrentRack();
+ const Turn last_turn = m_history.getPreviousTurn();
+
+ /* remove the turn for the player */
+ ASSERT(0,"player history\n");
+ // m_players[player_num]->getHistory().removeLastTurn();
+
+ /* remove the turn for the game history */
+ m_history.removeLastTurn();
+ /* Remove the word from the board */
+ m_board.removeRound(m_dic, last_turn.getRound());
+ /* Put back the letter in the bag */
+ ASSERT(0,"put back tiles in bag\n");
#if 0
- for (j = 0; j < lastround.getWordLen(); j++)
+ for (j = 0; j < lastround.getWordLen(); j++)
+ {
+ if (lastround.isPlayedFromRack(j))
{
- if (lastround.isPlayedFromRack(j))
- {
- if (lastround.isJoker(j))
- m_bag.replaceTile(Tile::Joker());
- else
- m_bag.replaceTile(lastround.getTile(j));
- }
+ if (lastround.isJoker(j))
+ m_bag.replaceTile(Tile::Joker());
+ else
+ m_bag.replaceTile(lastround.getTile(j));
}
-#endif
}
+#endif
+ }
else
- {
- res = 1;
- }
+ {
+ res = 1;
+ }
return res;
}
@@ -112,8 +111,8 @@
{
Rack rack;
getCurrentPlayer().getCurrentRack().getRack(rack);
- std::cerr << "Training::search() for " << rack.toString()
- << " with history size " << m_history.getSize() << std::endl;
+ std::cerr << "Training::search() for " << rack.toString()
+ << " with history size " << m_history.getSize() << std::endl;
m_results.search(m_dic, m_board, rack, m_history.getSize() - 1);
m_results.sort_by_points();
}
@@ -142,19 +141,19 @@
}
-std::string Training::getTestPlayWord()
+std::string Training::getTestPlayWord() const
{
return testRound.getWord();
}
-int Training::setRack(PlayedRack::set_rack_mode mode, bool check, std::string
rack)
+int Training::setRack(PlayedRack::set_rack_mode mode, bool check, const
std::string& rack)
{
- return Game::setRack(0,mode,check,rack);
+ return Game::setRack(0, mode, check, rack);
}
-
+
/// Local Variables:
/// mode: hs-minor
/// c-basic-offset: 4