Commit 517aaf44 by Terence Martin

Cleanup; remove redundant code

```This removes some methods that used to be used to generate randomly
selected columns and rows. Now each method does this on their own,
so that they can customize the range if they want to.```
parent a51f866a
 ... @@ -918,38 +918,6 @@ var nurdz; ... @@ -918,38 +918,6 @@ var nurdz; MazeGenerator.prototype.randomProbabilty = function (probabiltyArray) { MazeGenerator.prototype.randomProbabilty = function (probabiltyArray) { return probabiltyArray[game.Utils.randomIntInRange(0, probabiltyArray.length - 1)]; return probabiltyArray[game.Utils.randomIntInRange(0, probabiltyArray.length - 1)]; }; }; /** * Randomly select a column in the maze for the purposes of generating * maze contents. * * This ensures that the value selected is valid for a position inside * of the maze; this means that it makes sure that the value is never * one of the edge columns which bound the sides of the maze. * * @returns {number} the randomly selected column in the maze */ MazeGenerator.prototype.genRandomMazeColumn = function () { // Generate, ensuring that we never pick an edge. return game.Utils.randomIntInRange(1, game.MAZE_WIDTH - 1); }; /** * Randomly select a row in the maze for the purposes of generating maze * contents. * * This ensures that the value selected is valid for a position inside * of the maze. In particular we need a row at the top for the balls to * start in and the balls to end up in, plus a row at the top to allow * for at least a potential drop of one ball and a row at the bottom for * the outer boundary. * * @returns {number} [the randomly selected row in the maze */ MazeGenerator.prototype.genRandomMazeRow = function () { // Generate, ensuring that we skip two rows for the initial ball // placements and at least a single row of movement, and two rows on // the bottom to make room for the lower boundary and the goal line. return game.Utils.randomIntInRange(2, game.MAZE_HEIGHT - 3); }; /** /** * Generate our black hole entities into the maze. There is an exact * Generate our black hole entities into the maze. There is an exact * number of this entity in the maze at any given time, which are * number of this entity in the maze at any given time, which are ... ...
 ... @@ -231,42 +231,6 @@ module nurdz.game ... @@ -231,42 +231,6 @@ module nurdz.game return probabiltyArray[Utils.randomIntInRange (0, probabiltyArray.length - 1)]; return probabiltyArray[Utils.randomIntInRange (0, probabiltyArray.length - 1)]; } } /** * Randomly select a column in the maze for the purposes of generating * maze contents. * * This ensures that the value selected is valid for a position inside * of the maze; this means that it makes sure that the value is never * one of the edge columns which bound the sides of the maze. * * @returns {number} the randomly selected column in the maze */ private genRandomMazeColumn () : number { // Generate, ensuring that we never pick an edge. return Utils.randomIntInRange (1, MAZE_WIDTH -1); } /** * Randomly select a row in the maze for the purposes of generating maze * contents. * * This ensures that the value selected is valid for a position inside * of the maze. In particular we need a row at the top for the balls to * start in and the balls to end up in, plus a row at the top to allow * for at least a potential drop of one ball and a row at the bottom for * the outer boundary. * * @returns {number} [the randomly selected row in the maze */ private genRandomMazeRow () : number { // Generate, ensuring that we skip two rows for the initial ball // placements and at least a single row of movement, and two rows on // the bottom to make room for the lower boundary and the goal line. return Utils.randomIntInRange (2, MAZE_HEIGHT - 3); } /** /** * Generate our black hole entities into the maze. There is an exact * Generate our black hole entities into the maze. There is an exact * number of this entity in the maze at any given time, which are * number of this entity in the maze at any given time, which are ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!