solution of rich and knight of artificial intelligence