# The Game

This is a port of the board game Animal Chess (also known as the Jungle Game, or Dou Shou Qi). -

The referee is available here.

# Rules

The game is played on a 7x9 board with two players, Red and Blue. Each player has 8 pieces. Players take turns, starting with Red.
The goal of the game is to step with any of own pieces into a designated square, known as the opponent's den. If neither of the players achieve this in 150 turns, the game ends with a draw.
Squares are indicated by their x y coordinates, with 0 0 being the upper left corner of the board.

### Pieces

Each player initially contains 8 animals (one of each type). Every animal (piece) has assigned strength.

- Elephant: strength 8, initial position 0 6 (red), 6 2 (blue)
- Lion: strength 7, initial position 6 8 (red), 0 0 (blue)
- Tiger: strength 6, initial position 0 8 (red), 6 0 (blue)
- Panther: strength 5, initial position 4 6 (red), 2 2 (blue)
- Dog: strength 4, initial position 5 7 (red), 1 1 (blue)
- Wolf: strength 3, initial position 2 6 (red), 4 2 (blue)
- Cat: strength 2, initial position 1 7 (red), 5 1 (blue)
- Rat: strength 1, initial position 6 6 (red), 0 2 (blue)

### Special squares

There are a few special squares on the board.
Players' dens: red den on 3 8 and blue den on 3 0. Reaching opponent's den is the goal of the game.
Traps, located on 2 0, 4 0, 3 1, 2 8, 4 8, and 3 7. Animal staying on a trap has its strength temporarily reduced to 0.
Water squares, forming two rectangles, from 1 3 to 2 5 and from 4 3 to 5 5. Usually, they cannot be entered by a piece.

### Movement

Each turn consists of moving one piece one square orthogonally in any direction. Only one piece may occupy any square.
Only rat can go onto a water square.
If an animal lands on a square containing an opponent animal of equal or lower strength it captures it (the opponent piece is removed from the game).
Elephant cannot capture Rat. However, Rat can capture Elephant.
Rat cannot capture when moving from water square to a land square.
An animal inside a trap square has its strength temporarily reduced to 0, so it can be captured by any other animal.
A Lion and Tiger from a square adjacent to the water can jump over the water in any orthogonal direction, landing on the nearest land square (this move may capture according to the default rules). They may not, however, jump over a Rat if it is in the way, in the water
A player may not move any of his animals onto his own den.
Victory Conditions

- Be the first to reach the opponent's den.

Loss Conditions

- You fail to reach opposing den before the opponent.
- You do not respond in time or output an unrecognized command.

Acknowledgments

This contribution was developed for the dr. Paweł Rychlikowski course Artificial Intelligence, University of Wrocław, 2023.

Authored by Jakub Kowalski (@aCat).

Some images taken from A4 Games web site.

# Game Input/Output

Initial input
One line: color: the color of your pieces (red for the starting player and blue for the second one).
Input for one game turn
First line: x1 y1 x2 y2: the last move made by the opponent, indicating moving a piece from x1 y1 to x2 y2 ("-1 -1 -1 -1" if this is the first turn).
Next line: moveCount: the number of legal moves for this turn.
Next moveCount lines: move: a string of characters representing a legal move.
Output
A single line describing your move in a form x1 y1 x2 y2, indicating moving a piece from x1 y1 to x2 y2

- You can display a (short) comment in the viewer by adding a space after the move and writing its content, e.g. "1 7 1 6 message".
- Comments can contain new line characters in the form of "\\n".
- You can play a random move by outputting "random" instead of a move. This is admittedly only useful for stub code generation.

Constraints
Response time first turn is ≤ 1000 ms.
Response time per turn is ≤ 150 ms.