1
0
mirror of https://github.com/maaslalani/gambit.git synced 2024-11-24 08:22:12 +02:00

doc: fen.IsValid

This commit is contained in:
Maas Lalani 2022-02-06 23:03:13 -05:00
parent f476062edb
commit 2d761df009
No known key found for this signature in database
GPG Key ID: 5A6ED5CBF1A0A000

View File

@ -8,6 +8,7 @@ import (
var fenRegex = regexp.MustCompile(`\s*([rnbqkpRNBQKP1-8]+\/){7}([rnbqkpRNBQKP1-8]+)\s[bw-]\s(([a-hkqA-HKQ]{1,4})|(-))\s(([a-h][36])|(-))\s\d+\s\d+\s*`) var fenRegex = regexp.MustCompile(`\s*([rnbqkpRNBQKP1-8]+\/){7}([rnbqkpRNBQKP1-8]+)\s[bw-]\s(([a-hkqA-HKQ]{1,4})|(-))\s(([a-h][36])|(-))\s\d+\s\d+\s*`)
// IsValid returns whether a FEN string is valid by checking a naive regular expression
func IsValid(fen string) bool { func IsValid(fen string) bool {
return fenRegex.MatchString(fen) return fenRegex.MatchString(fen)
} }