take10

package
v0.0.0-...-f2ec8e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2021 License: MIT Imports: 14 Imported by: 0

README

take10

玉は逃げてくれてるようだし、アルファベータ探索入れてみよかな(^~^)
その前に駒得評価関数入れてみるかな(^~^)?
駒得評価を入れてみたけど、きふわらべがどう評価しているか見えないぜ(^~^) 評価値出してくれだぜ(^~^)
利きの差分表も 飛、角、香 は分けようかなあ(^~^)?
テスト用のランダム局面を増やすために、プレイアウトも欲しいぜ(^~^)
王手回避のときに打をしてないので、間駒するようにしたいぜ(^~^)

Test

# 強制終了した(^~^) -> 配列のサイズが変わっていたので length 再計算(^~^)
position startpos moves 7g7f 3a4b 6i7h 6c6d 7i6h 5a6b 8h5e 4b5a 5e6d 2c2d 6h7g 6b6c 6d4f 8b3b 4f2d 7a8b 3i4h 1c1d 5i6h 5a6b 7g8h 4a5a 8g8f 2b3a 8h8g 6a5b 7h7i 3b2b 2d4f
go btime 75000 wtime 74000 binc 2000 winc 2000

# 飛打されてなぜか即投了(^~^)->利きボードの内容がおかしい ->利きボードも、SFENパーサーもおかしかったので直した(^~^)
position startpos moves 7g7f 3c3d 2g2f 2b8h 7i8h 1c1d B*4e B*7h 6i7h 8c8d 4e6c+ 3d3e 6c5c 8b6b 5c6b 5a6b R*6d
go btime 69000 wtime 68000 binc 2000 winc 2000
# 手を戻してみよ(^~^)馬で王手されてるな(^~^)
position startpos moves 7g7f 3c3d 2g2f 2b8h 7i8h 1c1d B*4e B*7h 6i7h 8c8d 4e6c+ 3d3e 6c5c 8b6b 5c6b
movelist
MoveList
--------
(0) 5a6b
(1) 5a4b
* Except for those to be removed during the search

# 強制終了
position startpos moves 7i6h 4a3b 2h3h 6a5b 3h4h 3a4b 3i3h 7a7b 2g2f 3c3d 6h7i 4b3c 8g8f 5a4b 6i5h 3d3e 7i6h 8c8d 5i6i 7b8c 9i9h 9c9d 9g9f 5c5d 8h7i 8c7d 4i3i 7d7e 2f2e 7e8f 7g7f 8f8g 6h7g 8g9h+ 4g4f L*8e 5g5f 8e8i+ 7g8f 8i7i 6i7i N*8e 8f8e 8d8e N*4g 8e8f 4g3e 8f8g+ 3e2c 8g7h
go

# 違法手。香車持ってないのに打った(^~^)先後間違えてる(^~^)? -> 先後のどちらの駒も打つようになってたので修正(^~^)
position startpos moves 7g7f 8b4b 3i4h 9a9b 5i6h 6c6d 8h5e 6a7b 5e6d 9c9d 6d5c+ 8a9c 5c4b 3a4b R*9a B*8d 9a9b+ 8d5g 4h5g
go btime 70000 wtime 69000 binc 2000 winc 2000
info depth 0 nodes 118 score cp 0 currmove L*3b pv L*3b
bestmove L*3b
gameover win

Test2

# 平手初期局面
position startpos

# 利きボード目視確認
control layer 0

[Control(0)Sum First]

  9  8  7  6  5  4  3  2  1
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| a
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| b
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| c
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| d
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| e
+--+--+--+--+--+--+--+--+--+
| 1| 1| 1| 1| 1| 1| 1| 1| 1| f
+--+--+--+--+--+--+--+--+--+
| 3| 0| 2| 0| 0| 0| 1| 1| 2| g
+--+--+--+--+--+--+--+--+--+
| 1| 2| 3| 4| 4| 4| 3| 1| 2| h
+--+--+--+--+--+--+--+--+--+
| 1| 0| 2| 1| 2| 1| 1| 1| 0| i
+--+--+--+--+--+--+--+--+--+


[Control(0)Sum Second]

  9  8  7  6  5  4  3  2  1
