Documentation ¶
Overview ¶
利きのテスト
駒の価値
Index ¶
- Constants
- Variables
- func AddControlBishop(pPos *Position, pPh1_CB *ControlBoard, pPh2_CB *ControlBoard, sign int16, ...)
- func AddControlLance(pPos *Position, pPh1_CB *ControlBoard, pPh2_CB *ControlBoard, sign int16, ...)
- func AddControlRook(pPos *Position, pPh1_CB *ControlBoard, pPh2_CB *ControlBoard, sign int16, ...)
- func CountAllPieces(pPos *Position) [8]int
- func CountErrorCountLists(countList1 [8]int, countList2 [8]int) int
- func FlipPhase(phase l03.Phase) l03.Phase
- func GenMoveList(pBrain *Brain, pPos *Position) []l03.Move
- func MainLoop()
- func MoveEndListToControlList(moveEndList []MoveEnd) []l03.Square
- func NifuFirst(pPos *Position, file l03.Square) bool
- func NifuSecond(pPos *Position, file l03.Square) bool
- func OnBoard(sq l03.Square) bool
- func OnHands(sq l03.Square) bool
- func Search(pBrain *Brain) l03.Move
- func ShowAllPiecesCount(pPos *Position)
- func ShuffleBoard(pBrain *Brain, pPos *Position)
- func SprintBoard(pPos *Position, phase l03.Phase, startMovesNum int, offsetMovesIndex int, ...) string
- func SquareFrom(file l03.Square, rank l03.Square) l03.Square
- func SumAbsControl(pBrain *Brain, ph1_c ControlLayerT, ph2_c ControlLayerT) [2]int
- func TestControl(pBrain *Brain, pPos *Position) (bool, string)
- func ValidateSq(sq l03.Square)
- func ValidateThereArePieceIn(pPos *Position, sq l03.Square)
- func WaterColor(pCB1 *ControlBoard, pCB2 *ControlBoard, pCB3 *ControlBoard, pCB4 *ControlBoard, ...)
- type Brain
- type BuildT
- type ControlBoard
- type ControlBoardSystem
- func (pCtrlBrdSys *ControlBoardSystem) ClearControlDiff(buildType BuildT)
- func (pCtrlBrdSys *ControlBoardSystem) ClearControlLayer1(ph1_c ControlLayerT, ph2_c ControlLayerT)
- func (pCtrlBrdSys *ControlBoardSystem) DiffControl(c1 ControlLayerT, c2 ControlLayerT, c3 ControlLayerT)
- func (pCtrlBrdSys *ControlBoardSystem) MergeControlDiff(buildType BuildT)
- func (pCtrlBrdSys *ControlBoardSystem) RecalculateControl(pPos *Position, ph1_c1 ControlLayerT, ph2_c1 ControlLayerT)
- func (pCtrlBrdSys *ControlBoardSystem) SprintControl(c ControlLayerT) string
- type ControlLayerT
- type CuttingType
- type DifferenceRecord
- type MoveEnd
- type PosLayerT
- type Position
- func (pPos *Position) ClearBoard()
- func (pPos *Position) GetLocationOfLongPiece(index int) l03.Square
- func (pPos *Position) GetPieceAtIndex(idx int) l03.Piece
- func (pPos *Position) GetPieceLocation(index int) l03.Square
- func (pPos *Position) GetPieceOnBoardAtSq(sq l03.Square) l03.Piece
- func (pPos *Position) Hetero(from l03.Square, to l03.Square) bool
- func (pPos *Position) Homo(from l03.Square, to l03.Square) bool
- func (pPos *Position) IsEmptySq(sq l03.Square) bool
- func (pPos *Position) SetToStartpos()
- func (pPos *Position) SprintBoard() string
- func (pPos *Position) SprintBoardHeader(phase l03.Phase, startMovesNum int, offsetMovesIndex int) string
- type PositionSystem
- func (pPosSys *PositionSystem) FlipPhase()
- func (pPosSys *PositionSystem) GetPhase() l03.Phase
- func (pPosSys *PositionSystem) SprintDiff(b1 PosLayerT, b2 PosLayerT) string
- func (pPosSys *PositionSystem) SprintRecord() string
- func (pPosSys *PositionSystem) SprintSfenResignation(pPos *Position) string
- type Value
Constants ¶
const ( // 先手用 CONTROL_LAYER_SUM1 = ControlLayerT(0) // 先手の利きボード CONTROL_LAYER_DIFF1_ROOK_OFF = ControlLayerT(1) // 飛の利き 負(差分) CONTROL_LAYER_DIFF1_BISHOP_OFF = ControlLayerT(2) // 角の利き 負(差分) CONTROL_LAYER_DIFF1_LANCE_OFF = ControlLayerT(3) // 香の利き 負(差分) CONTROL_LAYER_DIFF1_LANCE_ON = ControlLayerT(4) // 香の利き 正(差分) CONTROL_LAYER_DIFF1_BISHOP_ON = ControlLayerT(5) // 角の利き 正(差分) CONTROL_LAYER_DIFF1_ROOK_ON = ControlLayerT(6) // 飛の利き 正(差分) // 先手用/開発時のみ CONTROL_LAYER_DIFF1_PUT = ControlLayerT(7) // 打とか指すとか CONTROL_LAYER_DIFF1_REMOVE = ControlLayerT(8) CONTROL_LAYER_DIFF1_CAPTURED = ControlLayerT(9) // 後手用 CONTROL_LAYER_SUM2 = ControlLayerT(10) // 後手の利きボード CONTROL_LAYER_DIFF2_ROOK_OFF = ControlLayerT(11) CONTROL_LAYER_DIFF2_BISHOP_OFF = ControlLayerT(12) CONTROL_LAYER_DIFF2_LANCE_OFF = ControlLayerT(13) CONTROL_LAYER_DIFF2_LANCE_ON = ControlLayerT(14) CONTROL_LAYER_DIFF2_BISHOP_ON = ControlLayerT(15) CONTROL_LAYER_DIFF2_ROOK_ON = ControlLayerT(16) // 後手用/開発時のみ CONTROL_LAYER_DIFF2_PUT = ControlLayerT(17) // 打とか指すとか CONTROL_LAYER_DIFF2_REMOVE = ControlLayerT(18) CONTROL_LAYER_DIFF2_CAPTURED = ControlLayerT(19) // テスト(先手用) CONTROL_LAYER_TEST_COPY1 = ControlLayerT(20) // テスト用 CONTROL_LAYER_TEST_ERROR1 = ControlLayerT(21) // テスト用 CONTROL_LAYER_TEST_RECALCULATION1 = ControlLayerT(22) // テスト用 再計算 // テスト(後手用) CONTROL_LAYER_TEST_COPY2 = ControlLayerT(23) CONTROL_LAYER_TEST_ERROR2 = ControlLayerT(24) CONTROL_LAYER_TEST_RECALCULATION2 = ControlLayerT(25) // 評価値用 CONTROL_LAYER_EVAL1 = ControlLayerT(26) // 評価関数用 CONTROL_LAYER_EVAL2 = ControlLayerT(27) // 評価関数用 CONTROL_LAYER_EVAL3 = ControlLayerT(28) // 評価関数用 // 計測 CONTROL_LAYER_DIFF_TYPE_SIZE_RELEASE = ControlLayerT(6) CONTROL_LAYER_DIFF_TYPE_SIZE_DEV = ControlLayerT(9) CONTROL_LAYER_DIFF1_START = ControlLayerT(1) CONTROL_LAYER_DIFF1_END_RELEASE = CONTROL_LAYER_DIFF1_START + CONTROL_LAYER_DIFF_TYPE_SIZE_RELEASE // この数を含まない。テスト用も含まない CONTROL_LAYER_DIFF1_END_DEV = CONTROL_LAYER_DIFF1_START + CONTROL_LAYER_DIFF_TYPE_SIZE_DEV // この数を含まない。テスト用も含まない CONTROL_LAYER_DIFF2_START = ControlLayerT(11) CONTROL_LAYER_DIFF2_END_RELEASE = CONTROL_LAYER_DIFF2_START + CONTROL_LAYER_DIFF_TYPE_SIZE_RELEASE // この数を含まない。テスト用も含まない CONTROL_LAYER_DIFF2_END_DEV = CONTROL_LAYER_DIFF2_START + CONTROL_LAYER_DIFF_TYPE_SIZE_DEV // この数を含まない。テスト用も含まない CONTROL_LAYER_ALL_SIZE = ControlLayerT(29) // この数を含まない )
const ( POS_LAYER_MAIN = PosLayerT(0) POS_LAYER_COPY = PosLayerT(1) // テスト用 POS_LAYER_DIFF1 = PosLayerT(2) // テスト用 POS_LAYER_DIFF2 = PosLayerT(3) // テスト用 POS_LAYER_SIZE = 4 )
const ( BUILD_DEV = BuildT(0) BUILD_RELEASE = BuildT(1) )
const ( CuttingNone = CuttingType(0) // 玉を取った CuttingKingCapture = CuttingType(1) )
const ANTI_RESIGN_VALUE = Value(2_147_483_647) // Value(32767)
const PHASE_ARRAY_SIZE = 2
[0], [1]
const RESIGN_MOVE_END = MoveEnd(0)
0 は 投了ということにするぜ(^~^)
const RESIGN_VALUE = Value(-2_147_483_647) // Value(-32767)
Variables ¶
var App l01.Lesson01App
App - アプリケーション変数の宣言
var OneDigitNumbers = [10]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
position sfen の盤のスペース数に使われますN
Functions ¶
func AddControlBishop ¶
func AddControlBishop(pPos *Position, pPh1_CB *ControlBoard, pPh2_CB *ControlBoard, sign int16, excludeFrom l03.Square)
AddControlBishop - 長い利きの駒の利きを調べて、利きの差分テーブルの値を増減させます
func AddControlLance ¶
func AddControlLance(pPos *Position, pPh1_CB *ControlBoard, pPh2_CB *ControlBoard, sign int16, excludeFrom l03.Square)
AddControlLance - 長い利きの駒の利きを調べて、利きの差分テーブルの値を増減させます
func AddControlRook ¶
func AddControlRook(pPos *Position, pPh1_CB *ControlBoard, pPh2_CB *ControlBoard, sign int16, excludeFrom l03.Square)
AddControlRook - 長い利きの駒の利きを調べて、利きの差分テーブルの値を増減させます
func CountErrorCountLists ¶
CountErrorCountLists - 数えた駒の枚数を比較します
func GenMoveList ¶
GenMoveList - 現局面の指し手のリスト。合法手とは限らないし、全ての合法手を含むとも限らないぜ(^~^)
func MoveEndListToControlList ¶
MoveEndListToControlList - 移動先、成りのリストを、移動先のリストに変換します
func ShuffleBoard ¶
ShuffleBoard - 盤上の駒、持ち駒をシャッフルします ゲーム中にはできない動きをするので、利きの計算は無視します。 最後に利きは再計算します
func SprintBoard ¶
func SprintBoard(pPos *Position, phase l03.Phase, startMovesNum int, offsetMovesIndex int, moves_text string) string
Print - 局面出力(^q^)
func SquareFrom ¶
From - 筋と段からマス番号を作成します
func SumAbsControl ¶
func SumAbsControl(pBrain *Brain, ph1_c ControlLayerT, ph2_c ControlLayerT) [2]int
SumAbsControl - 利きテーブルの各マスを絶対値にし、その総和を返します
func ValidateThereArePieceIn ¶
func WaterColor ¶
func WaterColor(pCB1 *ControlBoard, pCB2 *ControlBoard, pCB3 *ControlBoard, pCB4 *ControlBoard, pCB5 *ControlBoard)
WaterColor - 水で薄めたような評価値にします pCB3 = 0 pCB4 = 0 pCB5 = 0 pCB1 - pCB2 = pCB3 pCB3 - pCB4 = pCB5
Types ¶
type Brain ¶
type Brain struct { // 局面システム PPosSys *PositionSystem // 利きボード・システム PCtrlBrdSys *ControlBoardSystem }
Brain - 局面システムと、利き盤システムの2つを持つもの
func (*Brain) IsCheckmate ¶
長い利きの駒から王手を受けていないかチェック(^~^)
func (*Brain) ReadPosition ¶
ReadPosition - 局面を読み取ります。マルチバイト文字は含まれていないぜ(^q^)
type ControlBoard ¶
type ControlBoard struct { // 表示用の名前 Title string // マスへの利き数、または差分、さらには評価値が入っています Board1 [l03.BOARD_SIZE]int16 }
ControlBoard - 利きボード
func ControllBoardFromPhase ¶
func ControllBoardFromPhase( phase l03.Phase, pPh1_CB *ControlBoard, pPh2_CB *ControlBoard) *ControlBoard
func (*ControlBoard) AddControl ¶
AddControl - 盤上のマスを指定することで、そこにある駒の利きを調べて、利きの差分テーブルの値を増減させます
type ControlBoardSystem ¶
type ControlBoardSystem struct { // マスへの利き数、または差分が入っています。デバッグ目的で無駄に分けてるんだけどな(^~^) PBoards [CONTROL_LAYER_ALL_SIZE]*ControlBoard }
ControlBoardSystem - 利きボード・システム TODO 自玉が王手されてるか調べてほしい(^~^)
func NewControlBoardSystem ¶
func NewControlBoardSystem() *ControlBoardSystem
func (*ControlBoardSystem) ClearControlDiff ¶
func (pCtrlBrdSys *ControlBoardSystem) ClearControlDiff(buildType BuildT)
ClearControlDiff - 利きの差分テーブルをクリアーするぜ(^~^)
func (*ControlBoardSystem) ClearControlLayer1 ¶
func (pCtrlBrdSys *ControlBoardSystem) ClearControlLayer1(ph1_c ControlLayerT, ph2_c ControlLayerT)
ClearControlLayer - 利きボードのクリアー
func (*ControlBoardSystem) DiffControl ¶
func (pCtrlBrdSys *ControlBoardSystem) DiffControl(c1 ControlLayerT, c2 ControlLayerT, c3 ControlLayerT)
DiffControl - 利きテーブルの差分計算
func (*ControlBoardSystem) MergeControlDiff ¶
func (pCtrlBrdSys *ControlBoardSystem) MergeControlDiff(buildType BuildT)
MergeControlDiff - 利きの差分を解消するぜ(^~^)
func (*ControlBoardSystem) RecalculateControl ¶
func (pCtrlBrdSys *ControlBoardSystem) RecalculateControl( pPos *Position, ph1_c1 ControlLayerT, ph2_c1 ControlLayerT)
RecalculateControl - 利きの再計算
func (*ControlBoardSystem) SprintControl ¶
func (pCtrlBrdSys *ControlBoardSystem) SprintControl(c ControlLayerT) string
SprintControl - 利き数ボード出力(^q^)
Parameters ---------- * `c` - 利き数ボードのレイヤー番号(^~^)
type CuttingType ¶
type CuttingType int
type DifferenceRecord ¶
type DifferenceRecord struct { // 開始局面の時点で何手目か(^~^)これは表示のための飾りのようなものだぜ(^~^) StartMovesNum int // 開始局面から数えて何手目か(^~^)0から始まるぜ(^~^) OffsetMovesIndex int // 指し手のリスト(^~^) // 1手目は[0]へ、512手目は[511]へ入れろだぜ(^~^) Moves [l02.MOVES_SIZE]l03.Move // 取った駒のリスト(^~^)アンドゥ ムーブするときに使うだけ(^~^)指し手のリストと同じ添え字を使うぜ(^~^) CapturedList [l02.MOVES_SIZE]l03.Piece }
差分での連続局面記録。つまり、ふつうの棋譜(^~^)
func NewDifferenceRecord ¶
func NewDifferenceRecord() *DifferenceRecord
func (*DifferenceRecord) ResetDifferenceRecord ¶
func (pRecord *DifferenceRecord) ResetDifferenceRecord()
type MoveEnd ¶
type MoveEnd uint8
MoveEnd - 移動先と成り
pddd dddd
1~7bit: 移動先(0~127) 8bit: 成(0~1)
func GenMoveEnd ¶
GenMoveEnd - 利いているマスの一覧を返します。動けるマスではありません。 成らないと移動できないが、成れば移動できるマスがあるので、移動先と成りの2つセットで返します。
func NewMoveEnd ¶
NewMoveEnd - 移動先マス、成りの有無 を指定してください
func (MoveEnd) Destructure ¶
Destructure
移動先マス 0111 1111 (Mask) 0x7f pddd dddd
成 1000 0000 (Mask) 0x80 pddd dddd
type Position ¶
type Position struct { // Go言語で列挙型めんどくさいんで文字列で(^~^) // [19] は 1九、 [91] は 9一(^~^)反時計回りに90°回転した将棋盤の状態で入ってるぜ(^~^)想像しろだぜ(^~^) Board [l03.BOARD_SIZE]l03.Piece // 駒の場所 // [0]先手玉 [1]後手玉 [2:3]飛 [4:5]角 [6:9]香 PieceLocations [l07.PCLOC_SIZE]l03.Square // 持ち駒の数だぜ(^~^)玉もある(^~^) K, R, B, G, S, N, L, P, k, r, b, g, s, n, l, p Hands1 [l03.HAND_SIZE]int // 現局面の手番から見た駒得評価値 MaterialValue Value }
Position - 局面
func NewPosition ¶
func NewPosition() *Position
func (*Position) GetLocationOfLongPiece ¶
GetLongPiece - 長い利きの駒の場所を取得
func (*Position) GetPieceOnBoardAtSq ¶
GetPieceOnBoardAtSq - 盤上の駒を取得
func (*Position) Hetero ¶
Hetero - 移動元と移動先の駒を持つプレイヤーが異なれば真。移動先が空マスでも真 持ち駒は指定してはいけません。 Homo の逆だぜ(^~^)片方ありゃいいんだけど(^~^)
func (*Position) SetToStartpos ¶
func (pPos *Position) SetToStartpos()
SetToStartpos - 初期局面にします。利きの計算はまだ行っていません。
type PositionSystem ¶
type PositionSystem struct { // 開発モードフラグ。デフォルト値:真。 'usi' コマンドで解除 BuildType BuildT // 局面 PPosition [l11.POS_LAYER_SIZE]*Position // 開始局面の時点で何手目か(^~^)これは表示のための飾りのようなものだぜ(^~^) StartMovesNum int // 開始局面から数えて何手目か(^~^)0から始まるぜ(^~^) OffsetMovesIndex int // 指し手のリスト(^~^) // 1手目は[0]へ、512手目は[511]へ入れろだぜ(^~^) Moves [l02.MOVES_SIZE]l03.Move // 取った駒のリスト(^~^)アンドゥ ムーブするときに使うだけ(^~^)指し手のリストと同じ添え字を使うぜ(^~^) CapturedList [l02.MOVES_SIZE]l03.Piece // contains filtered or unexported fields }
PositionSystem - 局面にいろいろな機能を付けたもの
func NewPositionSystem ¶
func NewPositionSystem() *PositionSystem
func (*PositionSystem) FlipPhase ¶
func (pPosSys *PositionSystem) FlipPhase()
FlipPhase - フェーズをひっくり返すぜ(^~^)
func (*PositionSystem) GetPhase ¶
func (pPosSys *PositionSystem) GetPhase() l03.Phase
GetPhase - フェーズ
func (*PositionSystem) SprintDiff ¶
func (pPosSys *PositionSystem) SprintDiff(b1 PosLayerT, b2 PosLayerT) string
Print - 2局面の比較用画面出力(^q^)
func (*PositionSystem) SprintRecord ¶
func (pPosSys *PositionSystem) SprintRecord() string
SprintRecord - 棋譜表示(^~^)
func (*PositionSystem) SprintSfenResignation ¶
func (pPosSys *PositionSystem) SprintSfenResignation(pPos *Position) string
SprintSfen - SFEN文字列返せよ(^~^)投了図を返すぜ(^~^)棋譜の部分を捨てるぜ(^~^)
Source Files ¶
- brain.go
- brain_position_system_testing.go
- brain_print.go
- control_board.go
- control_board_paint.go
- control_board_scanner.go
- control_board_system.go
- difference_record.go
- evaluation_material.go
- genmove.go
- models_position.go
- models_position2.go
- models_position3.go
- move_end.go
- position_l16.go
- position_print.go
- position_system.go
- position_system_print.go
- search.go
- usi.go
- validation.go
- views_moves.go
- views_position_board_footer.go
- views_position_sprint_board.go