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

Variable Index

 o blackDead
 o boardSize
 o buffer
 o clickable
 o deadStoneString
 o drawCoordinates
 o drawDeadStones
 o firstMove
 o firstMoveMade
 o fixedGridSize
 o gridSize
 o handicapped
 o illegalMessage
 o initStone
 o ko
 o koMessage
 o lastMove
 o moveSequence
 o next
 o numMoves
 o offscreenG
 o redoing
 o stone
 o undoing
 o whiteDead

Constructor Index

 o Board(int)
Construct a board with the specified board size.

Method Index

 o checkAt(Position)
Internal use only.
 o clear()
Clear all moves on the board.
 o drawBlackStone(Graphics, Position)
Internal use only.
 o drawCoordinates(Graphics)
Internal use only
 o drawDeadStones(Graphics)
Internal use only
 o drawLastStoneMark(Graphics)
Internal use only.
 o drawLines(Graphics)
Internal use only
 o drawMessage(Graphics, Color)
Internal use only
 o drawStone(Graphics, Position)
Internal use only.
 o drawWhiteStone(Graphics, Position)
Internal use only.
 o getMessage()
Get the current message to be drawn
 o makeMove(Position)
Make a move.
 o mouseDown(Event, int, int)
mouseDown event.
 o paint(Graphics)
Draws everything
 o pass()
Pass a move.
 o putStone(Position, int)
Put a stone on a board with the specified stone(B or W) and the position.
 o redoMove()
Redo the move that was undone.

 o removeDeadStones(Position, boolean)
Internal use only.
 o resetSequence()
Clear the sequence of moves.
 o setClickable(boolean)
Set the board to enable or disable to accept mouse click on it.
 o setDrawCoordinates(boolean)
Set whether the coordinates on the board is drawn.
 o setDrawDeadStones(boolean)
Set whether the number of captured stones below the board is drawn.
 o setFirstMove(int)
Set the side which makes the first move.
 o setGridSize(int)
Use this if you want to set the grid size.
 o setLanguage(String)
Changes message strings based on the language specified.
 o setMessage(String)
Draws the specified message below the board.
 o toString()
Converts to a human-readable form.
 o undoMove()
Undo the last move.
 o update(Graphics)

Variables

 o boardSize
 protected int boardSize
 o next
 protected int next
 o stone
 protected int stone[][]
 o blackDead
 protected int blackDead
 o whiteDead
 protected int whiteDead
 o numMoves
 protected int numMoves
 o ko
 protected Position ko
 o lastMove
 protected Position lastMove
 o moveSequence
 protected Position moveSequence[]
 o handicapped
 protected boolean handicapped
 o initStone
 protected int initStone[][]
 o firstMove
 protected int firstMove
 o firstMoveMade
 protected boolean firstMoveMade
 o clickable
 protected boolean clickable
 o fixedGridSize
 protected int fixedGridSize
 o gridSize
 protected int gridSize
 o drawDeadStones
 protected boolean drawDeadStones
 o drawCoordinates
 protected boolean drawCoordinates
 o offscreenG
 protected Graphics offscreenG
 o buffer
 protected Image buffer
 o undoing
 protected boolean undoing
 o redoing
 protected boolean redoing
 o illegalMessage
 protected String illegalMessage
 o koMessage
 protected String koMessage
 o deadStoneString
 protected String deadStoneString

Constructors

 o Board
 public Board(int board_size)
Construct a board with the specified board size.

Methods

 o 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
 o 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
 o undoMove
 public void undoMove()
Undo the last move.

 o redoMove
 public void redoMove()
Redo the move that was undone.

 o resetSequence
 protected void resetSequence()
Clear the sequence of moves. You don't have to call this usually.

 o clear
 public void clear()
Clear all moves on the board. However, move sequence is retained. That is, still redoable.

 o setClickable
 public void setClickable(boolean b)
Set the board to enable or disable to accept mouse click on it. By default, it is disabled.

 o setDrawDeadStones
 public void setDrawDeadStones(boolean b)
Set whether the number of captured stones below the board is drawn. By default, it is enabled.

 o setDrawCoordinates
 public void setDrawCoordinates(boolean b)
Set whether the coordinates on the board is drawn. By default, it is enabled.

 o 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
 o checkAt
 protected int checkAt(Position p)
Internal use only.

 o removeDeadStones
 protected int removeDeadStones(Position p,
                                boolean checkonly)
Internal use only.

 o pass
 public void pass()
Pass a move.

 o 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

 o paint
 public void paint(Graphics g)
Draws everything

Overrides:
paint in class Canvas
 o update
 public void update(Graphics g)
Overrides:
update in class Component
 o drawStone
 protected void drawStone(Graphics g,
                          Position pos)
Internal use only.

 o drawBlackStone
 protected void drawBlackStone(Graphics g,
                               Position pos)
Internal use only.

 o drawWhiteStone
 protected void drawWhiteStone(Graphics g,
                               Position pos)
Internal use only.

 o drawLastStoneMark
 protected void drawLastStoneMark(Graphics g)
Internal use only.

 o drawLines
 protected void drawLines(Graphics g)
Internal use only

 o drawCoordinates
 protected void drawCoordinates(Graphics g)
Internal use only

 o drawDeadStones
 protected void drawDeadStones(Graphics g)
Internal use only

 o drawMessage
 protected void drawMessage(Graphics g,
                            Color col)
Internal use only

 o setFirstMove
 public void setFirstMove(int stone)
Set the side which makes the first move. Default is black. Can be used for handicapped games

 o 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.

 o 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...

 o setMessage
 public void setMessage(String message)
Draws the specified message below the board.

 o getMessage
 public String getMessage()
Get the current message to be drawn


All Packages  Class Hierarchy  This Package  Previous  Next  Index