take7

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: 11 Imported by: 0

README

take7

玉が利きに飛び込むの止めてほしいなあ(^~^)
利きを調べるかな(^~^)
利きテーブル作るか~(^~^)
まず、簡単な指し手は生成したぜ(^~^)

Test

position startpos moves 3i3h 4a3b 5i6h 6a5b 4g4f 5a4b 5g5f 4c4d 6g6f 5b4c 6h5i 1c1d 4i3i 2b1c 1g1f 1c4f 3i4h 5c5d 3g3f 4f2h+ 6i7h 2h1i
go btime 71000 wtime 71000 binc 2000 winc 2000

Documentation

Index

Constants

View Source
const (
	// 持ち駒を打つ 100~113
	// 先手飛打
	DROP_R1        = Square(100)
	DROP_B1        = Square(101)
	DROP_G1        = Square(102)
	DROP_S1        = Square(103)
	DROP_N1        = Square(104)
	DROP_L1        = Square(105)
	DROP_P1        = Square(106)
	DROP_R2        = Square(107)
	DROP_B2        = Square(108)
	DROP_G2        = Square(109)
	DROP_S2        = Square(110)
	DROP_N2        = Square(111)
	DROP_L2        = Square(112)
	DROP_P2        = Square(113)
	DROP_ORIGIN    = DROP_R1
	DROP_TYPE_SIZE = DROP_P1 - DROP_ORIGIN
)
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 = ""
	PIECE_K1    = "K"
	PIECE_R1    = "R"
	PIECE_B1    = "B"
	PIECE_G1    = "G"
	PIECE_S1    = "S"
	PIECE_N1    = "N"
	PIECE_L1    = "L"
	PIECE_P1    = "P"
	PIECE_PR1   = "+R"
	PIECE_PB1   = "+B"
	PIECE_PS1   = "+S"
	PIECE_PN1   = "+N"
	PIECE_PL1   = "+L"
	PIECE_PP1   = "+P"
	PIECE_K2    = "k"
	PIECE_R2    = "r"
	PIECE_B2    = "b"
	PIECE_G2    = "g"
	PIECE_S2    = "s"
	PIECE_N2    = "n"
	PIECE_L2    = "l"
	PIECE_P2    = "p"
	PIECE_PR2   = "+r"
	PIECE_PB2   = "+b"
	PIECE_PS2   = "+s"
	PIECE_PN2   = "+n"
	PIECE_PL2   = "+l"
	PIECE_PP2   = "+p"
)

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 は 投了ということにするぜ(^~^)

Variables

This section is empty.

Functions

func MainLoop

func MainLoop()

MainLoop - 開始。

Types

type EngineConf

type EngineConf struct {
	Profile Profile
}

EngineConf - Tomlファイル。

func LoadEngineConf

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

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

type Move

type Move uint32

Move - 指し手

17bit で表せるはず(^~^) pddddddddssssssss

1~8bit: 移動元 9~16bit: 移動先 17bit: 成

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 - 初期値として 移動元マス、移動先マスを指定してください

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 - 移動元マス

func (Move) GetPromotion

func (move Move) GetPromotion() bool

GetPromotion - 成

func (Move) GetSource

func (move Move) GetSource() Square

GetSource - 移動元マス

func (Move) ReplaceDestination

func (move Move) ReplaceDestination(sq Square) Move

ReplaceDestination - 移動先マス

func (Move) ReplacePromotion

func (move Move) ReplacePromotion(promotion bool) Move

ReplacePromotion - 成

func (Move) ReplaceSource

func (move Move) ReplaceSource(sq Square) Move

ReplaceSource - 移動元マス

func (Move) ToCode

func (move Move) ToCode() string

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

type Phase

type Phase byte

1:先手 2:後手

func Who

func Who(piece string) Phase

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

type PieceType

type PieceType byte

先後のない駒種類

func What

func What(piece string) PieceType

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

type Position

type Position struct {
	// Go言語で列挙型めんどくさいんで文字列で(^~^)
	// [19] は 1九、 [91] は 9一(^~^)反時計回りに90°回転した将棋盤の状態で入ってるぜ(^~^)想像しろだぜ(^~^)
	Board [BOARD_SIZE]string
	// 飛車の場所。長い利きを消すために必要(^~^)
	RookLocations [2]Square
	// 角の場所。長い利きを消すために必要(^~^)
	BishopLocations [2]Square
	// 香の場所。長い利きを消すために必要(^~^)
	LanceLocations [4]Square
	// 利きテーブル [0]先手 [1]後手
	// マスへの利き数が入っています
	ControlBoards [2][BOARD_SIZE]int8

	// 持ち駒の数だぜ(^~^) R, B, G, S, N, L, P, r, b, g, s, n, l, p
	Hands []int
	// 先手が1、後手が2(^~^)
	Phase Phase
	// 開始局面の時点で何手目か(^~^)これは表示のための飾りのようなものだぜ(^~^)
	StartMovesNum int
	// 開始局面から数えて何手目か(^~^)0から始まるぜ(^~^)
	OffsetMovesIndex int
	// 指し手のリスト(^~^)
	// 1手目は[0]へ、512手目は[511]へ入れろだぜ(^~^)
	Moves [MOVES_SIZE]Move
	// 取った駒のリスト(^~^)アンドゥ ムーブするときに使うだけ(^~^)指し手のリストと同じ添え字を使うぜ(^~^)
	CapturedList [MOVES_SIZE]string
}

Position - 局面

func NewPosition

func NewPosition() *Position

func (*Position) AddControl

func (pPos *Position) AddControl(from Square, sign int8)

AddControl - 盤上のマスを指定することで、そこにある駒の利きを増減させます

func (*Position) AddControlAllSlidingPiece

func (pPos *Position) AddControlAllSlidingPiece(sign int8)

AddControlAllSlidingPiece - すべての長い利きの駒の利きを増減させます

func (*Position) DoMove

func (pPos *Position) DoMove(move Move)

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

func (*Position) Hetero

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

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

func (*Position) Homo

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

Homo - 手番と移動元の駒を持つプレイヤーが等しければ真。移動先が空なら偽

func (*Position) IsEmptySq

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

func (*Position) ReadPosition

func (pPos *Position) ReadPosition(command string)

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

func (*Position) ResetToStartpos

func (pPos *Position) ResetToStartpos()

ResetToStartpos - 初期局面にします。

func (*Position) Sprint

func (pPos *Position) Sprint() string

Print - 局面出力(^q^)

func (*Position) SprintControl

func (pPos *Position) SprintControl(phase Phase) string

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

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

func Rank

func Rank(sq Square) Square

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

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