model

package module
v0.0.0-...-0bd4be2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

C3S15GoModel

介绍

三炮十五兵Go语言版数学模型部分。 因为Go语言的GUI没有官方实现,GUI目前打算用fyne和lxn/walk两种方式来实现,数学模型部分是相同的,所以抽出来作为公用的子项目。

软件架构

软件架构说明

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInRange

func AllInRange(values ...int) bool

AllInRange 判断是否所有数值都在0..4的范围内,若全对,返回true。

func CancelAiRoutine

func CancelAiRoutine()

func IndexToXY

func IndexToXY(index int) (x int, y int)

IndexToXY 25内的序号转换为5x5纵横坐标。

func PlayerTypeText

func PlayerTypeText(playerType PlayerType) string

func SetOnAiProgress

func SetOnAiProgress(f func())

func XyToIndex

func XyToIndex(x int, y int) int

XyToIndex 5x5纵横坐标转换为25内的序号。

Types

type AppConfigStruct

type AppConfigStruct struct {
	AppTitle            string     `yaml:"app_title" json:"app_title"`
	SoldierText         string     `yaml:"soldier_text" json:"soldier_text,omitempty"`
	CannonText          string     `yaml:"cannon_text" json:"cannon_text,omitempty"`
	SoldierPlayType     PlayerType `yaml:"soldier_play_type" json:"soldier_play_type"`
	CannonPlayType      PlayerType `yaml:"cannon_play_type" json:"cannon_play_type"`
	AiDepth             int        `yaml:"ai_depth" json:"ai_depth,omitempty"`
	PlayerTypeHumanText string     `yaml:"player_type_human_text" json:"player_type_human_text"`
	PlayerTypeAIText    string     `yaml:"player_type_ai_text" json:"player_type_ai_text"`
	PlayerTypeNetText   string     `yaml:"player_type_net_text" json:"player_type_net_text"`
}
var AppConfig AppConfigStruct

type Chess

type Chess interface {
	Type() ChessType
	SetType(chessType ChessType)
	Text() string
	Color() color.Color
	Visible() bool
}

func NewChess

func NewChess(chessType ChessType) Chess

type ChessType

type ChessType int
const (
	ChessTypeEmpty ChessType = iota
	ChessTypeCannon
	ChessTypeSoldier
)

func (ChessType) PlayerType

func (chessType ChessType) PlayerType() PlayerType

func (ChessType) Text

func (chessType ChessType) Text() string

type Move

type Move interface {
	From() int
	To() int
	FromXY() (x int, y int)
	ToXY() (x int, y int)

	IsValid(scene Scene) bool
}

func NewMove

func NewMove(from int, to int) Move

func NewMoveByXY

func NewMoveByXY(fromX int, fromY int, toX int, toY int) Move

type PlayerType

type PlayerType int
const (
	PlayerTypeHuman PlayerType = iota
	PlayerTypeAI
	PlayerTypeNet
)

type Scene

type Scene interface {
	ChessList() [25]Chess
	LastMove() Move
	MoveCount() int
	MovingSide() ChessType
	Clone() Scene

	SetInitialContent()
	OnChange()
	SetOnChange(func(scene Scene))
	ApplyMove(move Move)

	GameOver() bool

	SceneStatusInfo() string
	// contains filtered or unexported methods
}

func NewScene

func NewScene() Scene

Jump to

Keyboard shortcuts

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