From b3664645e2f7d8a68fb718ac9b3d45cf73dc6dd4 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Sat, 23 Dec 2023 00:49:35 -0800 Subject: [PATCH] Add verbose flag --- analysis.go | 2 ++ bei.go | 9 +++++++++ cmd/tabula/main.go | 1 + 3 files changed, 12 insertions(+) diff --git a/analysis.go b/analysis.go index 8da4e8b..4f1ac88 100644 --- a/analysis.go +++ b/analysis.go @@ -6,6 +6,8 @@ import ( "sync" ) +var Verbose bool + var QueueBufferSize = 4096000 var ( diff --git a/bei.go b/bei.go index c0d6b5e..5897b78 100644 --- a/bei.go +++ b/bei.go @@ -174,5 +174,14 @@ func parseState(buf []byte) (Board, error) { b[SpaceEnteredOpponent] = 0 } } + + if Verbose { + var logMessage []byte + for _, v := range b { + logMessage = append(logMessage, []byte(fmt.Sprintf("%4d", int(v)))...) + } + log.Println(string(logMessage)) + } + return b, nil } diff --git a/cmd/tabula/main.go b/cmd/tabula/main.go index c4131ea..cc32200 100644 --- a/cmd/tabula/main.go +++ b/cmd/tabula/main.go @@ -13,6 +13,7 @@ func main() { var pips bool flag.StringVar(&address, "address", "", "Listen for BEI connections on specified address (TCP)") flag.BoolVar(&pips, "pips", false, "Print table of pseudopip values") + flag.BoolVar(&tabula.Verbose, "verbose", false, "Print state of each request") flag.Parse() if pips {