fix: 修复point util不能处理pass的问题。

main v1.3.5
NoahLan 11 months ago
parent fc7a527188
commit 5420a6e4dc

@ -11,7 +11,7 @@ const alphaUpper = "ABCDEFGHJKLMNOPQRSTUVWXYZ"
func Point(x, y int) string { func Point(x, y int) string {
if x < 0 || x >= 25 || y < 0 || y >= 25 { if x < 0 || x >= 25 || y < 0 || y >= 25 {
return "" return "PASS"
} }
return fmt.Sprintf("%s%d", byteToString(alphaUpper[x]), y+1) return fmt.Sprintf("%s%d", byteToString(alphaUpper[x]), y+1)
} }
@ -21,6 +21,9 @@ func byteToString(b byte) string {
} }
func ParsePoint(pos string) (x, y int) { func ParsePoint(pos string) (x, y int) {
if strings.ToUpper(pos) == "PASS" {
return 255, 255
}
x = byteToIndex(alpha, pos[0]) x = byteToIndex(alpha, pos[0])
if x == -1 { if x == -1 {
x = byteToIndex(alphaUpper, pos[0]) x = byteToIndex(alphaUpper, pos[0])

Loading…
Cancel
Save