Documentation ¶
Overview ¶
駒の価値
Index ¶
- Constants
- Variables
- func Demote(piece l03.Piece) l03.Piece
- func EvalMaterial(piece l03.Piece) int16
- func FlipPhase(phase l03.Phase) l03.Phase
- func GenMoveList(pPos *Position) []l03.Move
- func MainLoop()
- func NifuFirst(pPos *Position, file l03.Square) bool
- func NifuSecond(pPos *Position, file l03.Square) bool
- func OnBoard(sq l03.Square) bool
- func Promote(piece l03.Piece) l03.Piece
- func Search(pPos *Position) l03.Move
- func SprintBoard(pPos *Position) string
- func SprintRecord(pPos positionForRecord) string
- func SquareFrom(file l03.Square, rank l03.Square) l03.Square
- type MoveEnd
- type Position
- func (pPos *Position) AddControlDiff(layer int, from l03.Square, sign int8)
- func (pPos *Position) AddControlDiffAllSlidingPiece(layer int, sign int8, excludeFrom l03.Square)
- func (pPos *Position) ClearControlDiff()
- func (pPos *Position) DoMove(move l03.Move)
- func (pPos *Position) Dump() string
- func (pPos *Position) GetCapturedPieceAtMovesIndex(movesIndex int) l03.Piece
- func (pPos *Position) GetLocationOfLongPiece(index int) l03.Square
- func (pPos *Position) GetMoveAtMovesIndex(movesIndex int) l03.Move
- func (pPos *Position) GetOffsetMoveIndex() int
- 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) MergeControlDiff()
- func (pPos *Position) ReadPosition(command string)
- func (pPos *Position) SprintControl(phase l03.Phase, flag int) string
- func (pPos *Position) SprintRecord() string
- func (pPos *Position) SprintSfen() string
- func (pPos *Position) UndoMove()
Constants ¶
const RESIGN_MOVE_END = MoveEnd(0)
0 は 投了ということにするぜ(^~^)
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 EvalMaterial ¶
EvalMaterial - 駒の価値。開発者のむずでょが勝手に決めた(^~^)
func GenMoveList ¶
GenMoveList - 現局面の指し手のリスト。合法手とは限らないし、全ての合法手を含むとも限らないぜ(^~^)
Types ¶
type MoveEnd ¶
type MoveEnd uint8
MoveEnd - 移動先と成り
pddd dddd
1~7bit: 移動先(0~127) 8bit: 成(0~1)
func GenMoveEnd ¶
GenMoveEnd - 利いているマスの一覧を返します。動けるマスではありません。
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 // 利きテーブル [0]先手 [1]後手 // マスへの利き数が入っています ControlBoards [2][l03.BOARD_SIZE]int8 // マスへの利き数の差分が入っています。デバッグ目的で無駄に分けてるんだけどな(^~^) // プレイヤー1つにつき、5レイヤーあるぜ(^~^) ControlBoardsDiff [2][5][l03.BOARD_SIZE]int8 // 持ち駒の数だぜ(^~^) R, B, G, S, N, L, P, r, b, g, s, n, l, p Hands []int // 先手が1、後手が2(^~^) Phase l03.Phase // 開始局面の時点で何手目か(^~^)これは表示のための飾りのようなものだぜ(^~^) StartMovesNum int // 開始局面から数えて何手目か(^~^)0から始まるぜ(^~^) OffsetMovesIndex int // 指し手のリスト(^~^) // 1手目は[0]へ、512手目は[511]へ入れろだぜ(^~^) Moves [l02.MOVES_SIZE]l03.Move // 取った駒のリスト(^~^)アンドゥ ムーブするときに使うだけ(^~^)指し手のリストと同じ添え字を使うぜ(^~^) CapturedList [l02.MOVES_SIZE]l03.Piece }
Position - 局面
func NewPosition ¶
func NewPosition() *Position
func (*Position) AddControlDiff ¶
AddControlDiff - 盤上のマスを指定することで、そこにある駒の利きを調べて、利きの差分テーブルの値を増減させます
func (*Position) AddControlDiffAllSlidingPiece ¶
AddControlDiffAllSlidingPiece - すべての長い利きの駒の利きを調べて、利きの差分テーブルの値を増減させます
func (*Position) ClearControlDiff ¶
func (pPos *Position) ClearControlDiff()
ClearControlDiff - 利きの差分テーブルをクリアーするぜ(^~^)
func (*Position) GetCapturedPieceAtMovesIndex ¶
func (*Position) GetLocationOfLongPiece ¶
GetLongPiece - 長い利きの駒の場所を取得
func (*Position) GetMoveAtMovesIndex ¶
func (*Position) GetOffsetMoveIndex ¶
func (*Position) Hetero ¶
Hetero - 移動元と移動先の駒を持つプレイヤーが異なれば真。移動先が空マスでも真 持ち駒は指定してはいけません。 Homo の逆だぜ(^~^)片方ありゃいいんだけど(^~^)
func (*Position) MergeControlDiff ¶
func (pPos *Position) MergeControlDiff()
MergeControlDiff - 利きの差分を解消するぜ(^~^)
func (*Position) ReadPosition ¶
ReadPosition - 局面を読み取ります。マルチバイト文字は含まれていないぜ(^q^)
func (*Position) SprintControl ¶
SprintControl - 利き数ボード出力(^q^)
Parameters ---------- * `flag` - 0: 利き数ボード, 1-5:利き数の差分ボードのレイヤー[0]~[4]
func (*Position) SprintRecord ¶
SprintRecord - 棋譜表示(^~^)
func (*Position) SprintSfen ¶
SprintSfen - SFEN文字列返せよ(^~^)