Added state functionality and castle now works

check, checkmate and stalemate