Initial commit

This commit is contained in:
2023-09-25 20:27:38 +08:00
committed by GitHub
commit 283dba9fe1
21 changed files with 957 additions and 0 deletions

63
src/include/client.h Normal file
View File

@ -0,0 +1,63 @@
#ifndef CLIENT_H
#define CLIENT_H
#include <iostream>
#include <utility>
extern int rows; // The count of rows of the game map
extern int columns; // The count of columns of the game map
// You can not use any other external variables except for rows and columns.
/**
* @brief The definition of function Execute(int, int)
*
* @details This function is designed to take a step when player the client's (or player's) role, and the implementation
* of it has been finished by TA. (I hope my comments in code would be easy to understand T_T) If you do not understand
* the contents, please ask TA for help immediately!!!
*
* @param row The row coordinate (0-based) of the block to be visited.
* @param column The column coordinate (0-based) of the block to be visited.
*/
void Execute(int row, int column);
/**
* @brief The definition of function InitGame()
*
* @details This function is designed to initialize the game. It should be called at the beginning of the game, which
* will read the scale of the game map and the first step taken by the server (see README).
*/
void InitGame() {
int first_row, first_column;
std::cin >> first_row >> first_column;
Execute(first_row, first_column);
}
/**
* @brief The definition of function ReadMap()
*
* @details This function is designed to read the game map from stdin when playing the client's (or player's) role.
* Since the client (or player) can only get the limited information of the game map, so if there is a 3 * 3 map as
* above and only the block (2, 0) has been visited, the stdin would be
* ???
* 12?
* 01?
*/
void ReadMap() {
// TODO (student): Implement me!
}
/**
* @brief The definition of function Decide()
*
* @details This function is designed to decide the next step when playing the client's (or player's) role. Open up your
* mind and make your decision here!
*/
void Decide() {
// TODO (student): Implement me!
// while (true) {
// Execute(0, 0);
// }
}
#endif