ChessCom/Chess-Game — pull request #16 by BiviaBen (2013-12-21 22:02:19+00:00)
Title: Benevolent king fix

New, simpler attempt at the problem outlined in PRs #14 and #15

The old code never tested kings for valid moves, and assumed that all non-adjacent square moves were castling. Castling was then validated later. This left open all illegal but adjacent moves as possible, such as the [test case game](http://www.chess.com/echess/game?id=81142026) which permitted a player's king to take his own queen.

This change tries to adhere to the original intent, but force kings to only move in permitted castling or other valid moves. Permitted castling rules take chess 960 rules into account, and allow for the previous bug's "feature" of the king being able to move any number of squares left or right to trigger the castling notation. Castling is then validated later in the _parseMove and _validMove calls.

This fix is somewhat urgent; the app that relies on it has a launch date of Monday, Dec 23.

@jseverson Does this raise any warning signs to you?
@lackovic10 Does this appear to fix the problem you researched?
@marcosdsanchez Give this a sanity-check once-over! :)