MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayUsing standard Algebraic notation ('' for a pawn), given previous move and a next move, output true if it is a valid move or false otherwise. Assume there are no other pieces on the chess board, that the piece can be either black or white (whichever generates a valid result) and the previous move was valid. Examples:

Moving a pawn one space: ('c5','c6') -> true

Moving a bishop non-diagonally: ('Bb7','Bd7') -> false

26 correct solutions
11 incorrect solutions

Last solution submitted on Jun 28, 2014

3 Comments

@bmtran
on 13 Feb 2012

this doesn't take into account captures or moving a pawn 2 moves from its starting position. should it?

@bmtran
on 13 Feb 2012

and the occasional other weird rules...

Alan Chalker
on 16 Feb 2012

Captures and pawn 2 moves and castling and such aren't possible based upon the assumptions I stated (i.e. no other pieces on the board, the previous move was valid, etc)

1 Comment