Loading ttt_interface/ttt.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -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]; } Loading ttt_interface/ttt.h +9 −1 Original line number Diff line number Diff line Loading @@ -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. Loading Loading
ttt_interface/ttt.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -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]; } Loading
ttt_interface/ttt.h +9 −1 Original line number Diff line number Diff line Loading @@ -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. Loading