Created
November 17, 2010 17:50
-
-
Save linuxsable/703721 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Check to make sure this is going to be the only | |
| // occupant of the new coordinates. | |
| var that = this; | |
| var createCoords = function() { | |
| var o = []; | |
| // coords[0] = helpers.generateRandomNumber(this.BOARD_WIDTH - 1); | |
| // coords[1] = helpers.generateRandomNumber(this.BOARD_HEIGHT - 1); | |
| o[0] = helpers.generateRandomNumber(2); | |
| o[1] = helpers.generateRandomNumber(2); | |
| if (that.board.getOccupant(o)) { | |
| console.log('first:' + o); | |
| createCoords(); | |
| } else { | |
| console.log('sec:' + o); | |
| return o; | |
| } | |
| }; | |
| var coords = createCoords(); | |
| console.log('third:' + coords); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment