|
- package net.hoo2.auth.labyrinth;
-
-
- /**
- * @brief
- * This class represents the game's player
- */
- class Player {
-
-
- /**
- * @name Accessor/Mutator interface
- * @note
- * Please consider not to use mutator interface. Its the abstraction killer :(
- * We have added a bit of logic however, in order to make it a bit more safe.
- */
- /** @{ */
- int getPlayerId () { return playerId; }
- String getName() { return name; }
- Board getBoard () { return board; }
- int getScore () { return score; }
- int getX() { return x; }
- int getY() { return y; }
-
- void setPlayerId(int id) { playerId = id; }
- void setName(String name) { this.name = name; }
- void setBoard (Board board){ this.board = board; }
- void setScore(int score) { this.score = score; }
- void setX(int x) {
- assert (x >= 0 && x< Session.boardSize) : "X(column) coordinate must be in the range [0, Session.boardSize)";
- this.x = x;
- }
- void setY(int y) {
- assert (y >= 0 && y< Session.boardSize) : "Y(row) coordinate must be in the range [0, Session.boardSize)";
- this.y = y;
- }
- /** @} */
-
- /** @name Class data */
- /** @{ */
- private int playerId; /**< The unique identifier of the player */
- private String name; /**< The name of the player */
- private Board board; /**< Reference to the session's boards */
- private int score; /**< The current score of the player */
- private int x; /**< The column coordinate of the player on the board */
- private int y; /**< The row coordinate of the player on the board */
- /** @} */
- }
|