12345678910111213141516171819202122232425262728293031 |
- package main
- import "fmt"
- func main() {
- D, err := NewDiceFromString("3D")
- if err != nil {
- fmt.Println("Err:", err)
- return
- }
- var (
- total int
- )
- t, w, r := D.Roll()
- total += t
- total += w
- fmt.Printf("Rolled: %d %v\n", t, r)
- fmt.Printf("Wild: %d\n", w)
- if w == 6 {
- for {
- _, w, _ := D.Roll()
- fmt.Printf("Wild: %d\n", w)
- if w == 6 {
- total += w
- } else {
- break
- }
- }
- }
- fmt.Printf("Final: %d\n", total)
- }
|