tesuji.games.go
Class GoArray

java.lang.Object
  |
  +--tesuji.games.go.GoArray

public class GoArray
extends java.lang.Object

This class defines arrays used for a Go-board. All coordinates are coded such that x,y translates to x+y*20. There are methods to create and clear arrays of the appropriate size and a lot of utility methods to manipulate coordinates.

Creation date: (17-May-01 3:07:20 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.


Field Summary
static int FIRST
           
static int ILLEGAL_VALUE
           
static int LAST
           
static int MAX
           
static int WIDTH
           
 
Constructor Summary
GoArray()
           
 
Method Summary
static int above(int xy)
          Return the coordinate one point above the coordinate passed as a parameter.
static int below(int xy)
          Return the coordinate one point below the coordinate passed as a parameter.
static void checkRange(int xy)
           
static void clear(byte[] array)
           
static void clear(int[] array)
           
static void clear(long[] array)
           
static void clear(java.lang.Object[] array)
           
static void clear(short[] array)
           
static void copy(byte[] src, byte[] dest)
           
static void copy(int[] src, int[] dest)
           
static void copy(long[] src, long[] dest)
           
static void copy(java.lang.Object[] src, java.lang.Object[] dest)
           
static void copy(short[] src, short[] dest)
           
static byte[] createBytes()
           
static int[] createIntegers()
           
static long[] createLongs()
           
static java.lang.Object[] createObjects()
           
static short[] createShorts()
           
static byte[] getBoardArray(int size)
          This method creates an array for a Go board of a given size with an edge around the board-points.
static byte[] getRowArray(int size)
          This method creates an array for a Go board of a given size with at each point the distance to the edge of the board.
static int getX(int xy)
           
static int getY(int xy)
           
static boolean isNeighbour(int xy1, int xy2)
          

Creation date: (07-May-01 2:36:04 PM)

static int left(int xy)
          Return the coordinate one point to the left of the coordinate passed as a parameter.
static void link(byte value, int startXY, byte[] board, byte[] numbers)
           
static void link(int value, int startXY, byte[] board, int[] numbers)
           
static void link(java.lang.Object value, int startXY, byte[] board, java.lang.Object[] objects)
           
static void recycleByteArray(byte[] array)
           
static void recycleIntArray(int[] array)
           
static int right(int xy)
          Return the coordinate one point to the rigth of the coordinate passed as a parameter.
static int toXY(int x, int y)
          Convert a 2-dimensional coordinate to a 1 dimensional coordinate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIDTH

public static final int WIDTH

FIRST

public static final int FIRST

MAX

public static final int MAX

LAST

public static final int LAST

ILLEGAL_VALUE

public static final int ILLEGAL_VALUE
Constructor Detail

GoArray

public GoArray()
Method Detail

clear

public static final void clear(byte[] array)

clear

public static final void clear(short[] array)

clear

public static final void clear(int[] array)

clear

public static final void clear(long[] array)

clear

public static final void clear(java.lang.Object[] array)

copy

public static final void copy(byte[] src,
                              byte[] dest)

copy

public static final void copy(short[] src,
                              short[] dest)

copy

public static final void copy(int[] src,
                              int[] dest)

copy

public static final void copy(long[] src,
                              long[] dest)

copy

public static final void copy(java.lang.Object[] src,
                              java.lang.Object[] dest)

createBytes

public static final byte[] createBytes()

createShorts

public static final short[] createShorts()

createIntegers

public static final int[] createIntegers()

createLongs

public static final long[] createLongs()

createObjects

public static final java.lang.Object[] createObjects()

link

public static final void link(int value,
                              int startXY,
                              byte[] board,
                              int[] numbers)

link

public static final void link(byte value,
                              int startXY,
                              byte[] board,
                              byte[] numbers)

link

public static final void link(java.lang.Object value,
                              int startXY,
                              byte[] board,
                              java.lang.Object[] objects)

above

public static final int above(int xy)
Return the coordinate one point above the coordinate passed as a parameter.

Creation date: (17-May-01 3:14:46 PM)


below

public static final int below(int xy)
Return the coordinate one point below the coordinate passed as a parameter.

Creation date: (17-May-01 3:14:46 PM)


checkRange

public static final void checkRange(int xy)

getBoardArray

public static final byte[] getBoardArray(int size)
This method creates an array for a Go board of a given size with an edge around the board-points. The size of the array is always the same, but the points not used are marked with the value GoConst.SIDE.

Creation date: (17-May-01 11:53:42 AM)


getRowArray

public static final byte[] getRowArray(int size)
This method creates an array for a Go board of a given size with at each point the distance to the edge of the board. Any point that is not on the board gets a value 0.

Very sneakily, the board-size is stored in the last element of the array, so be careful...

This is basically an array with static data that is very handy. To minimize memory use, the array is reused for each board-size so make sure the array never gets used to store other data.

Creation date: (17-May-01 11:53:42 AM)


getX

public static final int getX(int xy)

getY

public static final int getY(int xy)

isNeighbour

public static final boolean isNeighbour(int xy1,
                                        int xy2)


Creation date: (07-May-01 2:36:04 PM)


left

public static final int left(int xy)
Return the coordinate one point to the left of the coordinate passed as a parameter.

Creation date: (17-May-01 3:14:46 PM)


right

public static final int right(int xy)
Return the coordinate one point to the rigth of the coordinate passed as a parameter.

Creation date: (17-May-01 3:14:46 PM)


toXY

public static final int toXY(int x,
                             int y)
Convert a 2-dimensional coordinate to a 1 dimensional coordinate.

Creation date: (17-May-01 3:16:26 PM)


recycleByteArray

public static final void recycleByteArray(byte[] array)

recycleIntArray

public static final void recycleIntArray(int[] array)