Marco
ff2ec599fe
In order to simplify special moves like en passant or castling for the client, we want to deliver the board state after every move (and not only start square and end square). With PGN we can encode a chess position into a string. This commit implies changes to logic of the pieces' shortnames. This will break the client/server connection (at least for promotions).
17 lines
469 B
Go
17 lines
469 B
Go
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"
|
|
)
|
|
|
|
func (v Violation) String() string {
|
|
return string(v)
|
|
}
|