You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The program uses the A* algorithm to find the shortest path from the ant to the food. The ant is the start and the food is the goal. The ant can move in 8 directions.
8
+
9
+
When the game starts, the user is asked to select
10
+
11
+
-the start and the goal cells
12
+
-the obstacle cells
13
+
-the nature of the terrain for each cell between
14
+
- Open Terrain
15
+
- Grassland
16
+
- Swampland
17
+
- Obstacles
18
+
19
+
After the user has selected the cells, the program calculates the shortest path from the ant to the food. The program uses the A* algorithm to find the shortest path. The A* algorithm uses a heuristic function to find the shortest path. The heuristic function used in this program is the Manhattan distance. The program shows the search evaluation of the A* algorithm. When the path is found, the ant starts moving from the start cell to the goal cell.
20
+
21
+
## Compiling and Running
22
+
23
+
### Compiling
24
+
The game uses a simple state machine to manage the different states of the game.
25
+
26
+
- Run the command `javac -d bin src/*.java` to compile the Java files in the `src` directory to `bin/` directory.
27
+
- Run the command `java -cp bin/ App` to run the main game.
0 commit comments