瀏覽代碼

A Snake class rework

tags/v1.0
Christos Houtouridis 6 年之前
父節點
當前提交
af5318af9e
共有 1 個文件被更改,包括 20 次插入7 次删除
  1. +20
    -7
      src/SnakePkg/Snake.java

+ 20
- 7
src/SnakePkg/Snake.java 查看文件

@@ -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…
取消
儲存