diff --git a/AlbertMineSweeper.script.js b/AlbertMineSweeper.script.js index 3877826..7803b47 100644 --- a/AlbertMineSweeper.script.js +++ b/AlbertMineSweeper.script.js @@ -37,10 +37,16 @@ function Grid(numRow, numCol, numMines) { this.cells = []; for(var i = 0; i < this.numRow; i++) { this.cells[i] = []; + $(".base").append("
"); for(var j = 0; j < this.numCol; j++) { this.cells[i][j] = new Cell(); + $("#row"+i.toString()).append("
"); } - } + } + // Adjust Dimensions of Base + var edgeThickness = 2 * (parseInt($(".cell").css("border-left-width")) + parseInt($(".cell").css("margin")) + parseInt($(".cell").css("padding"))); + $(".base").height(numRow * ($(".cell").height() + edgeThickness) + 10); + $(".base").width(numCol * ($(".cell").width() + edgeThickness) + 10); // Seed mines randomly in grid, adds them to minedCells[] and calculate each cell's risk for(var c = 0; c < numMines; c++) { diff --git a/ams_board.css b/ams_board.css index 1eaa956..a1dfc88 100644 --- a/ams_board.css +++ b/ams_board.css @@ -4,9 +4,6 @@ div { .base { background-color: gray; - height: 410px; - width: 410px; - /*for a 15*15 grid.*/ } .cell { diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..22e6353 --- /dev/null +++ b/bower.json @@ -0,0 +1,27 @@ +{ + "name": "AlbertMineSweeper", + "version": "0.0.0", + "homepage": "https://github.com/albertliangcode/AlbertMineSweeper", + "authors": [ + "albertliangcode " + ], + "moduleType": [ + "amd", + "es6", + "globals", + "node", + "yui" + ], + "license": "MIT", + "private": true, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "jquery": "~2.1.3" + } +} diff --git a/index.html b/index.html index 10628ed..6acaca4 100644 --- a/index.html +++ b/index.html @@ -11,14 +11,15 @@

Albert Mine Sweeper

Project Status:

    -
  • Current: End Conditions
  • -
  • Next: Adjustable Game
  • +
  • Current: Adjustable GameBoard
  • Next: User Interface for:
    1. Resetting Game
    2. Adjusting Game Settings
  • +
  • Next: No First-Click Deaths
  • +
  • Next: End Conditions (UI Freeze)
  • Next: Clock
  • Next: Scoreboard?
  • Next: Match Graphics to MS Minesweeper?
  • @@ -32,45 +33,15 @@

    Project Status:

+ + +
+ Rows:
+ Columns:
+ Mines:

+


+
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ui.js b/ui.js index 27cd7d4..ed6dc12 100644 --- a/ui.js +++ b/ui.js @@ -25,11 +25,15 @@ var stopGame = function () { $(document).ready(function() { - //Must bind contextmenu event handler to each cell - //document.oncontextmenu = function() {return false;}; - var grid = new Grid(5,5,2); - var report = grid.print(); - + var grid; + var report; + $('#gridSetup').submit(function(){ + var $values = $('#gridSetup').serializeArray(); + grid = new Grid(parseInt($values[0].value),parseInt($values[1].value),parseInt($values[2].value)); + // var grid = new Grid(7,7,5); + report = grid.print(); + }); // <<>> + $('.cell').mousedown(function(event) { var row = $(this).data('row'); var col = $(this).data('col');