Help us shape the future of Go! Take the 2026 Go Developer Survey

yacht

package module
v0.0.0-...-eabcb74 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 5 Imported by: 0

README

Yacht

Documentation

Index

Constants

View Source
const (
	NumberOfYakuType = 12
)

Variables

View Source
var (
	DiceEmojiMap = map[int]string{
		1: "⚀",
		2: "⚁",
		3: "⚂",
		4: "⚃",
		5: "⚄",
		6: "⚅",
	}
)

Functions

func Ace

func Ace(dices []int) int

任意の組み合わせ(1の目の合計)

func BigStraight

func BigStraight(dices []int) int

5つの目が連続している(30点)

func Choice

func Choice(dices []int) int

任意の組み合わせ(すべての目の合計)

func Fives

func Fives(dices []int) int

任意の組み合わせ(5の目の合計)

func FourOfAKind

func FourOfAKind(dices []int) int

同じ目を4つ以上揃える(すべての目の合計)

func Fours

func Fours(dices []int) int

任意の組み合わせ(4の目の合計)

func FullHouse

func FullHouse(dices []int) int

3つの同じ目と2つの同じ目を揃える(すべての目の合計)

func LittleStraight

func LittleStraight(dices []int) int

4つ以上の目が連続している(15点)

func Sixes

func Sixes(dices []int) int

任意の組み合わせ(6の目の合計)

func Threes

func Threes(dices []int) int

任意の組み合わせ(3の目の合計)

func Twos

func Twos(dices []int) int

任意の組み合わせ(2の目の合計)

func Yacht

func Yacht(dices []int) int

5つの目がすべて同じ(50点)

Types

type Dice

type Dice struct {
	Number int
	Emoji  string
	Status DiceStatus
}

func NewDice

func NewDice() *Dice

func (*Dice) Roll

func (d *Dice) Roll()

type DiceBox

type DiceBox struct {
	Dices       Dices
	RolledTimes int
}

func NewDiceBox

func NewDiceBox(num int) *DiceBox

func (*DiceBox) Pick

func (db *DiceBox) Pick(ids []int)

func (DiceBox) PickedNum

func (db DiceBox) PickedNum() int

func (DiceBox) ReadyNum

func (db DiceBox) ReadyNum() int

func (*DiceBox) Roll

func (db *DiceBox) Roll()

func (DiceBox) RolledNum

func (db DiceBox) RolledNum() int

type DiceStatus

type DiceStatus int
const (
	DiceStatusReady DiceStatus = iota
	DiceStatusRolled
	DiceStatusPicked
)

type Dices

type Dices []*Dice

func (Dices) Clear

func (ds Dices) Clear()

Pick以外のサイコロをReadyに戻す

func (Dices) Picked

func (ds Dices) Picked() []int

func (Dices) Picks

func (ds Dices) Picks(numbers []int)

func (Dices) Readied

func (ds Dices) Readied() []int

func (Dices) Rolled

func (ds Dices) Rolled() []int

func (Dices) Rolls

func (ds Dices) Rolls()

type Game

type Game struct {
	Players *Players
	Turn    *Turn
	MaxTurn int
}

func NewGame

func NewGame(ps *Players) *Game

func (*Game) IsEnded

func (g *Game) IsEnded() bool

func (*Game) NextTurn

func (g *Game) NextTurn() (*Turn, error)

func (*Game) RemainTurn

func (g *Game) RemainTurn() int

type Phase

type Phase struct {
	Type    PhaseType
	DiceBox *DiceBox
}

func NewPhase

func NewPhase() *Phase

func (*Phase) CanMovePickPhase

func (p *Phase) CanMovePickPhase() bool

func (*Phase) CanMoveRollPhase

func (p *Phase) CanMoveRollPhase() bool

func (*Phase) CanMoveScoringPhase

func (p *Phase) CanMoveScoringPhase() bool

func (*Phase) MoveEndPhase

