|
- package SnakePkg;
-
- /**
- * A class to represent a Snake in the Board
- * @author Christos Choutouridis 8997
- */
- public class Snake {
- /** @name Constructors */
- /** @{ */
- /** Default ctor */
- Snake () {
- snakeId = headId = tailId = 0;
- }
- /** Main Constructor */
- 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
- */
- Snake (Snake s) {
- snakeId = s.getSnakeId ();
- headId = s.getHeadId ();
- tailId = s.getTailId ();
- }
- /** @} */
-
- /** @name Get/Set interface */
- /** @{ */
- int getSnakeId () { return snakeId; }
- void setSnakeId (int snakeId) { this.snakeId = snakeId; }
- int getHeadId () { return headId; }
- void setHeadId (int headId) { this.headId = headId; }
- int getTailId () { return tailId; }
- void setTailId (int tailId) { this.tailId = tailId; }
- /** @} */
-
- /** @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
- /** @} */
- }
|