Skip to content

darkliquid/roll

Repository files navigation

Roll Go Report Card License GoDoc Build Status

A simple dice roll parsing engine that (mostly) supports the Roll20 Dice Rolling Language Specification

Usage

package main

import (
	"fmt"
	"math/rand"
	"os"
	"time"

	"github.com/darkliquid/roll"
)

func main() {
	rand.Seed(time.Now().UnixNano())
	out, err := roll.Parse(os.Stdin)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}
	fmt.Println(out)
}

then run echo '3d6+1' | go run main.go to get some output like:

Rolled "3d6+1" and got 6, 6, 4 for a total of 17

About

A simple dice roll parsing engine

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages