Back to project page Android-Minesweeper.
The source code is released under:
MIT License
If you think the Android project Android-Minesweeper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jigglesoft.minesweeper.game.board; //from w ww .jav a 2s.c om import com.jigglesoft.minesweeper.game.board.Flags.Flag; public class Cell { private boolean revaled = false; private Flag flag = Flag.NONE; private Cell[] neighbors = {}; public void setNeighbors(Cell[] neighbors) { this.neighbors = neighbors; } public Cell[] getNeighbors() { return neighbors; } public int noOfNeighborIsBomb() { int noOfNeighborBombs = 0; for (Cell neighbor : neighbors) { if (neighbor.isBomb()) noOfNeighborBombs++; } return noOfNeighborBombs; } public boolean hasBombNeighbor() { return noOfNeighborIsBomb() > 0; } public void revealCell() { revaled = true; } public boolean isRevealed() { return revaled; } public boolean isBomb() { return false; } public void setFlag(Flag flag) { this.flag = flag; } public Flag getFlag() { return flag; } public boolean hasWarningFlag() { return flag == Flag.WARNING; } }