All Packages Class Hierarchy This Package Previous Next Index
Class mori.go.Board
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----mori.go.Board
- public class Board
- extends Canvas
-
blackDead
-
-
boardSize
-
-
buffer
-
-
clickable
-
-
deadStoneString
-
-
drawCoordinates
-
-
drawDeadStones
-
-
firstMove
-
-
firstMoveMade
-
-
fixedGridSize
-
-
gridSize
-
-
handicapped
-
-
illegalMessage
-
-
initStone
-
-
ko
-
-
koMessage
-
-
lastMove
-
-
moveSequence
-
-
next
-
-
numMoves
-
-
offscreenG
-
-
redoing
-
-
stone
-
-
undoing
-
-
whiteDead
-
-
Board(int)
- Construct a board with the specified board size.
-
checkAt(Position)
- Internal use only.
-
clear()
- Clear all moves on the board.
-
drawBlackStone(Graphics, Position)
- Internal use only.
-
drawCoordinates(Graphics)
- Internal use only
-
drawDeadStones(Graphics)
- Internal use only
-
drawLastStoneMark(Graphics)
- Internal use only.
-
drawLines(Graphics)
- Internal use only
-
drawMessage(Graphics, Color)
- Internal use only
-
drawStone(Graphics, Position)
- Internal use only.
-
drawWhiteStone(Graphics, Position)
- Internal use only.
-
getMessage()
- Get the current message to be drawn
-
makeMove(Position)
- Make a move.
-
mouseDown(Event, int, int)
- mouseDown event.
-
paint(Graphics)
- Draws everything
-
pass()
- Pass a move.
-
putStone(Position, int)
- Put a stone on a board with the specified stone(B or W) and the position.
-
redoMove()
- Redo the move that was undone.
-
removeDeadStones(Position, boolean)
- Internal use only.
-
resetSequence()
- Clear the sequence of moves.
-
setClickable(boolean)
- Set the board to enable or disable to accept mouse click on it.
-
setDrawCoordinates(boolean)
- Set whether the coordinates on the board is drawn.
-
setDrawDeadStones(boolean)
- Set whether the number of captured stones below the board is drawn.
-
setFirstMove(int)
- Set the side which makes the first move.
-
setGridSize(int)
- Use this if you want to set the grid size.
-
setLanguage(String)
- Changes message strings based on the language specified.
-
setMessage(String)
- Draws the specified message below the board.
-
toString()
- Converts to a human-readable form.
-
undoMove()
- Undo the last move.
-
update(Graphics)
-
boardSize
protected int boardSize
next
protected int next
stone
protected int stone[][]
blackDead
protected int blackDead
whiteDead
protected int whiteDead
numMoves
protected int numMoves
ko
protected Position ko
lastMove
protected Position lastMove
moveSequence
protected Position moveSequence[]
handicapped
protected boolean handicapped
initStone
protected int initStone[][]
firstMove
protected int firstMove
firstMoveMade
protected boolean firstMoveMade
clickable
protected boolean clickable
fixedGridSize
protected int fixedGridSize
gridSize
protected int gridSize
drawDeadStones
protected boolean drawDeadStones
drawCoordinates
protected boolean drawCoordinates
offscreenG
protected Graphics offscreenG
buffer
protected Image buffer
undoing
protected boolean undoing
redoing
protected boolean redoing
illegalMessage
protected String illegalMessage
koMessage
protected String koMessage
deadStoneString
protected String deadStoneString
Board
public Board(int board_size)
- Construct a board with the specified board size.
mouseDown
public boolean mouseDown(Event e,
int xp,
int yp)
- mouseDown event.
Call setClickable to accept mouse click on the board.
If you, the Board user, want to know when a legal move is made
on the board, implement action method in the parent component.
- Overrides:
- mouseDown in class Component
- See Also:
- setClickable
toString
public String toString()
- Converts to a human-readable form.
This method is still under construction.
- Returns:
- the textual representation.
- Overrides:
- toString in class Component
undoMove
public void undoMove()
- Undo the last move.
redoMove
public void redoMove()
- Redo the move that was undone.
resetSequence
protected void resetSequence()
- Clear the sequence of moves.
You don't have to call this usually.
clear
public void clear()
- Clear all moves on the board.
However, move sequence is retained. That is, still redoable.
setClickable
public void setClickable(boolean b)
- Set the board to enable or disable to accept mouse click on it.
By default, it is disabled.
setDrawDeadStones
public void setDrawDeadStones(boolean b)
- Set whether the number of captured stones below the board is drawn.
By default, it is enabled.
setDrawCoordinates
public void setDrawCoordinates(boolean b)
- Set whether the coordinates on the board is drawn.
By default, it is enabled.
putStone
public void putStone(Position pos,
int stone2)
- Put a stone on a board with the specified stone(B or W) and the position.
Legality of the move is not checked.
Mainly used to put handicap stones. Don't call this after you call makeMove().
However, you can call this again after you call resetSequence()
- See Also:
- makeMove
checkAt
protected int checkAt(Position p)
- Internal use only.
removeDeadStones
protected int removeDeadStones(Position p,
boolean checkonly)
- Internal use only.
pass
public void pass()
- Pass a move.
makeMove
public boolean makeMove(Position pos)
- Make a move.
This method takes care of everything including legality check and counting dead stones.
Position can be generated with "new Position( x, y)" where 0 <= x,y < board_size-1
paint
public void paint(Graphics g)
- Draws everything
- Overrides:
- paint in class Canvas
update
public void update(Graphics g)
- Overrides:
- update in class Component
drawStone
protected void drawStone(Graphics g,
Position pos)
- Internal use only.
drawBlackStone
protected void drawBlackStone(Graphics g,
Position pos)
- Internal use only.
drawWhiteStone
protected void drawWhiteStone(Graphics g,
Position pos)
- Internal use only.
drawLastStoneMark
protected void drawLastStoneMark(Graphics g)
- Internal use only.
drawLines
protected void drawLines(Graphics g)
- Internal use only
drawCoordinates
protected void drawCoordinates(Graphics g)
- Internal use only
drawDeadStones
protected void drawDeadStones(Graphics g)
- Internal use only
drawMessage
protected void drawMessage(Graphics g,
Color col)
- Internal use only
setFirstMove
public void setFirstMove(int stone)
- Set the side which makes the first move. Default is black. Can be used for handicapped games
setGridSize
public void setGridSize(int size)
- Use this if you want to set the grid size. Otherwise, it is automatically determined based on the canvas size.
setLanguage
public void setLanguage(String lang)
- Changes message strings based on the language specified.
Currently, you can choose English(default) or Japanese.
Yes, I know this is a bad way of implementation. We should use resources in these cases.
But I can't resist this quick and dirty way...
setMessage
public void setMessage(String message)
- Draws the specified message below the board.
getMessage
public String getMessage()
- Get the current message to be drawn
All Packages Class Hierarchy This Package Previous Next Index