package Minesweeper;

import game.CharBoard;
import game.Coordinate;
import game.PieceType;

public class MinesweeperBoard extends CharBoard {

	/** This character represents a bomb */
	public static final PieceType BOMB = PieceType.X;
	/** This character represents a revealed square */
	public static final PieceType OPEN = PieceType.O;

	/** This 2d array shows the user the number of bombs around each square */
	private int[][] visibleBoard;
	/**
	 * This board keeps track of the size of the board because the value is used
	 * often
	 */
	private int size;

	// The previous board tracks the revealed squares and the squares with bombs
	// on them

	public MinesweeperBoard(int size) {
		super(size);
		visibleBoard = new int[size][size];
		this.size = size;
		generateVisibleBoard();
	}

	public void generateVisibleBoard() {
		for (int j = 0; j < size; j++) {
			for (int i = 0; i < size; i++) {

				if (getBoard()[j][i] == BOMB.getChar())
					visibleBoard[j][i] = 0;
				else
					visibleBoard[j][i] = numOfSurroundingBombs(j, i);
			}
		}
	}
	
	public int numOfSurroundingBombs(int y, int x) {
		// TODO
		return 0;
	}
	// (1, 1)
	// (1, 0)
	// (1, -1)
	//
	// (0, 1)
	// (0, -1)
	// 
	// (-1, -1)
	// (-1, 0)
	// (-1, 1)


	/**
	 * This method verifies that a piece can be placed on this square. For
	 * Minesweeper, this involves checking if the square had been reveled
	 * before.
	 * 
	 * @param piece
	 *            the piece that will be checked
	 * @param c
	 *            the coordinates the piece will be checked on
	 * @return if the piece can be placed on the coordinate
	 */
	@Override
	public boolean canPlace(PieceType piece, Coordinate c) {
		return isEmpty(c);
	}

	@Override
	public char gameEnd() {
		// TODO Auto-generated method stub
		return 0;
	}

}

@@ -1090,17 +1090,16 @@
 %09%7D%0D%0A%09%7D%0D%0A
-%09
 %0D%0A%09publi
@@ -1241,17 +1241,16 @@
 -1)%0D%0A%09//
- 
 %0D%0A%09// (-
@@ -1285,18 +1285,16 @@
 , 1)%0D%0A%0D%0A
-%0D%0A
 %09/**%0D%0A%09 
@@ -1323,20 +1323,21 @@
  that a 
-piec
+squar
 e can be
@@ -1341,39 +1341,21 @@
  be 
-placed on this square. For%0D%0A%09 *
+revealed. For
  Min
@@ -1368,16 +1368,21 @@
 er, this
+%0D%0A%09 *
  involve
@@ -1422,21 +1422,16 @@
  reveled
-%0D%0A%09 *
  before.
@@ -1501,16 +1501,72 @@
  checked
+. Only an OPEN PieceType should%0D%0A%09 *            be given
 %0D%0A%09 * @p
@@ -1606,23 +1606,18 @@
 nates th
-e piece
+at
  will be
@@ -1624,19 +1624,16 @@
  checked
- on
 %0D%0A%09 * @r
@@ -1645,20 +1645,21 @@
  if the 
-piec
+squar
 e can be
@@ -1663,32 +1663,16 @@
  be 
-placed on the coordinate
+revealed
 %0D%0A%09 
@@ -1759,17 +1759,55 @@
 urn 
-isEmpty(c
+getBoard()%5Bc.getX()%5D%5Bc.getY()%5D != OPEN.getChar(
 );%0D%0A

change canPlace verification