Finished legalmove and checked for all errors