Capgemini Engineering interview question

Algorithm for chess game