Function Namespace mineMap

make minesweeper map and set random mines

Function Namespace Summary
Constructor Attributes Constructor Name and Description
 
mineMap(map, x, y, mineNumber)
create new game

Method Summary

Function Namespace Detail

mineMap(map, x, y, mineNumber)
create new game
Parameters:
{jQueryObject} map
css selector to build minesweepr map in
{int} x
number of columns in the map
{int} y
number of rows in the map
{int} mineNumber
number of mines that tile contains
Returns:
{mapData} return data of map created

Field Detail

<inner> {int} correctFlag
number of flags in currect position
<inner> {int} flagCounter
number of flags player used
<inner> {boolean} IS_FINISHED
if true,clicks on the map do nothig
<inner> mineArea
number of mines around to a cell or -1 if it's a mine.
This array filled with random mines and then we count number of mines around the cells not contain mine
<inner> {int} notShownNumber
number of cells in the map

Method Detail

  • <inner> {String} buildCell(i)
    build html code of 'li' childs with the given data
    Parameters:
    {int} i
    data-cell value of span tag
    Returns:
    {String} a 'span' html code
  • <inner> {String} buildRows(i)
    build html code of 'ul' childs with the given data
    Parameters:
    {int} i
    data-row value of li tag
    Returns:
    {String} a 'li' html code
  • <inner> checkFlag()
    When player loses,this function check wich cell that player marks as flaged,are currect and wich not
    Returns:
    nothing
  • <inner> lose()
    make changes when player loses
    Returns:
    nothing
  • <inner> {String} mineCell(i, j)
    select a cell by it's html data value
    Parameters:
    {int} i
    data-cell value of span tag
    {int} j
    data-row value of li tag
    Returns:
    {String} a 'span' html code
  • <inner> win()
    make changes when player wins
    Returns:
    nothing

Event Detail

<inner> spanClick(clicked)
any changes should be take place when player click on a cell
Parameters:
{cssSelector} clicked
span that player clicked on
Returns:
nothing
<inner> spanFlag(clicked)
Flages a span if doesn't have or remove it if have!
Parameters:
{cssSelector} clicked
span that player right clicked on
Returns:
nothing