+--+--+--+--+--+--+--+--+--+
| 0| 1| 1| 1| 2| 1| 2| 0| 1| a
+--+--+--+--+--+--+--+--+--+
| 2| 1| 3| 4| 4| 4| 3| 2| 1| b
+--+--+--+--+--+--+--+--+--+
| 2| 1| 1| 0| 0| 0| 2| 0| 3| c
+--+--+--+--+--+--+--+--+--+
| 1| 1| 1| 1| 1| 1| 1| 1| 1| d
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| e
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| f
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| g
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| h
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| i
+--+--+--+--+--+--+--+--+--+

# 利き再計算
control recalc 12

# 目視確認
control layer 12

[Control(12)TestRecalc First]

  9  8  7  6  5  4  3  2  1
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| a
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| b
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| c
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| d
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| e
+--+--+--+--+--+--+--+--+--+
| 1| 1| 1| 1| 1| 1| 1| 1| 1| f
+--+--+--+--+--+--+--+--+--+
| 3| 0| 2| 0| 0| 0| 1| 1| 2| g
+--+--+--+--+--+--+--+--+--+
| 1| 2| 3| 4| 4| 4| 3| 1| 2| h
+--+--+--+--+--+--+--+--+--+
| 1| 0| 2| 1| 2| 1| 1| 1| 0| i
+--+--+--+--+--+--+--+--+--+


[Control(12)TestRecalc Second]

  9  8  7  6  5  4  3  2  1
+--+--+--+--+--+--+--+--+--+
| 0| 1| 1| 1| 2| 1| 2| 0| 1| a
+--+--+--+--+--+--+--+--+--+
| 2| 1| 3| 4| 4| 4| 3| 2| 1| b
+--+--+--+--+--+--+--+--+--+
| 2| 1| 1| 0| 0| 0| 2| 0| 3| c
+--+--+--+--+--+--+--+--+--+
| 1| 1| 1| 1| 1| 1| 1| 1| 1| d
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| e
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| f
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| g
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| h
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| i
+--+--+--+--+--+--+--+--+--+

# 利きボード比較
control diff 0 12 10

# 違いをカウント
control sumabs 10
ControlTest: SumAbs=0,0

# 目視確認
control layer 0

[Control(0)Sum First]

  9  8  7  6  5  4  3  2  1
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| a
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| b
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| c
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| d
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| e
+--+--+--+--+--+--+--+--+--+
| 1| 1| 1| 1| 1| 1| 1| 1| 1| f
+--+--+--+--+--+--+--+--+--+
| 3| 0| 2| 0| 0| 0| 1| 1| 2| g
+--+--+--+--+--+--+--+--+--+
| 1| 2| 3| 4| 4| 4| 3| 1| 2| h
+--+--+--+--+--+--+--+--+--+
| 1| 0| 2| 1| 2| 1| 1| 1| 0| i
+--+--+--+--+--+--+--+--+--+


[Control(0)Sum Second]

  9  8  7  6  5  4  3  2  1
+--+--+--+--+--+--+--+--+--+
| 0| 1| 1| 1| 2| 1| 2| 0| 1| a
+--+--+--+--+--+--+--+--+--+
| 2| 1| 3| 4| 4| 4| 3| 2| 1| b
+--+--+--+--+--+--+--+--+--+
| 2| 1| 1| 0| 0| 0| 2| 0| 3| c
+--+--+--+--+--+--+--+--+--+
| 1| 1| 1| 1| 1| 1| 1| 1| 1| d
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| e
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| f
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| g
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| h
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| i
+--+--+--+--+--+--+--+--+--+

# 目視確認
control layer 10

[Control(10)TestCopy First]

  9  8  7  6  5  4  3  2  1
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| a
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| b
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| c
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| d
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| e
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| f
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| g
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| h
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| i
+--+--+--+--+--+--+--+--+--+


[Control(10)TestCopy Second]

  9  8  7  6  5  4  3  2  1
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| a
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| b
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| c
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| d
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| e
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| f
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| g
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| h
+--+--+--+--+--+--+--+--+--+
| 0| 0| 0| 0| 0| 0| 0| 0| 0| i
+--+--+--+--+--+--+--+--+--+

Documentation

Overview

駒の価値

利きボード

利きのテスト

Index

Constants

