mirror of
https://github.com/maaslalani/gambit.git
synced 2024-11-28 08:38:36 +02:00
doc: fen.IsValid
This commit is contained in:
parent
f476062edb
commit
2d761df009
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user