org.moyoman.util.igo
Class IgoBase

java.lang.Object
  |
  +--org.moyoman.util.igo.IgoBase
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
GoProverbs

public class IgoBase
extends Object
implements Serializable, Cloneable

The base class for different Igo modules. This is used in modules such as IgoFuseki and IgoProverbs.

See Also:
Serialized Form

Field Summary
(package private)  int absLine
          value of the absolute lines on board.
 int actCnt
          convinent variables.
static int AKI
          Value of the empty point.
 int boardSize
          Size of the board, the value is always 19 in Moyoman.
 int[] col
          Color info of the board (AKI/KURO/SIRO/EDGE).
 VecInt comStone
          a vector to store the positions of all com's stone.
 int d1
          variables to access neighbors.
 int d11
          variables to access neighbors.
 int d111
          variables to access neighbors.
 int d117
          variables to access neighbors.
 int d118
          variables to access neighbors.
 int d17
          variables to access neighbors.
 int d18
          variables to access neighbors.
 int d2
          variables to access neighbors.
 int d22
          variables to access neighbors.
 int d222
          variables to access neighbors.
 int d225
          variables to access neighbors.
 int d226
          variables to access neighbors.
 int d25
          variables to access neighbors.
 int d26
          variables to access neighbors.
 int d3
          variables to access neighbors.
 int d33
          variables to access neighbors.
 int d333
          variables to access neighbors.
 int d336
          variables to access neighbors.
 int d338
          variables to access neighbors.
 int d36
          variables to access neighbors.
 int d38
          variables to access neighbors.
 int d4
          variables to access neighbors.
 int d44
          variables to access neighbors.
 int d444
          variables to access neighbors.
 int d445
          variables to access neighbors.
 int d447
          variables to access neighbors.
 int d45
          variables to access neighbors.
 int d47
          variables to access neighbors.
 int d5
          variables to access neighbors.
 int d55
          variables to access neighbors.
 int d555
          variables to access neighbors.
 int d6
          variables to access neighbors.
 int d66
          variables to access neighbors.
 int d666
          variables to access neighbors.
 int d7
          variables to access neighbors.
 int d77
          variables to access neighbors.
 int d777
          variables to access neighbors.
 int d8
          variables to access neighbors.
 int d88
          variables to access neighbors.
 int d888
          variables to access neighbors.
static int EDGE
          Value of the boundary line.
static int EDGE_M
          Value of the boundary line for group.
static int IRO_KEI
          Value of color exchange.
static int KURO
          Value of the black stone.
 int posLimit
          index of the active limit point.
 int posStart
          index of the first active point.
static int SIRO
          Value of the white stone.
 int sizeBlk
          convinent variables.
 int sizeHan
          convinent variables.
 int sizeP1
          convinent variables.
 int tanMe
          convinent variables.
 int tanOp
          convinent variables.
(package private)  int tenCnt
          Total count of the points.
 
Constructor Summary
IgoBase()
          Constructor
IgoBase(int size)
          Constructor
 
Method Summary
 int absYokoTate(int pos)
          Get absloute line value.
 boolean aki(int p)
          Check a point is empty or not.
 boolean aki(int p1, int p2)
          Check 2 points are all empty or not.
 boolean aki(int p1, int p2, int p3)
          Check 3 points are all empty or not.
 boolean aki(int p1, int p2, int p3, int p4)
          Check 4 points are all empty or not.
 boolean aki(int p1, int p2, int p3, int p4, int p5)
          Check 5 points are all empty or not.
 boolean aki(int p1, int p2, int p3, int p4, int p5, int p6)
          Check 6 points are all empty or not.
 boolean aki(int p1, int p2, int p3, int p4, int p5, int p6, int p7)
          Check 7 points are all empty or not.
 boolean aki4Slant4(int val, int m)
          Check the sum of the 8 neighbors is the asking value or not.
 void arrClone(Object obj)
          Clone arrays.
 int ccTable(char c1, char c2)
          Get positon from 2 chars.
 int ccTable(String str)
          Get positon from a string.
 void clearColor()
          Clear the color data.
 Object clone()
          Get clone object.
 boolean empty(int pos)
          Check a position is empty or not.
 boolean empty4(int pos)
          Check the 4 neighbors are empty or not.
 boolean empty8(int pos)
          Check the 8 neighbors are empty or not.
 int igoPos(int moX, int moY)
          Get the position of Igo from Moyoman's (X,Y) coordinate.
 void info(String msg)
          Output the info.
 boolean iro(int c, int p1, int p2)
          Check 2 points are all the asking color or not.
 boolean iro4(int val, int m)
          Check the sum of the 4 neighbors is the asking value or not.
 boolean iroSlant4(int val, int m)
          Check the sum of the 4 slant neighbors is the asking value or not.
 int moyoX(int pos)
          Get the horizontal value of Moyoman from a position of Igo.
 int moyoY(int pos)
          Get the vertical value of Moyoman from a position of Igo.
 void setBoardSize(int size)
          Set the size of board and related variables.
 void setData(VecInt kuro, VecInt siro, boolean kuroNext)
          Set the data of the board.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AKI

