Penguin Go Up!Computer Science Level 1
Chris, the penguin, is stuck in a prison. The prison can be seen as a square grid, and one of the grid contains the key to open the door. As Chris is a forgetful penguin, he needs to mark which square he had checked such that he wouldn't keep repeatedly checking the square. He proudly says his plan:
On the square I am standing, I will check if there's a key. If yes, then I succeeded. Else, I mark it as X and move forward. Once I hit the wall or the square in front of me is marked, I turn right and continue this process.
Is Chris' plan ingenious? Below is the configuration of the prison and the blue arrow indicates Chris' initial position and direction. With Chris' plan, how many places the key can be in such that Chris cannot find the key?