-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nim
54 lines (38 loc) · 1.24 KB
/
main.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Nota do programador:
# Desculpa pela bagunça por aqui
# sou melhor criando funções do que interfaces
import std/strutils, std/strformat, colorize, roll
echo """
<>==========================<>
|| ____ ||
|| /\' .\ _____ ||
|| /: \___\ / . /\ ||
|| \' / . / Happy /____/..\ ||
|| \/___/ Dices \' '\ / ||
|| \'__'\/ ||
|| ||
|| Made with ♥ in: Nim ||
|| ||
|| By: 1MarcosDev ||
<>==========================<>
""".fgLightCyan
echo "Roll your dices, and put your choices in the hands of the universe!".underline.fgMagenta
echo "or press 'q' to quit...".fgCyan
let invalid = AllChars - Digits - {'d', 'q', '+'}
while true:
stdout.write "\nYour dice: ".fgGreen
var input: string = stdin.readLine()
if input == "d":
input = "?"
if input == "q" or input == " ":
break
if input.find(invalid) == -1:
let res: seq[int] = input.roll
var total: int = 0
stdout.write "Your dices is: ".fgLightRed
for d in res:
total += d
stdout.write fmt"[{d}] ".fgLightMagenta
echo fmt"Totalizing: {total + readSum(input)}".fgLightBlue
else:
echo "Invalid input".underline.fgRed