diff --git a/src/net/hoo2/auth/dsproject/snake/Apple.java b/src/net/hoo2/auth/dsproject/snake/Apple.java index e3ddd36..d9afe74 100644 --- a/src/net/hoo2/auth/dsproject/snake/Apple.java +++ b/src/net/hoo2/auth/dsproject/snake/Apple.java @@ -35,7 +35,7 @@ public class Apple { Apple (int appleId, int appleTileId, String color, int points) { this.appleId = appleId; this.appleTileId = appleTileId; - this.color = color; + this.color = new String(color); this.points = points; } /** Copy constructor @@ -44,7 +44,7 @@ public class Apple { Apple (Apple a) { appleId = a.getAppleId (); appleTileId = a.getAppleTileId (); - color = a.getColor (); + color = new String (a.getColor ()); points = a.getPoints (); } /** @} */ @@ -92,7 +92,7 @@ public class Apple { * } * would be better and far less error prone. * In order to support this style of color encoding we have to strict the - * color names to lower case letters and also convert user input. + * color names to lower case letters and also "low case-convert" the user input. * We also update the points sign to make calculations easier. * @see setColor */ diff --git a/src/net/hoo2/auth/dsproject/snake/Board.java b/src/net/hoo2/auth/dsproject/snake/Board.java index 24c3d38..9b82f1c 100644 --- a/src/net/hoo2/auth/dsproject/snake/Board.java +++ b/src/net/hoo2/auth/dsproject/snake/Board.java @@ -6,9 +6,9 @@ import java.lang.Math; * @class Board * @brief The game's board representation. * - * The board in a square collection of tiles numbered in a + * The board is a square collection of tiles numbered in a * boustrophedon (zig-zag) way. A number of snakes, ladders - * and apples which called elements are placed on the board + * and apples which we called elements are placed on the board * for each game. * * @author Christos Choutouridis 8997 @@ -82,7 +82,7 @@ public class Board { ladders = new Ladder[B.getLadders().length]; apples = new Apple[B.getApples().length]; // Copy B's guts into new memory - setTiles(B.getTiles()); // primitive + copyTiles(B.getTiles()); copySnakes(B.getSnakes()); copyLadders(B.getLadders()); copyApples(B.getApples()); @@ -110,15 +110,7 @@ public class Board { * @param tiles Source of tiles to use * @note This has to be called if the board is default constructed */ - void setTiles (int[][] tiles) { - // Check if we need allocation - if (this.tiles == null) - this.tiles = new int[N][M]; - // Assign values - for (int i =0 ; i