Fix bearing off checkers in the appropriate order
This commit is contained in:
parent
bd16c4bfc5
commit
c231f19959
5 changed files with 46 additions and 8 deletions
2
game.go
2
game.go
|
@ -587,7 +587,7 @@ func (g *Game) LegalMoves(local bool) [][]int8 {
|
|||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
if !found && b.HaveRoll(available[i][j][0], available[i][j][1], g.Turn) {
|
||||
moves = append(moves, []int8{available[i][j][0], available[i][j][1]})
|
||||
}
|
||||
}
|
||||
|
|
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ go 1.17
|
|||
|
||||
require (
|
||||
code.rocket9labs.com/tslocum/gotext v0.0.0-20240728181248-46f419ff143b
|
||||
code.rocket9labs.com/tslocum/tabula v0.0.0-20240703054156-ce0b448f0999
|
||||
code.rocket9labs.com/tslocum/tabula v0.0.0-20240820025521-91065b63f1be
|
||||
github.com/alexedwards/argon2id v1.0.0
|
||||
github.com/coder/websocket v1.8.12
|
||||
github.com/gorilla/mux v1.8.1
|
||||
|
|
4
go.sum
4
go.sum
|
@ -2,8 +2,8 @@ code.rocket9labs.com/tslocum/bei v0.0.0-20240108012722-6db380cc190b h1:Y0a14Kf/h
|
|||
code.rocket9labs.com/tslocum/bei v0.0.0-20240108012722-6db380cc190b/go.mod h1:tS60/VNAJphKvDBkSLQhKALa15msIAuWWfEKNc4oFZc=
|
||||
code.rocket9labs.com/tslocum/gotext v0.0.0-20240728181248-46f419ff143b h1:KSdR7VPoftY5Bt+osGRBbtHlCWxhe1QbOuf58CG7ieI=
|
||||
code.rocket9labs.com/tslocum/gotext v0.0.0-20240728181248-46f419ff143b/go.mod h1:ZkYZ/IF/ebzhUL2bNp4ALROsuH9iCztUWvUJBWsHXRU=
|
||||
code.rocket9labs.com/tslocum/tabula v0.0.0-20240703054156-ce0b448f0999 h1:PwfoDBtxVT3TwL2KpoijPKi6NQsGu6cXhPVoQeqKJWM=
|
||||
code.rocket9labs.com/tslocum/tabula v0.0.0-20240703054156-ce0b448f0999/go.mod h1:WEJXESKXqrMFLAArikQ79lpRibNeeE1C0VruxXYMF5M=
|
||||
code.rocket9labs.com/tslocum/tabula v0.0.0-20240820025521-91065b63f1be h1:awgpl3vS+d7vciw7X5z+joGSPZHB1OOTpkPKW3mPGDs=
|
||||
code.rocket9labs.com/tslocum/tabula v0.0.0-20240820025521-91065b63f1be/go.mod h1:WEJXESKXqrMFLAArikQ79lpRibNeeE1C0VruxXYMF5M=
|
||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
||||
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||
|
|
|
@ -238,6 +238,7 @@ func (c *serverClient) Terminate(reason string) {
|
|||
func logClientRead(msg []byte) {
|
||||
msgLower := bytes.ToLower(msg)
|
||||
loginJSON := bytes.HasPrefix(msgLower, []byte("loginjson ")) || bytes.HasPrefix(msgLower, []byte("lj "))
|
||||
registerJSON := bytes.HasPrefix(msgLower, []byte("registerjson ")) || bytes.HasPrefix(msgLower, []byte("rj "))
|
||||
if bytes.HasPrefix(msgLower, []byte("login ")) || bytes.HasPrefix(msgLower, []byte("l ")) || loginJSON {
|
||||
split := bytes.Split(msg, []byte(" "))
|
||||
var clientName []byte
|
||||
|
@ -267,6 +268,43 @@ func logClientRead(msg []byte) {
|
|||
clientName = []byte("unspecified")
|
||||
}
|
||||
log.Printf("<- %s %s %s %s", split[0], clientName, username, password)
|
||||
} else if bytes.HasPrefix(msgLower, []byte("register ")) || registerJSON {
|
||||
split := bytes.Split(msg, []byte(" "))
|
||||
var clientName []byte
|
||||
var email []byte
|
||||
var username []byte
|
||||
var password []byte
|
||||
l := len(split)
|
||||
if l > 1 {
|
||||
if registerJSON {
|
||||
clientName = split[1]
|
||||
} else {
|
||||
email = []byte("*******")
|
||||
}
|
||||
if l > 2 {
|
||||
if registerJSON {
|
||||
email = []byte("*******")
|
||||
} else {
|
||||
username = split[2]
|
||||
}
|
||||
if l > 3 {
|
||||
if registerJSON {
|
||||
username = split[3]
|
||||
} else {
|
||||
password = []byte("*******")
|
||||
}
|
||||
if l > 4 {
|
||||
if registerJSON {
|
||||
password = []byte("*******")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(clientName) == 0 {
|
||||
clientName = []byte("unspecified")
|
||||
}
|
||||
log.Printf("<- %s %s %s %s %s", split[0], clientName, email, username, password)
|
||||
} else if !bytes.HasPrefix(msgLower, []byte("list")) && !bytes.HasPrefix(msgLower, []byte("ls")) && !bytes.HasPrefix(msgLower, []byte("pong")) {
|
||||
log.Printf("<- %s", msg)
|
||||
}
|
||||
|
|
|
@ -1358,14 +1358,14 @@ COMMANDS:
|
|||
continue
|
||||
}
|
||||
|
||||
clientGame.Turn = 2
|
||||
clientGame.Roll1 = 4
|
||||
clientGame.Roll2 = 6
|
||||
clientGame.Turn = 1
|
||||
clientGame.Roll1 = 3
|
||||
clientGame.Roll2 = 3
|
||||
clientGame.Roll3 = 0
|
||||
clientGame.Variant = 0
|
||||
clientGame.Player1.Entered = true
|
||||
clientGame.Player2.Entered = true
|
||||
clientGame.Board = []int8{0, 0, 2, 2, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 1, -3, 1, 0, -3, -6, -2, 0, 0, 0}
|
||||
clientGame.Board = []int8{0, 0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -3, 0, 0, -3, -6, -2, 0, 0, 0}
|
||||
|
||||
log.Println(clientGame.Board[0:28])
|
||||
|
||||
|
|
Loading…
Reference in a new issue