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() {
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue