|
@@ -1,26 +1,39 @@ |
|
|
package SnakePkg;
|
|
|
package SnakePkg;
|
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* A class to represent a Ladder in the Board
|
|
|
|
|
|
|
|
|
* @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 8997
|
|
|
* @author Christos Choutouridis 8997
|
|
|
|
|
|
* @email cchoutou@ece.auth.gr
|
|
|
*/
|
|
|
*/
|
|
|
public class Ladder {
|
|
|
public class Ladder {
|
|
|
/** @name Constructors */
|
|
|
/** @name Constructors */
|
|
|
/** @{ */
|
|
|
/** @{ */
|
|
|
/** Default ctor */
|
|
|
|
|
|
|
|
|
/** Default doing nothing constructor */
|
|
|
Ladder () {
|
|
|
Ladder () {
|
|
|
ladderId = upStepId = downStepId =0;
|
|
|
ladderId = upStepId = downStepId =0;
|
|
|
broken = false;
|
|
|
broken = false;
|
|
|
}
|
|
|
}
|
|
|
/** Main ctor */
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @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) {
|
|
|
Ladder (int ladderId, int upStepId, int downStepId) {
|
|
|
this.ladderId = ladderId;
|
|
|
this.ladderId = ladderId;
|
|
|
this.upStepId = upStepId;
|
|
|
this.upStepId = upStepId;
|
|
|
this.downStepId = downStepId;
|
|
|
this.downStepId = downStepId;
|
|
|
this.broken = false; // A new ladder is always in good condition
|
|
|
this.broken = false; // A new ladder is always in good condition
|
|
|
}
|
|
|
}
|
|
|
/** Copy constructor
|
|
|
|
|
|
* @note We don't use clone as long as we don't inherit Cloneable iface
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Copy constructor
|
|
|
|
|
|
* @param l The ladder we want to copy
|
|
|
*/
|
|
|
*/
|
|
|
Ladder (Ladder l) {
|
|
|
Ladder (Ladder l) {
|
|
|
ladderId = l.getLadderId ();
|
|
|
ladderId = l.getLadderId ();
|
|
@@ -42,11 +55,11 @@ public class Ladder { |
|
|
void setBroken (boolean broken) { this.broken = broken; }
|
|
|
void setBroken (boolean broken) { this.broken = broken; }
|
|
|
/** @} */
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
/** @name Data members (private) */
|
|
|
|
|
|
|
|
|
/** @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
|
|
|
|
|
|
|
|
|
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 */
|
|
|
/** @} */
|
|
|
/** @} */
|
|
|
}
|
|
|
}
|