diff options
-rw-r--r-- | sd.go | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -11,6 +11,7 @@ import ( _ "modernc.org/sqlite" ) +var verbose = flag.Bool("v", false, "debug output") var file = flag.String("f", "cards", "cards file") var sum = 0 @@ -76,6 +77,11 @@ func main() { build(rows, 0, N-1, 1) rows.Close() + if *verbose { + fmt.Println(N) + fmt.Println(seg) + } + // https://stackoverflow.com/questions/14094190/function-similar-to-getchar // disable input buffering exec.Command("stty", "-F", "/dev/tty", "cbreak", "min", "1").Run() @@ -87,8 +93,10 @@ func main() { for { // Choose a random card x := rand.Intn(sum) - fmt.Println(sum) - fmt.Println(x) + if *verbose { + fmt.Println(sum) + fmt.Println(x) + } w, i := query(x, 0, N-1, 1) fmt.Println(w) fmt.Println(i) |