func (p *Phase) MoveEndPhase()

func (*Phase) MovePickPhase

func (p *Phase) MovePickPhase()

func (*Phase) MoveRollPhase

func (p *Phase) MoveRollPhase()

func (*Phase) MoveScoringPhase

func (p *Phase) MoveScoringPhase()

func (*Phase) Next

func (p *Phase) Next() error

type PhaseType

type PhaseType int
const (
	PhaseTypeStandby PhaseType = iota
	PhaseTypeRoll
	PhaseTypePick
	PhaseTypeScoring
	PhaseTypeEnd
)

type Player

type Player struct {
	Name  string
	Order int
	Score *Score
}

func NewPlayer

func NewPlayer(name string) *Player

type Players

type Players struct {
	Players   []*Player
	Current   int
	AllPlayer int
}

func NewPlayers

func NewPlayers() *Players

func (*Players) Add

func (ps *Players) Add(p *Player)

func (*Players) First

func (ps *Players) First() *Player

func (*Players) Next

func (ps *Players) Next() *Player

func (*Players) Shuffle

func (ps *Players) Shuffle()

type Score

type Score struct {
	Ace            int
	Twos           int
	Threes         int
	Fours          int
	Fives          int
	Sixes          int
	Choice         int
	FourOfAKind    int
	FullHouse      int
	LittleStraight int
	BigStraight    int
	Yacht          int

	IsFilledAce            bool
	IsFilledTwos           bool
	IsFilledThrees         bool
	IsFilledFours          bool
	IsFilledFives          bool
	IsFilledSixes          bool
	IsFilledChoice         bool
	IsFilledFourOfAKind    bool
	IsFilledFullHouse      bool
	IsFilledLittleStraight bool
	IsFilledBigStraight    bool
	IsFilledYacht          bool
}

func NewScore

func NewScore() *Score

func (*Score) Fill

func (s *Score) Fill(yaku string, point int) error

func (*Score) FillAce

func (s *Score) FillAce(point int) error

func (*Score) FillBigStraight

func (s *Score) FillBigStraight(point int) error

func (*Score) FillChoice

func (s *Score) FillChoice(point int) error

func (*Score) FillFives

func (s *Score) FillFives(point int) error

func (*Score) FillFourOfAKind

func (s *Score) FillFourOfAKind(point int) error

func (*Score) FillFours

func (s *Score) FillFours(point int) error

func (*Score) FillFullHouse

func (s *Score) FillFullHouse(point int) error

func (*Score) FillLittleStraight

func (s *Score) FillLittleStraight(point int) error

func (*Score) FillSixes

func (s *Score) FillSixes(point int) error

func (*Score) FillThrees

func (s *Score) FillThrees(point int) error

func (*Score) FillTwos

func (s *Score) FillTwos(point int) error

func (*Score) FillYacht

func (s *Score) FillYacht(point int) error

func (*Score) FillableMap

func (s *Score) FillableMap() map[string]bool

func (*Score) IsFilledAll

func (s *Score) IsFilledAll() bool

func (*Score) Point

func (s *Score) Point() int

type Turn

type Turn struct {
	Current int
	Player  *Player
	Phase   *Phase
	DiceBox *DiceBox
}

func NewTurn

func NewTurn(player *Player, current int) *Turn

func (*Turn) IsEnded

func (t *Turn) IsEnded() bool

type Yaku

type Yaku struct {
	Ace            int
	Twos           int
	Threes         int
	Fours          int
	Fives          int
	Sixes          int
	Choice         int
	FourOfAKind    int
	FullHouse      int
	LittleStraight int
	BigStraight    int
	Yacht          int
}

func (*Yaku) Calculate

func (y *Yaku) Calculate(dices []int)

func (*Yaku) ToMap

func (y *Yaku) ToMap() map[string]int

Directories

Path Synopsis
cmd
yacht command

Jump to

Keyboard shortcuts

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