Ver código fonte

A Ladder class rework

tags/v1.0
Christos Houtouridis 6 anos atrás
pai
commit
f91fc59e79
1 arquivos alterados com 23 adições e 10 exclusões
  1. +23
    -10
      src/SnakePkg/Ladder.java

+ 23
- 10
src/SnakePkg/Ladder.java Ver arquivo

@@ -1,26 +1,39 @@
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
* @email cchoutou@ece.auth.gr
*/
public class Ladder {
/** @name Constructors */
/** @{ */
/** Default ctor */
/** Default doing nothing constructor */
Ladder () {
ladderId = upStepId = downStepId =0;
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) {
this.ladderId = ladderId;
this.upStepId = upStepId;
this.downStepId = downStepId;
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) {
ladderId = l.getLadderId ();
@@ -42,11 +55,11 @@ public class Ladder {
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 */
/** @} */
}

Carregando…
Cancelar
Salvar