|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectlib.shogi.KomaUtil
public class KomaUtil
駒関連のユーティリティーメソッド及び定数を提供するクラス。
フィールドの概要 | |
---|---|
static int |
GIN
銀。 |
static int |
GOTE
下から6bit目は"先手"・"後手"を表す。 |
static int |
HISYA
飛車。 |
static int |
HU
歩。 |
static int |
KAKU
角。 |
static int |
KEI
桂馬。 |
static int |
KIN
金。 |
static int |
KYOU
香車。 |
static int |
NARI
下から5bit目は"成"・"不成"を表す。 |
static int |
OU
王。 |
コンストラクタの概要 | |
---|---|
KomaUtil()
|
メソッドの概要 | |
---|---|
static int |
getArchetype(int komaInfo)
引数で指定した駒の原型(成る前の型)を返す。 |
static int[][] |
getDirectMovablePositionArray(int komaInfo)
引数で指定した駒が直接移動できる位置の相対座標の配列を返す。 |
static int |
getType(int komaInfo)
引数で指定した駒の型(成り・不成も含む)を返す。 |
static boolean |
isSente(int komaInfo)
引数で示した駒が、先手の駒か後手の駒かを返す。 |
static java.lang.String |
toString(int komaInfo)
駒を表すint値を、長さ2の文字列に変換する。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
public static final int HU
public static final int KYOU
public static final int KEI
public static final int GIN
public static final int KIN
public static final int KAKU
public static final int HISYA
public static final int OU
public static final int NARI
public static final int GOTE
コンストラクタの詳細 |
---|
public KomaUtil()
メソッドの詳細 |
---|
public static boolean isSente(int komaInfo)
komaInfo
- 駒情報。
public static int getArchetype(int komaInfo)
komaInfo
- この駒の原型を返す。
public static int getType(int komaInfo)
komaInfo
- この駒の型を返す。
public static int[][] getDirectMovablePositionArray(int komaInfo)
HU
なら返り値は{{0,-1}}
(一路先のマス)、
KEI | GOTE
なら返り値は{{-1,2},{1,2}}
(後手から見て二路先の一つ左右の筋)である。
komaInfo
- 駒の型情報。
public static java.lang.String toString(int komaInfo)
komaInfo
- 文字列に変換したい駒の情報。
|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |