|
6 | 6 |
|
7 | 7 | 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 | 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 |
| 9 | +When the game starts, the user is asked to select: |
| 10 | +- The start and the goal cells. |
| 11 | +- The obstacle cells. |
| 12 | +- The nature of the terrain for each cell between: |
14 | 13 | - Open Terrain |
15 | 14 | - Grassland |
16 | 15 | - Swampland |
17 | 16 | - Obstacles |
18 | 17 |
|
19 | 18 | 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 | 19 |
|
21 | | -## Compiling and Running |
| 20 | +## About This Repository |
| 21 | + |
| 22 | +This repository uses CI/CD to automatically build and release the program for Windows, macOS, and Linux. The program is packaged as a JAR file. The JAR file is then packaged into an MSI file for Windows, a DMG file for macOS, and a DEB file for Linux. The program is built using GitHub Actions and is released using GitHub Releases. The program is built for the following platforms: |
| 23 | + |
| 24 | +- Windows (64-bit) |
| 25 | +- macOS (64-bit) |
| 26 | +- Linux (64-bit) |
| 27 | +- JAR File |
| 28 | + |
| 29 | +You can find them here in the [Releases](https://github.com/vmsaif/ant-path-finding-using-A-Star-algorithm/releases) section. |
| 30 | + |
| 31 | +## Running the Program |
| 32 | + |
| 33 | +- Make sure you have JRE installed on your computer. You can download JRE [here](https://adoptium.net/) or [here](https://www.oracle.com/java/technologies/javase-jre8-downloads.html). |
| 34 | + |
| 35 | +Downloading the jar file is preferred. You can download the release version of the Game from the latest release [here](https://github.com/vmsaif/ant-path-finding-using-A-Star-algorithm/releases). The program is packaged as a JAR file. You can run the program by double-clicking on the JAR file. |
| 36 | + |
| 37 | +## **Ubuntu** |
| 38 | + |
| 39 | +### Option 1: Downloading the DEB File (simpler) |
| 40 | + |
| 41 | +1. Open the terminal and navigate to the directory where you downloaded the .deb file. |
| 42 | + |
| 43 | +```bash |
| 44 | +cd ~/Downloads |
| 45 | +``` |
| 46 | + |
| 47 | +2. Run the following command to install the package: |
| 48 | + |
| 49 | +```bash |
| 50 | +sudo dpkg -i ./ant-path-finding-v1.0.0-linux_amd64.deb # Replace the filename/version with the name of the DEB file you downloaded |
| 51 | +``` |
| 52 | +3. If you get an error, run the following command to install the dependencies: |
| 53 | + |
| 54 | +```bash |
| 55 | +sudo apt-get install -f |
| 56 | +``` |
| 57 | + |
| 58 | +4. Run the following command to start the game: |
| 59 | + |
| 60 | +You can start the game by searching for it in the applications menu named `ant-path-finding` or by running the following command in the terminal: |
| 61 | +```bash |
| 62 | +/opt/ant-path-finding/bin/ant-path-finding |
| 63 | +``` |
| 64 | + |
| 65 | +### Option 2: Downloading the JAR File |
| 66 | + |
| 67 | +1. **Installing Java** (if it's not already installed): |
| 68 | + ```bash |
| 69 | + sudo apt update |
| 70 | + sudo apt install default-jre |
| 71 | + ``` |
| 72 | + |
| 73 | +2. **Navigate to the Download Location**: |
| 74 | + ```bash |
| 75 | + cd ~/Downloads |
| 76 | + ``` |
| 77 | + |
| 78 | +3. **Provide Execute Permissions** (Optional, but useful if you want to execute it directly): |
| 79 | + ```bash |
| 80 | + chmod +x ant-path-finding-v1.0.0.jar # Replace the filename with the name of the JAR file you downloaded |
| 81 | + ``` |
| 82 | + |
| 83 | +4. **Run the JAR File**: |
| 84 | + ```bash |
| 85 | + java -jar ant-path-finding-v1.0.0.jar # Replace the filename with the name of the JAR file you downloaded |
| 86 | + ``` |
| 87 | + |
| 88 | +## **macOS** |
| 89 | +There are 2 methods. Downloading the dmg file or downloading the jar file. |
| 90 | +### Option 1: Downloading the DMG File (simpler) |
| 91 | +I am not a registered Apple developer, That is why you will get a warning when you try to open the app. Thus, you will have to bypass the security settings to run the app. |
| 92 | +Here are the steps: |
| 93 | + |
| 94 | +1. Click on the .dmg file you have downloaded. |
| 95 | + |
| 96 | +2. Drag the app to the Applications folder. |
| 97 | + |
| 98 | +3. In the Finder, locate the Ant Path Finding app. |
| 99 | + |
| 100 | + (Don’t use Launchpad to do this. Launchpad doesn’t allow you to access the shortcut menu.) |
| 101 | + |
| 102 | +4. Press and hold Control then click the app icon. |
| 103 | + |
| 104 | +5. Click Open. |
| 105 | + |
| 106 | + The app is saved as an exception to your security settings, and you can open it in the future by double-clicking it just as you can any registered app. |
| 107 | + |
| 108 | +### Option 2: Downloading the JAR File |
| 109 | +Make sure you have JRE installed on your computer. You can download JRE [here](https://adoptium.net/) or [here](https://www.oracle.com/java/technologies/javase-jre8-downloads.html). |
| 110 | + |
| 111 | +1. **Navigate to the Download Location** (using Terminal): |
| 112 | + ```bash |
| 113 | + cd ~/Downloads |
| 114 | + ``` |
| 115 | + |
| 116 | +3. **Provide Execute Permissions** (Optional): |
| 117 | + ```bash |
| 118 | + chmod +x ant-path-finding-v1.0.0.jar # Replace the filename with the name of the JAR file you downloaded |
| 119 | + ``` |
| 120 | + |
| 121 | +4. **Run the JAR File**: |
| 122 | + ```bash |
| 123 | + java -jar ant-path-finding-v1.0.0.jar # Replace the filename with the name of the JAR file you downloaded |
| 124 | + ``` |
| 125 | + |
| 126 | +## **Windows** |
| 127 | + |
| 128 | +### Option 1: Downloading the MSI File (simpler) |
| 129 | + |
| 130 | +1. Open the folder where you downloaded the MSI file. |
| 131 | +2. Double-click on the MSI file to run it. |
| 132 | + |
| 133 | +At this point, windows smart screen will block the app from running. As I am not a signed developer by Microsoft, this warning will appear. |
22 | 134 |
|
23 | | -### Compiling |
24 | | -The game uses a simple state machine to manage the different states of the game. |
| 135 | +3. If you get the warning, click on "More Info" and then click on "Run Anyway". |
| 136 | +4. Wait for the installation to complete. |
| 137 | +5. Run the game from the Desktop shortcut. |
25 | 138 |
|
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. |
| 139 | +### Option 2: Downloading the JAR File |
28 | 140 |
|
29 | | -## Resources |
| 141 | +1. **Confirming Java**: |
30 | 142 |
|
31 | | -### Images |
32 | | -- [App Icon](https://www.flaticon.com/free-icon/ant_1779584) |
33 | | -- [Ant Image](https://www.pngegg.com/en/png-zblks) |
34 | | -- [Food Image](https://www.pngegg.com/en/png-medpx) |
| 143 | + Make sure you have JRE installed on your computer. You can download JRE [here](https://adoptium.net/) or [here](https://www.oracle.com/java/technologies/javase-jre8-downloads.html). |
35 | 144 |
|
36 | | -### Bugs: |
37 | | -I have not found any bugs in the program yet. If you find any, please let me know. |
| 145 | + Ensure that Java is added to your `PATH` so that it can be accessed from the command prompt. During the jre installation, You will have option to add to your path. Is is unchecked by default. Make sure to enable it. To check if Java is installed, run the following command in Command Prompt or PowerShell: |
| 146 | + ```bash |
| 147 | + java -version |
| 148 | + ``` |
| 149 | + If Java is installed, you should see the version number. If you see an error, you need to install Java. See above for instructions on installing Java. |
38 | 150 |
|
| 151 | +2. **Navigate to the Download Location** (using Command Prompt or PowerShell): |
| 152 | + ```bash |
| 153 | + cd c:\Users\username\Downloads # Replace username with your username |
| 154 | + ``` |
39 | 155 |
|
| 156 | +3. **Run the JAR File**: |
| 157 | + ```bash |
| 158 | + java -jar ant-path-finding-v1.0.0.jar |
| 159 | + ``` |
40 | 160 |
|
| 161 | +In all cases, once the commands are followed, the Java application packaged inside the JAR file should start running. |
0 commit comments