Added ThreeFold repetition detection

Fixed a bug with premature queen development;
Some refactoring.
Added Threefold repetition detection

Fixed a bug with premature queen development;
Some refactoring.