isValid and allMoves method implemented and tested