View Source
const (
	// 持ち駒を打つ 100~113
	// 先手飛打
	SQ_R1         = Square(100)
	SQ_B1         = Square(101)
	SQ_G1         = Square(102)
	SQ_S1         = Square(103)
	SQ_N1         = Square(104)
	SQ_L1         = Square(105)
	SQ_P1         = Square(106)
	SQ_R2         = Square(107)
	SQ_B2         = Square(108)
	SQ_G2         = Square(109)
	SQ_S2         = Square(110)
	SQ_N2         = Square(111)
	SQ_L2         = Square(112)
	SQ_P2         = Square(113)
	SQ_HAND_START = SQ_R1
	SQ_HAND_END   = SQ_P2 + 1 // この数を含まない
)
View Source
const (
	// 持ち駒を打つ 0~13 (Index)
	HAND_R1_IDX    = 0 // 先手飛打
	HAND_B1_IDX    = 1
	HAND_G1_IDX    = 2
	HAND_S1_IDX    = 3
	HAND_N1_IDX    = 4
	HAND_L1_IDX    = 5
	HAND_P1_IDX    = 6
	HAND_R2_IDX    = 7
	HAND_B2_IDX    = 8
	HAND_G2_IDX    = 9
	HAND_S2_IDX    = 10
	HAND_N2_IDX    = 11
	HAND_L2_IDX    = 12
	HAND_P2_IDX    = 13
	HAND_IDX_START = HAND_R1_IDX
	HAND_IDX_END   = HAND_P2_IDX - 1 // この数を含まない
	HAND_TYPE_SIZE = 7
)
View Source
const (
	PIECE_TYPE_EMPTY = PieceType(0) // 空マス
	PIECE_TYPE_K     = PieceType(1)
	PIECE_TYPE_R     = PieceType(2)
	PIECE_TYPE_B     = PieceType(3)
	PIECE_TYPE_G     = PieceType(4)
	PIECE_TYPE_S     = PieceType(5)
	PIECE_TYPE_N     = PieceType(6)
	PIECE_TYPE_L     = PieceType(7)
	PIECE_TYPE_P     = PieceType(8)
	PIECE_TYPE_PR    = PieceType(9)
	PIECE_TYPE_PB    = PieceType(10)
	PIECE_TYPE_PS    = PieceType(11)
	PIECE_TYPE_PN    = PieceType(12)
	PIECE_TYPE_PL    = PieceType(13)
	PIECE_TYPE_PP    = PieceType(14)
)
View Source
const (
	// 空マス
	ZEROTH = Phase(0)
	// 先手
	FIRST = Phase(1)
	// 後手
	SECOND = Phase(2)
)
View Source
const (
	PIECE_EMPTY = iota
	PIECE_K1
	PIECE_R1
	PIECE_B1
	PIECE_G1
	PIECE_S1
	PIECE_N1
	PIECE_L1
	PIECE_P1
	PIECE_PR1
	PIECE_PB1
	PIECE_PS1
	PIECE_PN1
	PIECE_PL1
	PIECE_PP1
	PIECE_K2
	PIECE_R2
	PIECE_B2
	PIECE_G2
	PIECE_S2
	PIECE_N2
	PIECE_L2
	PIECE_P2
	PIECE_PR2
	PIECE_PB2
	PIECE_PS2
	PIECE_PN2
	PIECE_PL2
	PIECE_PP2
)

View Source
const (
	CONTROL_LAYER_SUM = iota
	CONTROL_LAYER_DIFF_ROOK_OFF
	CONTROL_LAYER_DIFF_BISHOP_OFF
	CONTROL_LAYER_DIFF_LANCE_OFF
	CONTROL_LAYER_DIFF_PUT // 打とか指すとか
	CONTROL_LAYER_DIFF_REMOVE
	CONTROL_LAYER_DIFF_CAPTURED
	CONTROL_LAYER_DIFF_LANCE_ON
	CONTROL_LAYER_DIFF_BISHOP_ON
	CONTROL_LAYER_DIFF_ROOK_ON
	CONTROL_LAYER_TEST_COPY          // テスト用
	CONTROL_LAYER_TEST_ERROR         // テスト用
	CONTROL_LAYER_TEST_RECALCULATION // テスト用 再計算
	CONTROL_LAYER_DIFF_START         = 1
	CONTROL_LAYER_DIFF_END           = 10 // この数を含まない。テスト用も含まない
	CONTROL_LAYER_ALL_SIZE           = 13 // この数を含まない
)
View Source
const (
	// Author - 囲碁思考エンジンの作者名だぜ☆(^~^)
	Author = "Satoshi Takahashi"
)
View Source
const BOARD_SIZE = 100

