From 3bbc28806f43c323b21d9053a9e25c89614d5f60 Mon Sep 17 00:00:00 2001 From: Nikolaus Gotsche Date: Tue, 23 Oct 2018 11:43:26 +0200 Subject: Frames and Timedebug --- utils.go | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'utils.go') diff --git a/utils.go b/utils.go index 9d6fc91..bed36aa 100644 --- a/utils.go +++ b/utils.go @@ -10,17 +10,38 @@ import ( "strconv" "strings" "unicode/utf8" + "math/rand" + "time" ) const ( framewidth int = 40 - li = "\u2501" - mli = "\u2501\u252f\u2501\u2501" //Masterline -T- - sli = " \u251c\u2500 " //Slave Line L_ - nli = " \u2502 " //noone Line | - fli = " \u2515\u2501\u2501" //Footer Line L + li string = "\u2500" + mli string = "\u2500\u2530\u2500\u2500" //Masterline -T- + sli string = " \u2520\u2500 " //Slave Line L_ + nli string = " \u2503 " //noone Line | + fli string = " \u2516\u2500\u2500" //Footer Line L ) +var positive = [...]string {"Done","Accomplished","Finished","Congrats","Completed"} +var negative = [...]string {"Failed","Try Again","Sorry","Not Quite Yet","Incomplete"} + +func posR() (out string){ + s1 := rand.NewSource(time.Now().UnixNano()) + r1 := rand.New(s1) + n := r1.Intn(len(positive)) + out = positive[n] + return +} + +func negR() (out string){ + s1 := rand.NewSource(time.Now().UnixNano()) + r1 := rand.New(s1) + n := r1.Intn(len(negative)) + out = negative[n] + return +} + func frame(text string, head bool) (out string) { if head { out = mli + text @@ -36,8 +57,8 @@ func frame(text string, head bool) (out string) { } if head { out = "\n" + out - }else{ - out = out + "\n" + //}else{ + // out = out + "\n" } return } -- cgit v1.2.3