Cleaned up clode and removed binary

This commit is contained in:
Nox Sluijtman 2021-08-23 23:19:01 +02:00
parent 943b758c5c
commit 3803b90fc0
3 changed files with 11 additions and 13 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
dice-roller

Binary file not shown.

23
main.go
View file

@ -10,21 +10,14 @@ import (
func main() {
var surfaces, throws int
rand.Seed(time.Now().Unix())
// fmt.Println("Half arsed version without error checking.")
// fmt.Println("Please insert number of die surfaces followed by amount of dice thrown.")
// fmt.Scanf("%d %d", &surfaces, &throws)
flag.IntVar(&surfaces, "s", 20, "Specify die type")
flag.IntVar(&surfaces, "s", 20, "Specify amount of die surfaces")
flag.IntVar(&throws, "t", 1, "Specify dice throws")
flag.Parse()
fmt.Println(surfaces)
fmt.Println(throws)
fmt.Println(Cast(surfaces, throws))
Cast(surfaces, throws)
}
func Cast(dieSurfaces, castAmount int) int {
fmt.Println(dieSurfaces)
fmt.Println(castAmount)
func Cast(dieSurfaces, castAmount int) {
var (
casts []int
cast, total int
@ -35,6 +28,10 @@ func Cast(dieSurfaces, castAmount int) int {
casts = append(casts, cast)
total += cast
}
fmt.Println(casts)
return total
if castAmount > 1 {
fmt.Println(casts)
}
fmt.Println(total)
}