[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot/utils game_io.h game_io.cpp eliottxt.cpp
From: |
eliot-dev |
Subject: |
[Eliot-dev] eliot/utils game_io.h game_io.cpp eliottxt.cpp |
Date: |
Sun, 05 Nov 2006 13:27:50 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Antoine Fraboulet <afrab> 06/11/05 13:27:50
Modified files:
utils : game_io.h game_io.cpp eliottxt.cpp
Log message:
- extra debug output command for board cross info
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/game_io.h?cvsroot=eliot&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/game_io.cpp?cvsroot=eliot&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/eliottxt.cpp?cvsroot=eliot&r1=1.16&r2=1.17
Patches:
Index: game_io.h
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/game_io.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- game_io.h 4 Nov 2005 20:00:06 -0000 1.3
+++ game_io.h 5 Nov 2006 13:27:49 -0000 1.4
@@ -41,9 +41,11 @@
{
public:
static void printBoard(ostream &out, const Game &iGame);
+ static void printBoardDebug(ostream &out, const Game &iGame);
static void printBoardJoker(ostream &out, const Game &iGame);
static void printBoardMultipliers(ostream &out, const Game &iGame);
static void printBoardMultipliers2(ostream &out, const Game &iGame);
+
static void printNonPlayed(ostream &out, const Game &iGame);
static void printPlayedRack(ostream &out, const Game &iGame, int n);
static void printAllRacks(ostream &out, const Game &iGame);
@@ -51,6 +53,8 @@
static void printPoints(ostream &out, const Game &iGame);
static void printAllPoints(ostream &out, const Game &iGame);
+ static void printGameDebug(ostream &out, const Game &iGame);
+
private:
/// This class is a toolbox, and should not be instanciated
GameIO();
Index: game_io.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/game_io.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- game_io.cpp 22 Jan 2006 12:23:53 -0000 1.9
+++ game_io.cpp 5 Nov 2006 13:27:49 -0000 1.10
@@ -51,6 +51,32 @@
}
}
+/* this mode is used for regression tests */
+void GameIO::printBoardDebug(ostream &out, const Game &iGame)
+{
+ int row, col;
+
+ /* first printf row cell contents */
+ for (row = BOARD_MIN; row <= BOARD_MAX; row++)
+ {
+ out << " " << (char)(row - BOARD_MIN + 'A') << "r ";
+ for (col = BOARD_MIN; col <= BOARD_MAX; col++)
+ {
+ out << iGame.getBoard().getCellContent_row(row, col);
+ }
+ out << endl;
+ }
+ out << " -" << endl;
+ for (row = BOARD_MIN; row <= BOARD_MAX; row++)
+ {
+ out << " " << (char)(row - BOARD_MIN + 'A') << "c ";
+ for (col = BOARD_MIN; col <= BOARD_MAX; col++)
+ {
+ out << iGame.getBoard().getCellContent_col(row, col);
+ }
+ out << endl;
+ }
+}
void GameIO::printBoardJoker(ostream &out, const Game &iGame)
{
@@ -221,3 +247,27 @@
}
}
+
+void GameIO::printGameDebug(ostream &out, const Game &iGame)
+{
+ out << "Game:: joueur en cours " << iGame.currPlayer() << " sur " <<
iGame.getNPlayers() << endl;
+ out << "Game:: mode " << iGame.getModeAsString() << endl;
+ out << "Game:: variante ";
+ switch (iGame.getVariant())
+ {
+ case Game::kNONE:
+ out << "aucune" << endl;
+ break;
+ case Game::kJOKER:
+ out << "joker" << endl;
+ break;
+ default:
+ out << "inconnu" << endl;
+ break;
+ }
+ out << "Game:: rack size " << iGame.RACK_SIZE << endl;
+ out << "Game:: history --" << endl;
+ out << convertToMb(iGame.getHistory().toString());
+ out << "--" << endl;
+ out << "" << endl;
+}
Index: eliottxt.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/eliottxt.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- eliottxt.cpp 11 Aug 2006 22:06:53 -0000 1.16
+++ eliottxt.cpp 5 Nov 2006 13:27:49 -0000 1.17
@@ -188,8 +188,10 @@
printf(" gj -- grille + jokers\n");
printf(" gm -- grille + valeur des cases\n");
printf(" gn -- grille + valeur des cases (variante)\n");
+ printf(" gd -- grille + debug cross (debug only)\n");
printf(" l -- lettres non jouées\n");
printf(" p -- partie\n");
+ printf(" pd -- partie (debug)\n");
printf(" P -- partie (format standard)\n");
printf(" r -- recherche\n");
printf(" s -- score\n");
@@ -292,6 +294,9 @@
case L'\0':
GameIO::printBoard(cout, iGame);
break;
+ case L'd':
+ GameIO::printBoardDebug(cout, iGame);
+ break;
case L'j':
GameIO::printBoardJoker(cout, iGame);
break;
@@ -313,8 +318,18 @@
GameIO::printNonPlayed(cout, iGame);
break;
case L'p':
+ switch (token[1])
+ {
+ case '\0':
iGame.save(cout,Game::FILE_FORMAT_ADVANCED);
break;
+ case 'd':
+ GameIO::printGameDebug(cout, iGame);
+ break;
+ default:
+ printf("commande inconnue\n");
+ }
+ break;
case L'P':
iGame.save(cout,Game::FILE_FORMAT_STANDARD);
break;
@@ -419,7 +434,9 @@
{
int n = _wtoi(token);
if (n <= 0)
+ {
iGame.back(n == 0 ? 1 : -n);
+ }
else
{
if (iGame.playResult(--n))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot/utils game_io.h game_io.cpp eliottxt.cpp,
eliot-dev <=