When a velociraptor does not smell human blood, takes advantage to do some exercise and mark its territory. In a rectangular room with obstacles, our friend starts running trying to keep the direction and the sense of its movement while it is possible, leaving a pheromone trace. Under any circumstances it will go out of the room, nor will cross an obstacle, nor will cross a square that was crossed previously. In these cases, velociraptor will turn 90 degrees to the right. If, even turning 90 degrees, the velociraptor could not continue, it would stop.
Implement a program that prints the squares where the velociraptor has been before stopping. The velociraptor always starts in the central position of the room, moving towards north.
The input describes a room. The first line has the number of rows and the number of columns . It is fulfilled that . as well as are odd numbers. lines follow, with characters each one. An asterisk indicates an obstacle. The central position is always free.
Your program must print the board with a ’V’ in each
position where the velociraptor has been.
Author: Unknown
Translator: Carlos Molina
Generation: 2026-01-25T10:14:39.584Z
© Jutge.org, 2006–2026.
https://jutge.org