public static final int AKI
Value of the empty point.

See Also:
Constant Field Values

KURO

public static final int KURO
Value of the black stone.

See Also:
Constant Field Values

SIRO

public static final int SIRO
Value of the white stone.

See Also:
Constant Field Values

EDGE

public static final int EDGE
Value of the boundary line.

See Also:
Constant Field Values

EDGE_M

public static final int EDGE_M
Value of the boundary line for group.

See Also:
Constant Field Values

IRO_KEI

public static final int IRO_KEI
Value of color exchange. (color^IRO_KEI ==> KURO : SIRO)

See Also:
Constant Field Values

boardSize

public int boardSize
Size of the board, the value is always 19 in Moyoman.


col

public int[] col
Color info of the board (AKI/KURO/SIRO/EDGE).


absLine

int absLine
value of the absolute lines on board.


tenCnt

int tenCnt
Total count of the points.


posStart

public int posStart
index of the first active point.


posLimit

public int posLimit
index of the active limit point.


d1

public int d1
variables to access neighbors.


d2

public int d2
variables to access neighbors.


d3

public int d3
variables to access neighbors.


d4

public int d4
variables to access neighbors.


d5

public int d5
variables to access neighbors.


d6

public int d6
variables to access neighbors.


d7

public int d7
variables to access neighbors.


d8

public int d8
variables to access neighbors.


d11

public int d11
variables to access neighbors.


d22

public int d22
variables to access neighbors.


d33

public int d33
variables to access neighbors.


d44

public int d44
variables to access neighbors.


d17

public int d17
variables to access neighbors.


d18

public int d18
variables to access neighbors.


d25

public int d25
variables to access neighbors.


d26

public int d26
variables to access neighbors.


d36

public int d36
variables to access neighbors.


d38

public int d38
variables to access neighbors.


d45

public int d45
variables to access neighbors.


d47

public int d47
variables to access neighbors.


d55

public int d55
variables to access neighbors.


d66

public int d66
variables to access neighbors.


d77

public int d77
variables to access neighbors.


d88

public int d88
variables to access neighbors.


d111

public int d111
variables to access neighbors.


d222

public int d222
variables to access neighbors.


d333

public int d333
variables to access neighbors.


d444

public int d444
variables to access neighbors.


d117

public int d117
variables to access neighbors.


d118

public int d118
variables to access neighbors.


d225

public int d225
variables to access neighbors.


d226

public int d226
variables to access neighbors.


d336

public int d336
variables to access neighbors.


d338

public int d338
variables to access neighbors.


d445

public int d445
variables to access neighbors.


d447

public int d447
variables to access neighbors.


d555

public int d555
variables to access neighbors.


d666

public int d666
variables to access neighbors.


d777

public int d777
variables to access neighbors.


d888

public int d888
variables to access neighbors.


sizeP1

public int sizeP1
convinent variables.


sizeHan

public int sizeHan
convinent variables.


sizeBlk

public int sizeBlk
convinent variables.


actCnt

public int actCnt
convinent variables.


tanOp

public int tanOp
convinent variables.


tanMe

public int tanMe
convinent variables.


comStone

public VecInt comStone
a vector to store the positions of all com's stone.

Constructor Detail

IgoBase

public IgoBase()
Constructor


IgoBase

public IgoBase(int size)
Constructor

Parameters:
size - Size of the board.
Method Detail

clone

public Object clone()
Get clone object.

Overrides:
clone in class Object
Returns:
a IgoBase object of clone.

arrClone

public void arrClone(Object obj)
Clone arrays.


setBoardSize

public void setBoardSize(int size)
Set the size of board and related variables.

Parameters:
size - The size of the Board.

empty

public boolean empty(int pos)
Check a position is empty or not.

Parameters:
pos - Index of the position.
Returns:
true if the position is empty.

empty4

public boolean empty4(int pos)
Check the 4 neighbors are empty or not.

Parameters:
pos - Index of the position.
Returns:
true if the 4 neighbors are empty.

empty8

public boolean empty8(int pos)
Check the 8 neighbors are empty or not.

Parameters:
pos - Index of the Position.
Returns:
true if the 8 neighbors are empty.