00~99

View Source
const MOVES_SIZE = 512

電竜戦が一番長いだろ(^~^)

View Source
const ResignMove = Move(0)

0 は 投了ということにするぜ(^~^)

View Source
const SQUARE_EMPTY = Square(0)

マス番号を指定しないことを意味するマス番号

Variables

View Source
var OneDigitNumbers = [10]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}

position sfen の盤のスペース数に使われますN

Functions

func CountAllPieces

func CountAllPieces(pPos *Position) [8]int

CountAllPieces - 駒の数を確認するぜ(^~^)

func CountErrorCountLists

func CountErrorCountLists(countList1 [8]int, countList2 [8]int) int

CountErrorCountLists - 数えた駒の枚数を比較します

func EvalMaterial

func EvalMaterial(piece Piece) int16

EvalMaterial - 駒の価値。開発者のむずでょが勝手に決めた(^~^)

func GetControlLayerName

func GetControlLayerName(layer int) string

GetControlLayerName - 利きボードのレイヤーの名前

func MainLoop

func MainLoop()

MainLoop - 開始。

func NifuFirst

func NifuFirst(pPos *Position, file Square) bool

NifuFirst - 先手で二歩になるか筋調べ

func NifuSecond

func NifuSecond(pPos *Position, file Square) bool

NifuSecond - 後手で二歩になるか筋調べ

func OnBoard

func OnBoard(sq Square) bool

OnBoard - 盤上なら真

func OnHands

func OnHands(sq Square) bool

OnHands - 持ち駒なら真

func ShowAllPiecesCount

func ShowAllPiecesCount(pPos *Position)

ShowAllPiecesCount - 駒の枚数表示

func ShuffleBoard

func ShuffleBoard(pPos *Position)

ShuffleBoard - 盤上の駒、持ち駒をシャッフルします ゲーム中にはできない動きをするので、利きの計算は無視します。 最後に利きは再計算します

func SumAbsControl

func SumAbsControl(pPos *Position, layer1 int) [2]int

SumAbsControl - 利きテーブルの各マスを絶対値にし、その総和を返します

func TestControl

func TestControl(pPos *Position) (bool, string)

TestControl

Types

type EngineConf

type EngineConf struct {
	Profile Profile
}

EngineConf - Tomlファイル。

func LoadEngineConf

func LoadEngineConf(path string) (*EngineConf, error)

LoadEngineConf - ゲーム設定ファイルを読み込みます。

type Move

type Move uint16

Move - 指し手

15bit で表せるはず(^~^) .pdd dddd dsss ssss

1~7bit: 移動元(0~127) 8~14bit: 移動先(0~127) 15bit: 成(0~1)

func GenMoveList

func GenMoveList(pPos *Position) []Move

GenMoveList - 現局面の指し手のリスト。合法手とは限らないし、全ての合法手を含むとも限らないぜ(^~^)

func NewMoveValue

func NewMoveValue() Move

func NewMoveValue2

func NewMoveValue2(src_sq Square, dst_sq Square) Move

NewMoveValue2 - 初期値として 移動元マス、移動先マスを指定してください TODO 成、不成も欲しいぜ(^~^)

func ParseMove

func ParseMove(command string, i *int, phase Phase) (Move, error)

ParseMove - 指し手コマンドを解析

func Search(pPos *Position) Move

Search - 探索部

func (Move) GetDestination

func (move Move) GetDestination() Square

GetDestination - 移動元マス 0011 1111 1000 0000 (Mask) 0x3f80 .pdd dddd dsss ssss

func (Move) GetPromotion

func (move Move) GetPromotion() bool

GetPromotion - 成 0100 0000 0000 0000 (Mask) 0x4000 .pdd dddd dsss ssss

func (Move) GetSource

func (move Move) GetSource() Square

GetSource - 移動元マス 0000 0000 0111 1111 (Mask) 0x007f .pdd dddd dsss ssss

func (Move) ReplaceDestination

func (move Move) ReplaceDestination(sq Square) Move

ReplaceDestination - 移動先マス 1100 0000 0111 1111 (Clear) 0xc07f .pdd dddd dsss ssss

func (Move) ReplacePromotion

func (move Move) ReplacePromotion(promotion bool) Move

ReplacePromotion - 成 0100 0000 0000 0000 (Stand) 0x4000 1011 1111 1111 1111 (Clear) 0xbfff .pdd dddd dsss ssss

