|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package net.hoo2.auth.dsproject.snake;
-
- /**
- * @class Ladder
- * @brief Represent a Ladder in the Board.
- *
- * Ladders are part of the elements we place on the board.
- * They help the user to elevate rows. Each ladder can be used only once.
- *
- * @author Christos Choutouridis AEM:8997
- * @email cchoutou@ece.auth.gr
- */
- public class Ladder {
- /** @name Constructors */
- /** @{ */
- /** Default doing nothing constructor */
- Ladder () {
- ladderId = upStepId = downStepId =0;
- broken = false;
- }
- /**
- * @brief The main constructor
- * We create a ladder in the board
- * @param ladderId The id of ladder to create
- * @param upStepId The up-step tile of ladder
- * @param downStepId The down-step tile of ladder
- */
- Ladder (int ladderId, int upStepId, int downStepId) {
- this.ladderId = ladderId;
- this.upStepId = upStepId;
- this.downStepId = downStepId;
- this.broken = false; // A new ladder is always in good condition
- }
- /**
- * Copy constructor
- * @param l The ladder we want to copy
- */
- Ladder (Ladder l) {
- ladderId = l.getLadderId ();
- upStepId = l.getUpStepId ();
- downStepId = l.getDownStepId ();
- broken = l.getBroken ();
- }
- /** @} */
-
- /** @name Get/Set interface */
- /** @{ */
- int getLadderId () { return ladderId; }
- void setLadderId (int ladderId) { this.ladderId = ladderId; }
- int getUpStepId () { return upStepId; }
- void setUpStepId (int upStepId) { this.upStepId = upStepId; }
- int getDownStepId () { return downStepId; }
- void setDownStepId (int downStepId) { this.downStepId = downStepId; }
- boolean getBroken () { return broken; }
- void setBroken (boolean broken) { this.broken = broken; }
- /** @} */
-
- /** @name Data members */
- /** @{ */
- private int ladderId; /**< Ladder's ID */
- private int upStepId; /**< Ladder's upper step tile location */
- private int downStepId; /**< Snake's down step tile location */
- private boolean broken; /**< flag to indicate used/broken ladder */
- /** @} */
- }
|