Third programming contest – View

I see you!

All the people in the building will only have two eyes – at the front of their head! So you do not see what is behind you. Further you can only look as far as to the next blocking element. The angle of view is 179 degree. You cannot look through walls; even zombies do not have x-ray vision implanted.

But both teams have something like walkie-talkies (or mobiles if you prefer modern times) or telepathic abilities in case of the zombies. However, you will always see where your team comrades are standing, while the members of the other team are only visible if they are standing in your visual field. Because the players are a little bit fat they could block the view to other players behind them.

As a point of view we will always choose the middle of the 1x1-wide field the player stands on. So if you are positioned at field (3,8), your eyes are located at (3.5,8.5). We create lines from this point to the four corners of a target (e.g. another player). If at least one corner is visible (the line has not any intersections with other elements on the map) the target is visible.

A little example:


Player 6 only sees one opponent.

Of course the blue player 6 sees his team members 0, 2 and 3, no matter where they are. Concerning opponents he can only see everything top left of the blue line. So player 6 sees the red player 7, but red players 1 and 4 are hidden by walls.

A second example:


Player 5 sees three opponents.

In this image there is no opponent behind the red player 5, so everyone could be visible to him. But only the blue players 0, 3 and 6 are visible as player 2 is hidden by a wall. Player 5 knows of course the position of his comrades 1, 4 and 7.

previous page next page