Check detection and minor fixes

Check detection now works. Basically, if any piece of white can attack the
loaction of the black king, then black is in check. Same logic is used for
checking for white check.