diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7270fec --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dice-roller diff --git a/dice-roller b/dice-roller deleted file mode 100755 index 7194dc5..0000000 Binary files a/dice-roller and /dev/null differ diff --git a/main.go b/main.go index c10bcc9..f18e024 100644 --- a/main.go +++ b/main.go @@ -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) }