func (Move) ReplaceSource

func (move Move) ReplaceSource(sq Square) Move

ReplaceSource - 移動元マス 1111 1111 1000 0000 (Clear) 0xff80 .pdd dddd dsss ssss

func (Move) ToCode

func (move Move) ToCode() string

ToCode - SFEN の moves の後に続く指し手に使える文字列を返します

type Phase

type Phase byte

1:先手 2:後手

func FlipPhase

func FlipPhase(phase Phase) Phase

FlipPhase - 先後を反転します

func Who

func Who(piece Piece) Phase

Who - 駒が先手か後手か空升かを返します

type Piece

type Piece uint8

先後付きの駒

func Demote

func Demote(piece Piece) Piece

Demote - 成っている駒を、成っていない駒に戻します

func PieceFrom

func PieceFrom(piece string) Piece

PieceFrom - 文字列

func PieceFromPhPt

func PieceFromPhPt(phase Phase, pieceType PieceType) Piece

PieceFromPhPt - 駒作成。空マスは作れません

func Promote

func Promote(piece Piece) Piece

Promote - 成ります

func (Piece) ToCode

func (pc Piece) ToCode() string

ToCode - 文字列

type PieceType

type PieceType byte

先後のない駒種類

func What

func What(piece Piece) PieceType

What - 先後のない駒種類を返します。

func WhatHand

func WhatHand(hand Square) PieceType

WhatHand - 持ち駒のマス番号から、先後なしの駒種類を返します

type Position

type Position struct {
	// Go言語で列挙型めんどくさいんで文字列で(^~^)
	// [19] は 1九、 [91] は 9一(^~^)反時計回りに90°回転した将棋盤の状態で入ってるぜ(^~^)想像しろだぜ(^~^)
	Board [BOARD_SIZE]Piece

	// 飛車の場所。長い利きを消すために必要(^~^)
	RookLocations [2]Square
	// 角の場所。長い利きを消すために必要(^~^)
	BishopLocations [2]Square
	// 香の場所。長い利きを消すために必要(^~^)
	LanceLocations [4]Square
	// マスへの利き数、または差分が入っています。デバッグ目的で無駄に分けてるんだけどな(^~^)
	// 利きテーブル [0]先手 [1]後手
	// [0] 利き
	// [1] 飛の利き引く(差分)
	// [2] 角の利き引く(差分)
	// [3] 香の利き引く(差分)
	// [4] ムーブ用(差分)
	// [5] ムーブ用(差分)
	// [6] ムーブ用(差分)
	// [7] 香の利き戻す(差分)
	// [8] 角の利き戻す(差分)
	// [9] 飛の利き戻す(差分)
	// [10] テスト用
	// [11] テスト用
	// [12] テスト用(再計算)
	ControlBoards [2][CONTROL_LAYER_ALL_SIZE][BOARD_SIZE]int8

	// 持ち駒の数だぜ(^~^) R, B, G, S, N, L, P, r, b, g, s, n, l, p
	Hands []int

	// 開始局面の時点で何手目か(^~^)これは表示のための飾りのようなものだぜ(^~^)
	StartMovesNum int
	// 開始局面から数えて何手目か(^~^)0から始まるぜ(^~^)
	OffsetMovesIndex int
	// 指し手のリスト(^~^)
	// 1手目は[0]へ、512手目は[511]へ入れろだぜ(^~^)
	Moves [MOVES_SIZE]Move
	// 取った駒のリスト(^~^)アンドゥ ムーブするときに使うだけ(^~^)指し手のリストと同じ添え字を使うぜ(^~^)
	CapturedList [MOVES_SIZE]Piece
	// contains filtered or unexported fields
}

Position - 局面

func NewPosition

func NewPosition() *Position

func (*Position) AddControlBishop

func (pPos *Position) AddControlBishop(layer int, sign int8, excludeFrom Square)

AddControlBishop - 長い利きの駒の利きを調べて、利きの差分テーブルの値を増減させます

func (*Position) AddControlDiff

func (pPos *Position) AddControlDiff(layer int, from Square, sign int8)

AddControlDiff - 盤上のマスを指定することで、そこにある駒の利きを調べて、利きの差分テーブルの値を増減させます

func (*Position) AddControlLance

func (pPos *Position) AddControlLance(layer int, sign int8, excludeFrom Square)

