dice

package
v0.0.0-...-19a34af Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPointIndex = 25

根据人数分配骰子 1: 玩家1 2: 玩家2 3: 玩家3 4: 玩家4 5: 玩家5

Variables

This section is empty.

Functions

func Roll

func Roll() int

Types

type Context

type Context struct {
	NumOfDice1   int
	NumOfDice2   int
	NumOfDice3   int
	NumOfDice4   int
	NumOfDice5   int
	NumOfDice6   int
	LastCallDice string

	IsLastNum bool //自己叫的点数,是否是桌面上的最后点数

	Opts   *protocol.DeskOptions
	DeskNo string
	Uid    int64
}

func (*Context) Reset

func (c *Context) Reset()

func (*Context) String

func (c *Context) String() string

type Dice

type Dice []*Point

func FromID

func FromID(ids []int) Dice

func (Dice) Ids

func (d Dice) Ids() []int

func (Dice) Indexes

func (d Dice) Indexes() []int

func (Dice) Len

func (d Dice) Len() int

func (Dice) Less

func (d Dice) Less(i, j int) bool

func (Dice) Shuffle

func (d Dice) Shuffle()

func (Dice) Sort

func (d Dice) Sort()

func (Dice) Swap

func (d Dice) Swap(i, j int)

type Point

type Point struct {
	Id    int
	Rank  int // 点数
	Index int // 索引(1~5)
}

func PointFromID

func PointFromID(id int) *Point

func PointFromIndex

func PointFromIndex(idx int) *Point

type Points

type Points []int //游戏内部表示(总共25个骰子)

func New

func New(count int) Points

type Result

type Result []int

func (Result) String

func (res Result) String() string

Jump to

Keyboard shortcuts

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