bgammon-gnubg-bot/main.go

41 lines
839 B
Go

package main
import (
"flag"
"os"
)
func main() {
var (
serverAddress string
username string
password string
points int
)
flag.StringVar(&serverAddress, "address", "bgammon.org:1337", "Server address")
flag.StringVar(&username, "username", "", "Username")
flag.StringVar(&password, "password", "", "Password")
flag.IntVar(&points, "points", 1, "Match points")
flag.Parse()
if password == "" {
password = os.Getenv("BOT_PASSWORD")
}
//moves, err := parseMoves([]byte("10/off(2) 7/2(2)"))
/*g := bgammon.NewGame(bgammon.VariantBackgammon)
for i := range g.Board {
g.Board[i] = 0
}
g.Board[1] = 1
g.Board[24] = -1
g.Turn = 2
g.DoublePlayer = 2
g.DoubleOffered = true
log.Fatal(analyze(g))*/
c := newClient(serverAddress, username, password, points)
go c.Connect()
c.handleEvents()
}