dice

package
v0.0.0-...-7dafa0e Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiceParserListener

type DiceParserListener struct {
	fp.BaseDiceListener
	// contains filtered or unexported fields
}

func (*DiceParserListener) EnterCount

func (s *DiceParserListener) EnterCount(ctx *fp.CountContext)

func (*DiceParserListener) EnterModifier

func (s *DiceParserListener) EnterModifier(ctx *fp.ModifierContext)

func (*DiceParserListener) EnterNotation

func (s *DiceParserListener) EnterNotation(_ *fp.NotationContext)

func (*DiceParserListener) EnterSides

func (s *DiceParserListener) EnterSides(ctx *fp.SidesContext)

type Formula

type Formula string

type ListenerError

type ListenerError struct {
	antlr.ErrorListener
}

type Parser

type Parser interface {
	Parse(f Formula) (Rollable, error)
}

func New

func New() Parser

type Rollable

type Rollable interface {
	String() string
	Roll() int
}

func Parse

func Parse(f Formula) (r Rollable, err error)

type RollableDice

type RollableDice struct {
	Num      int
	Sides    int
	Modifier int
}

func (RollableDice) Roll

func (r RollableDice) Roll() (result int)

func (RollableDice) String

func (r RollableDice) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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