moyoX

public int moyoX(int pos)
Get the horizontal value of Moyoman from a position of Igo.

Parameters:
pos - Index of the position.
Returns:
the horizontal value from a position of Igo.

moyoY

public int moyoY(int pos)
Get the vertical value of Moyoman from a position of Igo.

Parameters:
pos - Position of Igo.
Returns:
the vertical value from a position of Igo.

igoPos

public int igoPos(int moX,
                  int moY)
Get the position of Igo from Moyoman's (X,Y) coordinate.

Parameters:
moX - horizontal value of the Moyoman.
moY - vertical value of the Moyoman.
Returns:
the position of Igo from Moyoman's coordinate.

clearColor

public void clearColor()
Clear the color data.


aki

public boolean aki(int p)
Check a point is empty or not.

Returns:
true if the point is empty.

aki

public boolean aki(int p1,
                   int p2)
Check 2 points are all empty or not.

Parameters:
p1 - Position of the point 1.
p2 - Position of the point 2.
Returns:
true if the 2 points are empty.

aki

public boolean aki(int p1,
                   int p2,
                   int p3)
Check 3 points are all empty or not.

Parameters:
p1 - Position of the point 1.
p2 - Position of the point 2.
p3 - Position of the point 3.
Returns:
true if the 3 points are empty.

aki

public boolean aki(int p1,
                   int p2,
                   int p3,
                   int p4)
Check 4 points are all empty or not.

Parameters:
p1 - Position of the point 1.
p2 - Position of the point 2.
p3 - Position of the point 3.
p4 - Position of the point 4.
Returns:
true if the 4 points are empty.

aki

public boolean aki(int p1,
                   int p2,
                   int p3,
                   int p4,
                   int p5)
Check 5 points are all empty or not.

Parameters:
p1 - Position of the point 1.
p2 - Position of the point 2.
p3 - Position of the point 3.
p4 - Position of the point 4.
p5 - Position of the point 5.
Returns:
true if the 5 points are empty.

aki

public boolean aki(int p1,
                   int p2,
                   int p3,
                   int p4,
                   int p5,
                   int p6)
Check 6 points are all empty or not.

Parameters:
p1 - Position of the point 1.
p2 - Position of the point 2.
p3 - Position of the point 3.
p4 - Position of the point 4.
p5 - Position of the point 5.
p6 - Position of the point 6.
Returns:
true if the 6 points are empty.

aki

public boolean aki(int p1,
                   int p2,
                   int p3,
                   int p4,
                   int p5,
                   int p6,
                   int p7)
Check 7 points are all empty or not.

Parameters:
p1 - Position of the point 1.
p2 - Position of the point 2.
p3 - Position of the point 3.
p4 - Position of the point 4.
p5 - Position of the point 5.
p6 - Position of the point 6.
p7 - Position of the point 7.
Returns:
true if the 7 points are empty.

iro

public boolean iro(int c,
                   int p1,
                   int p2)
Check 2 points are all the asking color or not.

Parameters:
c - The asking Color.
p1 - Position of the point 1.
p2 - Position of the point 2.
Returns:
true if the 2 points are the asking color.

iro4

public boolean iro4(int val,
                    int m)
Check the sum of the 4 neighbors is the asking value or not.

Parameters:
val - The asking value.
m - The target position.
Returns:
true if the sum of the 4 neighbors is the asking value.

iroSlant4

public boolean iroSlant4(int val,
                         int m)
Check the sum of the 4 slant neighbors is the asking value or not.

Parameters:
val - The asking value.
m - The target position.
Returns:
true if the sum of the 4 slant neighbors is the asking value.

aki4Slant4

public boolean aki4Slant4(int val,
                          int m)
Check the sum of the 8 neighbors is the asking value or not.

Parameters:
val - The asking value.
m - The target position.
Returns:
true if the sum of the 8 neighbors is the asking value.

setData

public void setData(VecInt kuro,
                    VecInt siro,
                    boolean kuroNext)
Set the data of the board.

Parameters:
kuro - Array of black stone.
siro - Array of white stone.
kuroNext - True if next turn is for black.

ccTable

public int ccTable(char c1,
                   char c2)
Get positon from 2 chars.

Parameters:
c1 - The char data of horizontal.
c2 - The char data of vertical.
Returns:
a positon from 2 chars.

ccTable

public int ccTable(String str)
Get positon from a string.

Parameters:
str - The string data of the position
Returns:
a positon from a string.

absYokoTate

public int absYokoTate(int pos)
Get absloute line value.

Parameters:
pos - Position of the board.
Returns:
the absloute line value.

info

public void info(String msg)
Output the info.