mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-17 06:11:49 +01:00
- extra debug output command for board cross info
This commit is contained in:
parent
aeb3cdb781
commit
70041c80b3
3 changed files with 72 additions and 1 deletions
|
@ -188,8 +188,10 @@ void help_training()
|
|||
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 @@ void display_data(const Game &iGame, const wchar_t *delim, wchar_t **state)
|
|||
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,7 +318,17 @@ void display_data(const Game &iGame, const wchar_t *delim, wchar_t **state)
|
|||
GameIO::printNonPlayed(cout, iGame);
|
||||
break;
|
||||
case L'p':
|
||||
iGame.save(cout,Game::FILE_FORMAT_ADVANCED);
|
||||
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);
|
||||
|
@ -419,7 +434,9 @@ void loop_training(Training &iGame)
|
|||
{
|
||||
int n = _wtoi(token);
|
||||
if (n <= 0)
|
||||
{
|
||||
iGame.back(n == 0 ? 1 : -n);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iGame.playResult(--n))
|
||||
|
|
|
@ -51,6 +51,32 @@ void GameIO::printBoard(ostream &out, const Game &iGame)
|
|||
}
|
||||
}
|
||||
|
||||
/* 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::printAllPoints(ostream &out, const Game &iGame)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -41,9 +41,11 @@ class GameIO
|
|||
{
|
||||
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 @@ public:
|
|||
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();
|
||||
|
|
Loading…
Reference in a new issue