AddControlLance - 長い利きの駒の利きを調べて、利きの差分テーブルの値を増減させます

func (*Position) AddControlRook

func (pPos *Position) AddControlRook(layer int, sign int8, excludeFrom Square)

AddControlRook - 長い利きの駒の利きを調べて、利きの差分テーブルの値を増減させます

func (*Position) ClearControlDiff

func (pPos *Position) ClearControlDiff()

ClearControlDiff - 利きの差分テーブルをクリアーするぜ(^~^)

func (*Position) ClearControlLayer

func (pPos *Position) ClearControlLayer(layer int)

func (*Position) DiffControl

func (pPos *Position) DiffControl(layer1 int, layer2 int, layer3 int)

DiffControl - 利きテーブルの差分計算

func (*Position) DoMove

func (pPos *Position) DoMove(move Move)

DoMove - 一手指すぜ(^~^)

func (*Position) Dump

func (pPos *Position) Dump() string

Dump - 内部状態を全部出力しようぜ(^~^)?

func (*Position) FlipPhase

func (pPos *Position) FlipPhase()

FlipPhase - フェーズをひっくり返すぜ(^~^)

func (*Position) GetKingLocations

func (pPos *Position) GetKingLocations() (Square, Square)

func (*Position) GetPhase

func (pPos *Position) GetPhase() Phase

GetPhase - フェーズ

func (*Position) Hetero

func (pPos *Position) Hetero(from Square, to Square) bool

Hetero - 移動元と移動先の駒を持つプレイヤーが異なれば真。移動先が空マスでも真 持ち駒は指定してはいけません。 Homo の逆だぜ(^~^)片方ありゃいいんだけど(^~^)

func (*Position) Homo

func (pPos *Position) Homo(from Square, to Square) bool

Homo - 移動元と移動先の駒を持つプレイヤーが等しければ真。移動先が空なら偽 持ち駒は指定してはいけません。

func (*Position) IsEmptySq

func (pPos *Position) IsEmptySq(sq Square) bool

IsEmptySq - 空きマスなら真。持ち駒は偽

func (*Position) MergeControlDiff

func (pPos *Position) MergeControlDiff()

MergeControlDiff - 利きの差分を解消するぜ(^~^)

func (*Position) ReadPosition

func (pPos *Position) ReadPosition(command string)

ReadPosition - 局面を読み取ります。マルチバイト文字は含まれていないぜ(^q^)

func (*Position) RecalculateControl

func (pPos *Position) RecalculateControl(layer1 int)

RecalculateControl - 利きの再計算

func (*Position) Sprint

func (pPos *Position) Sprint() string

Print - 局面出力(^q^)

func (*Position) SprintControl

func (pPos *Position) SprintControl(phase Phase, layer int) string

SprintControl - 利き数ボード出力(^q^)

Parameters ---------- * `layer` - 利き数ボードのレイヤー番号(^~^)

func (*Position) SprintLocation

func (pPos *Position) SprintLocation() string

SprintLocation - あの駒どこにいんの?を表示

func (*Position) SprintRecord

func (pPos *Position) SprintRecord() string

SprintRecord - 棋譜表示(^~^)

func (*Position) SprintSfen

func (pPos *Position) SprintSfen() string

SprintSfen - SFEN文字列返せよ(^~^)

func (*Position) UndoMove

func (pPos *Position) UndoMove()

UndoMove - 棋譜を頼りに1手戻すぜ(^~^)

type Profile

type Profile struct {
	Name   string
	Author string
}

Profile - Profile 区画。

type Square

type Square uint32

マス番号 00~99,100~113

func File

func File(sq Square) Square

File - マス番号から筋(列)を取り出します

func GenControl

func GenControl(pPos *Position, from Square) []Square

GenControl - 利いているマスの一覧を返します。動けるマスではありません。

func Rank

func Rank(sq Square) Square

Rank - マス番号から段(行)を取り出します

func SquareFrom

func SquareFrom(file Square, rank Square) Square

From - 筋と段からマス番号を作成します

type Variables

type Variables struct {
	// Log - ロガー。
	Log l.Logger
	// Chat - チャッター。 標準出力とロガーを一緒にしただけです。
	Chat l.Chatter
	// StderrChat - チャッター。 標準エラー出力とロガーを一緒にしただけです。
	StderrChat l.StderrChatter
}

Variables - グローバル変数。

var G Variables

G - グローバル変数。思い切った名前。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL