mchess-server/chess/violation.go

20 lines
708 B
Go
Raw Permalink 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"
CastlingKingMovedBefore Violation = "king cannot caslte because he moved before"
2023-07-11 20:28:07 +00:00
)
func (v Violation) String() string {
return string(v)
2023-07-11 20:28:07 +00:00
}