Commit e4f4f24a authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

Merge branch 'ttt' into 'master'

Ttt

See merge request !1
parents f6dc679b 21da515b
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -204,6 +204,12 @@ string getBoard(GAME_CODE theGameCode) {
  return parseGameStatus(theGameCode)["board"];
}

SQUARE getBoardSquare(string board, int theRow, int theCol) {
  int cols = board.find("\\n");
  return board[theRow*(cols+2)+theCol];
}


SQUARE getHasWon(GAME_CODE theGameCode) {
  return parseGameStatus(theGameCode)["hasWon"][0];
}
+9 −1
Original line number Diff line number Diff line
@@ -97,10 +97,18 @@ SQUARE getToMove(GAME_CODE theGameCode);

/**
 * @param theGameCode The code of the Game in question.
 * @return A tstring representing the current board in the game with the given game code.
 * @return A string representing the current board in the game with the given game code.
 */
string getBoard(GAME_CODE theGameCode);

/**
 * @param board a game board produced by the function getBoard(GAME_CODE theGameCode).
 * @param theRow a row on the game board.
 * @param theCol a colum on the game board.
 * @return The square at row [theRow] and column [theCol] on the given board.
 */
SQUARE getBoardSquare(string board, int theRow, int theCol);

/**
 * @param theGameCode The code of the Game in question.
 * @return Who has won the game, or '-' if no one has won yet.