Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DIR = [][]int{{0, 1}, {1, 0}, {1, 1}, {0, -1}, {-1, 0}, {-1, -1}, {-1, 1}, {1, -1}}
Functions ¶
Types ¶
type ChessMove ¶
type ChessMove struct { Start int `json:"start,omitempty"` End int `json:"end,omitempty"` Obstacle int `json:"obstacle,omitempty"` }
func NewChessMove ¶ added in v1.0.3
type Game ¶
type Game struct { CurrentPlayer int `json:"current_player,omitempty"` CurrentState *State `json:"current_state,omitempty"` Winner int `json:"winner,omitempty"` Ai1Handler func(*State) ChessMove `json:"ai_1_handler,omitempty"` Ai2Handler func(*State) ChessMove `json:"ai_2_handler,omitempty"` }
func (*Game) LogGenerate ¶
type Log ¶
type Log struct { GameState State `json:"game_state"` Status int `json:"status"` Winner int `json:"winner"` }
Log @Param GameState 棋盘状态 @Param status 记录类型 0:未结束 1:已结束 @Param winner 胜利方 (1、-1)
type State ¶
type State struct { Board []int `json:"board,omitempty"` CurrentPlayer int `json:"current_player,omitempty"` }
func (*State) GetActionSpace ¶
GetActionSpace get action space of diffrent direction by a loc
func (*State) PrintState ¶
func (s *State) PrintState()
func (*State) RandomMove ¶ added in v1.0.3
Click to show internal directories.
Click to hide internal directories.