fixed a bug in king moves. If the king is checked by a ray piece, it now
can't move directly away from the ray piece
fixed another bug with king movement
fixed a memory leak