<s> from Coordinate import Coordinate as C <EOL> import re <EOL> class Move : <EOL> def __init__ ( self , piece , newPos , pieceToCapture = None ) : <EOL> self . notation = None <EOL> self . check = False <EOL> self . checkmate = False <EOL> self . kingsideCastle = False <EOL> self . queensideCastle = False <EOL> self . promotion = False <EOL> self . pessant = False <EOL> self . stalemate = False <EOL> self . piece = piece <EOL> self . oldPos = piece . position <EOL> self . newPos = newPos <EOL> self . pieceToCapture = pieceToCapture <EOL> self . specialMovePiece = None <EOL> self . rookMove = None <EOL> def __str__ ( self ) : <EOL> displayString = '<STR_LIT>' + str ( self . oldPos ) + '<STR_LIT>' + str ( self . newPos ) <EOL> if self . notation : <EOL> displayString += '<STR_LIT>' + self . notation <EOL> if self . pessant : <EOL> displayString = '<STR_LIT>' + str ( self . oldPos ) + '<STR_LIT>' + str ( self . newPos ) + '<STR_LIT>' + str ( self . specialMovePiece ) <EOL> displayString += '<STR_LIT>' <EOL> return displayString <EOL> def __eq__ ( self , other ) : <EOL> if self . oldPos == other . oldPos and self . newPos == other . newPos and self . specialMovePiece == other . specialMovePiece : <EOL> if not self . specialMovePiece : <EOL> return True <EOL> if self . specialMovePiece and self . specialMovePiece == other . specialMovePiece : <EOL> return True <EOL> else : <EOL> return False <EOL> else : <EOL> return False <EOL> def __hash__ ( self ) : <EOL> return hash ( ( self . oldPos , self . newPos ) ) <EOL> def reverse ( self ) : <EOL> return Move ( self . piece , self . piece . position , <EOL> pieceToCapture = self . pieceToCapture ) </s>
