From a3307cfac80b2932b7665a1a6aa812f6e34a6b9a Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 30 Jan 2017 13:22:03 +0100 Subject: dices: use fancy dice runes only if explicit specified --- logic/dices.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'logic') diff --git a/logic/dices.go b/logic/dices.go index 43dca22..bab1248 100644 --- a/logic/dices.go +++ b/logic/dices.go @@ -8,6 +8,12 @@ import ( ) var diceRunes = [7]string{"", "\u2680", "\u2681", "\u2682", "\u2683", "\u2684", "\u2685"} +var fancy = false + +func SetFancyPrint(f bool) { + fancy = f +} + type Dices [5]int @@ -28,7 +34,11 @@ func (d *Dices) Roll(i []int) error { func (d Dices) String() string { s := "" for _, v := range d { - s += diceRunes[v] + " " + if fancy { + s += diceRunes[v] + " " + } else { + s += fmt.Sprintf("%d ", v) + } } return fmt.Sprintf("%s", s) } -- cgit v1.2.3