First I would like to say that I do not speak English so sorry if I express myself badly.
Hi, I need to know how I can solve this game.
"Archers in the Forest".
The game consists of a forest represented by a grid, 5x5, 7x7, 9x9 (The user will be asked to choose the level of difficulty, depending on this the number of corresponding squares will be shown).
In these boxes, trees represented by an 'X' will be randomly generated
The objective of the game is for 2 players (archers) to enter the forest by
opposite ends (J1 in 9-A and J2 in 1-I) and each one must try to eliminate the other.
To do this, in each turn an archer may choose to move one place, in the direction
vertical or horizontal, or shoot a crush. The arrows move in a straight line
a maximum distance of 5 meters (assume each cell 1 meter).
On the other hand a player cannot move to a cell where there is a tree and the
arrows cannot pierce them. Upon receiving a crush the player loses the round, the
Games are made up of 3 rounds and are won by whoever wins 2 of them.
Some points to keep in mind:
• The game must allow you to choose who starts.
• At the beginning of the game, the user must indicate the dimensions of the forest (level), which
it must be square.
• Different forests must be generated for each round and for each game.
• Each time a turn is played the forest must be displayed on the screen, and
In addition, the last move made must be indicated.
• When there is a winner, you must immediately indicate and end the
• If the player enters an invalid square (off the board, or move to where
there is a tree), you must indicate the error and reapply.
• After the game is over, the player should be asked if he wants to continue
playing, if so, a new game is generated.
It is requested
Implement a C program for the game described above.
- For data input and output, only the functions scanf,
printf, getchar, and putchar.
- The srand () / rand () function proper to the c language must be used