dice

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeepHighestRolls

func KeepHighestRolls(h int, rs []int) []int

func KeepLowestRolls

func KeepLowestRolls(l int, rs []int) []int

func MultiRolls

func MultiRolls(n, d int) []int

func Roll

func Roll(d int) int

func explodes(d int, m map[int]struct{}) []int {

	r := Roll(d)
	rolls := make([]int, 0)
	rolls = append(rolls, r)
	if _, ok := m[r]; ok {

	}
	return rolls
}

func RollExplodes

func RollExplodes(d int, e []int) []int

RollExplodes keeps rerolling until not hitting an explode die number

func SumRolls

func SumRolls(r []int) int

Types

type DiceInfo

type DiceInfo struct {
	NumberOfDice int
	TypeOfDice   int
	HighRoll     bool
	LowRoll      bool
	KeepDice     int
	Explodes     bool
	ExplodesOn   []int
}

DiceInfo contains the information about a roll

func ParseRollString

func ParseRollString(s string) DiceInfo

ParseRollString parses a string of roll info into a DiceInfo's fields

func (*DiceInfo) RollDice

func (d *DiceInfo) RollDice() []int

Roll base on the information of DiceInfo

Jump to

Keyboard shortcuts

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