Here are the most important classes, fields and methods in the Minesweeper API. For more details, read the Javadoc and/or look at the source code.
All fields and methods are public unless noted otherwise.
enum
ETile { MINE, FREE, UNKNOWN; }
class
Tile
boolean
visible;
ETile type;
//
if visible, type is MINE or FREE; if not visible, type is UNKNOWN
Integer mines;
//
number of surrounding mines; null if tile is not visible
boolean
flag;
// true if flagged
by player
class
Board
int
width;
int
height;
Tile[][]
tiles; // indexed as tiles[x][y]
int
totalMines; // total number of mines (visible + invisible) on the board
class
Action
class
ArtificialAgentActions
Action open(
int
tileX,
int
tileY)
Return an Action that uncovers the tile at (tileX, tileY). If this tile is a mine, your game is over!
Action flag(
int
tileX,
int
tileY)
Return an Action that marks the tile at (tileX, tileY) as a known mine.
Action advice()
Return an Action
that asks for a hint.
abstract
class
ArtificialAgent
Implement your agent as a subclass of this class.
protected ArtificialAgentActions actions;
protected abstract Action
thinkImpl(Board board, Board previousBoard)
The framework calls this method to
ask for your next action.
On each call, board
is the current board state and previousBoard
is the
board state from the previous call to this method. You can compare
board
and previousBoard
to determine the
new information that is available (e.g. as a consequence of opening
a square on your previous turn).