tesuji.games.go.computer.tactics
Class Ladder
java.lang.Object
|
+--tesuji.games.go.computer.tactics.Ladder
- All Implemented Interfaces:
- BoardChangeListener, java.util.EventListener
- public class Ladder
- extends java.lang.Object
- implements BoardChangeListener
Module for reading ladders, also called 2-liberty problems.
Creation date: (17-May-01 11:30:46 PM)
Product: Tesuji Software Go Library.
Copyright (c) 2001 Tesuji Software B.V.
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, provided that the above
copyright notice(s) and this permission notice appear in all copies of
the Software and that both the above copyright notice(s) and this
permission notice appear in supporting documentation.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of a Tesuji Software
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
of Tesuji Software.
Constructor Summary |
Ladder(int boardSize)
|
Method Summary |
void |
addGameEventListener(GameEventListener l)
Register an event listener. |
void |
changeBoard(int x,
int y,
byte value,
byte oldValue)
|
int |
getLastLadderMove()
|
int |
getNrMovesRead()
Creation date: (17-May-01 11:44:44 PM)
|
void |
removeGameEventListener(GameEventListener l)
|
static void |
testLadders(GameEventListener l)
|
int |
tryEscape(int xy)
Try to escape from a ladder with a stone or chain that has one liberty.
The values returned are CAN_CATCH if it can't escape, CANNOT_CATCH if
it can escape and CATCH_WITH_KO if there's a ko involved. |
int |
tryEscape(int x,
int y)
Try to escape from a ladder with a stone or chain that has one liberty.
The values returned are CAN_CATCH if it can't escape, CANNOT_CATCH if
it can escape and CATCH_WITH_KO if there's a ko involved. |
int |
tryLadder(int xy)
Try catching a stone in a ladder. |
int |
tryLadder(int x,
int y)
Try catching a stone in a ladder. |
int |
wouldBeLadder(int xy,
byte color)
See if a move at a certain point would be immediately
captured in a ladder. |
int |
wouldBeLadder(int x,
int y,
byte color)
See if a move at a certain point would be immediately
captured in a ladder. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CANNOT_CATCH
public static final byte CANNOT_CATCH
CAN_CATCH
public static final byte CAN_CATCH
ILLEGAL
public static final byte ILLEGAL
CATCH_WITH_KO
public static final byte CATCH_WITH_KO
Ladder
public Ladder(int boardSize)
addGameEventListener
public void addGameEventListener(GameEventListener l)
- Register an event listener. Any change of the board during
reading gets sent here which is good for debugging or for
flashing the ladders on the screen.
Creation date: (17-May-01 11:42:45 PM)
changeBoard
public void changeBoard(int x,
int y,
byte value,
byte oldValue)
- Specified by:
changeBoard
in interface BoardChangeListener
getLastLadderMove
public int getLastLadderMove()
getNrMovesRead
public int getNrMovesRead()
Creation date: (17-May-01 11:44:44 PM)
removeGameEventListener
public void removeGameEventListener(GameEventListener l)
testLadders
public static void testLadders(GameEventListener l)
tryEscape
public int tryEscape(int xy)
- Try to escape from a ladder with a stone or chain that has one liberty.
The values returned are CAN_CATCH if it can't escape, CANNOT_CATCH if
it can escape and CATCH_WITH_KO if there's a ko involved.
Creation date: (17-May-01 11:22:53 PM)
tryEscape
public int tryEscape(int x,
int y)
- Try to escape from a ladder with a stone or chain that has one liberty.
The values returned are CAN_CATCH if it can't escape, CANNOT_CATCH if
it can escape and CATCH_WITH_KO if there's a ko involved.
Creation date: (17-May-01 11:22:53 PM)
tryLadder
public int tryLadder(int xy)
- Try catching a stone in a ladder.
A ladder is defined as a chain with two liberties which can be
caught by continuously filling a liberty until the chain
can't make more than one liberty in reply. If the chain ever
makes three liberties, or two with the other player to move
it's considered to have escaped.
Possible values are CAN_CATCH, CANNOT_CATCH or CATCH_WITH_KO
Creation date: (10-May-01 3:52:14 PM)
tryLadder
public int tryLadder(int x,
int y)
- Try catching a stone in a ladder.
A ladder is defined as a chain with two liberties which can be
caught by continuously filling a liberty until the chain
can't make more than one liberty in reply. If the chain ever
makes three liberties, or two with the other player to move
it's considered to have escaped.
Possible values are CAN_CATCH, CANNOT_CATCH or CATCH_WITH_KO
Creation date: (10-May-01 3:52:14 PM)
wouldBeLadder
public int wouldBeLadder(int xy,
byte color)
- See if a move at a certain point would be immediately
captured in a ladder.
Creation date: (09-May-01 7:27:58 PM)
wouldBeLadder
public int wouldBeLadder(int x,
int y,
byte color)
- See if a move at a certain point would be immediately
captured in a ladder.
Creation date: (09-May-01 7:27:58 PM)