mchess-server/chess/violation.go

19 lines
625 B
Go
Raw Normal View History

2023-07-11 20:28:07 +00:00
package chess
type Violation string
var (
InvalidMove Violation = "invalid move"
NoPieceAtStartSquare Violation = "no piece at start square"
WrongColorMoved Violation = "wrong color moved"
TargetSquareIsOccupied Violation = "target square is occupied"
KingInCheck Violation = "king would be in check after move"
SomethingWentWrong Violation = "something went wrong"
CastlingThroughCheck Violation = "king would move through check"
CastlingWhileKingInCheck Violation = "king cannot castle while in check"
2023-07-11 20:28:07 +00:00
)
func (v Violation) String() string {
return string(v)
2023-07-11 20:28:07 +00:00
}