Browse Source

A Snake class rework

tags/v1.0
Christos Houtouridis 5 years ago
parent
commit
af5318af9e
1 changed files with 20 additions and 7 deletions
  1. +20
    -7
      src/SnakePkg/Snake.java

+ 20
- 7
src/SnakePkg/Snake.java View File

@@ -1,24 +1,37 @@
package SnakePkg;
/**
* A class to represent a Snake in the Board
* @class Snake
* @brief Represent a Snake in the Board.
*
* Snakes are part of the elements we place on the board and they add
* difficulty to the game.
*
* @author Christos Choutouridis 8997
* @email cchoutou@ece.auth.gr
*/
public class Snake {
/** @name Constructors */
/** @{ */
/** Default ctor */
/** Default doing nothing constructor */
Snake () {
snakeId = headId = tailId = 0;
}
/** Main Constructor */
/**
* @brief Main constructor
* This creates a snake on the board.
* @param snakeId The id of snake to create
* @param headId The tile of snake's head
* @param tailId The tile of snake's tail
*/
Snake (int snakeId, int headId, int tailId) {
this.snakeId = snakeId;
this.headId = headId;
this.tailId = tailId;
}
/** Copy constructor
* @note We don't use clone as long as we don't inherit Cloneable iface
* @param s The snake we want to copy
*/
Snake (Snake s) {
snakeId = s.getSnakeId ();
@@ -39,8 +52,8 @@ public class Snake {
/** @name Data members (private) */
/** @{ */
private int snakeId; //!< Snake's ID
private int headId; //!< Snake's head tile location
private int tailId; //!< Snake's tail tile location
private int snakeId; /**< Snake's ID */
private int headId; /**< Snake's head tile location */
private int tailId; /**< Snake's tail tile location */
/** @} */
}

Loading…
Cancel
Save