Implemented functionality for finding best transition for each step of the game