mirror of
https://gitlab.com/EternalWanderer/dice-roller.git
synced 2024-11-28 21:03:51 +01:00
Cleaned up clode and removed binary
This commit is contained in:
parent
943b758c5c
commit
3803b90fc0
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
dice-roller
|
BIN
dice-roller
BIN
dice-roller
Binary file not shown.
23
main.go
23
main.go
|
@ -10,21 +10,14 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
var surfaces, throws int
|
var surfaces, throws int
|
||||||
rand.Seed(time.Now().Unix())
|
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.")
|
flag.IntVar(&surfaces, "s", 20, "Specify amount of die surfaces")
|
||||||
// fmt.Scanf("%d %d", &surfaces, &throws)
|
|
||||||
flag.IntVar(&surfaces, "s", 20, "Specify die type")
|
|
||||||
flag.IntVar(&throws, "t", 1, "Specify dice throws")
|
flag.IntVar(&throws, "t", 1, "Specify dice throws")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
fmt.Println(surfaces)
|
Cast(surfaces, throws)
|
||||||
fmt.Println(throws)
|
|
||||||
fmt.Println(Cast(surfaces, throws))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Cast(dieSurfaces, castAmount int) int {
|
func Cast(dieSurfaces, castAmount int) {
|
||||||
fmt.Println(dieSurfaces)
|
|
||||||
fmt.Println(castAmount)
|
|
||||||
var (
|
var (
|
||||||
casts []int
|
casts []int
|
||||||
cast, total int
|
cast, total int
|
||||||
|
@ -35,6 +28,10 @@ func Cast(dieSurfaces, castAmount int) int {
|
||||||
casts = append(casts, cast)
|
casts = append(casts, cast)
|
||||||
total += cast
|
total += cast
|
||||||
}
|
}
|
||||||
fmt.Println(casts)
|
|
||||||
return total
|
if castAmount > 1 {
|
||||||
|
fmt.Println(casts)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(total)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue