arraysweeper
Advanced tools
Comparing version 0.0.5 to 0.0.6
26
index.js
@@ -6,3 +6,3 @@ // This just supports loading in any enviroment | ||
* A module for creating an array based minesweeper game. | ||
* @module ArraySweeper | ||
* @module Arraysweeper | ||
*/ | ||
@@ -13,7 +13,7 @@ define( [], factory ); | ||
} else { | ||
root.ArraySweeper = factory(); | ||
root.Arraysweeper = factory(); | ||
} | ||
}( this, function() { | ||
/** | ||
* @alias module:ArraySweeper | ||
* @alias module:Arraysweeper | ||
* @param {number} height - Height of the board to create. | ||
@@ -23,3 +23,3 @@ * @param {number} width - Width of the board to create. | ||
*/ | ||
var ArraySweeper = function( height, width, count ) { | ||
var Arraysweeper = function( height, width, count ) { | ||
this.height = height; | ||
@@ -131,8 +131,12 @@ this.width = width; | ||
for ( var r = row - 1 > 0 ? row - 1 : 0; r <= row + 1; r++ ) { | ||
for ( var c = col - 1 > 0 ? col - 1 : 0; c <= col + 1; c++ ) { | ||
for ( var r = row - 1 > 0 ? row - 1 : 0; r <= row + 1 && r < this.width; r++ ) { | ||
for ( var c = col - 1 > 0 ? col - 1 : 0; c <= col + 1 && c < this.width; c++ ) { | ||
console.log( row + ":" + col + " - " + r + "," + c ); | ||
console.log( col + 1 ); | ||
if ( r >= 0 && c >= 0 && r < this.height && c < this.width && | ||
this._board[ r ][ c ].count === 0 && | ||
this._board[ r ][ c ].state !== "revealed" && | ||
!this._board[ r ][ c ].bomb && pending.indexOf( r + "," + c ) === -1 ) { | ||
!this._board[ r ][ c ].bomb && | ||
pending.indexOf( r + "," + c ) === -1 && | ||
( r !== row || c!== col ) ) { | ||
this._board[ r ][ c ].state = ""; | ||
@@ -146,4 +150,4 @@ pending.push( r + "," + c ); | ||
this._reveal( | ||
parts[ 0 ], | ||
parts[ 1 ], | ||
parseFloat( parts[ 0 ], 10 ), | ||
parseFloat( parts[ 1 ], 10 ), | ||
pending, | ||
@@ -189,7 +193,7 @@ current + 1 | ||
for ( var i = 0; i < keys.length; i++ ) { | ||
ArraySweeper.prototype[ keys[ i ] ] = arraysweeper[ keys[ i ] ]; | ||
Arraysweeper.prototype[ keys[ i ] ] = arraysweeper[ keys[ i ] ]; | ||
} | ||
return ArraySweeper; | ||
return Arraysweeper; | ||
} ) ); |
{ | ||
"name": "arraysweeper", | ||
"description": "A array based implementation of a minesweeper board. Can be used via a browserconsole or the command line via node JS. The main intended purpose of this is to provide the board, and logic to implement a traditional minesweeper game using the api.", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Alex Schmitz", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12531
251