Skip to content

Commit 7ba7564

Browse files
authored
Finish program challenge.
1 parent 5b6e952 commit 7ba7564

File tree

6 files changed

+45
-25
lines changed

6 files changed

+45
-25
lines changed

Files/path-data

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
##########
2+
#.#.##..*#
3+
#...#..#.#
4+
#.#.#.##.#
5+
#.#....#.#
6+
#.#.##.#.#
7+
#.#..#...#
8+
#.##.###.#
9+
#>#......#
10+
##########

ai-path-finding.py renamed to Files/path-finding.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
"""
2-
Code created by @CodeAPretzel, Pretson G., and ChatGPT (used for math and AI models).
2+
Code created by @CodeAPretzel, Pretson G., and ChatGPT (for A* algorithm and Manhattan distance in python).
3+
4+
---
5+
6+
Note on "path-data" file:
7+
8+
> = starting point
9+
. = free spaces
10+
@ = object/robot navigating the system
11+
# = obstacles
12+
* = end goal
13+
314
"""
415

516
import math
@@ -26,7 +37,7 @@ def GetNeighbors(position, grid):
2637
x, y = position
2738
neighbors = []
2839
directions = [
29-
(0, -1), (0, 1), (-1, 0), (1, 0), # Cardinal directions
40+
(0, -1), (0, 1), (-1, 0), (1, 0), # Vertical and horizontal directions
3041
(-1, -1), (1, -1), (-1, 1), (1, 1) # Diagonal directions
3142
]
3243

@@ -66,11 +77,11 @@ def DestinationSearch(grid, start, goal):
6677
return None
6778

6879
def ClearTerminal():
69-
# Cross-platform method to clear the terminal
80+
# Dual clear terminal
7081
os.system('cls' if os.name == 'nt' else 'clear')
7182

7283
def DisplayGrid(grid, robotPos=None):
73-
# Render the grid in-place
84+
# Render the grid
7485
if robotPos:
7586
x, y = robotPos
7687
original = grid[y][x] # Save the original character

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1-
# AI-Pathfinding
1+
# - Path Finding Algorithms -
22

3-
Use the data files as input for the python file.
3+
For the 2024 Missouri Hacks Competition.
4+
5+
<br>
6+
<br>
7+
8+
### Purpose
9+
10+
Inside of the [Files](https://github.com/CodeAPretzel/Path-Finding-Algorithms/Files), you will find a python file that takes the input of a file map, as displayed in [path-data](https://github.com/CodeAPretzel/Path-Finding-Algorithms/Files).
11+
12+
The object/robot in the program, denoted as "@", navigate the maze in the most efficient manner to reach its end objective which is a "*".
13+
14+
<br>
15+
<br>
16+
17+
### Credits
18+
19+
[A* Algorithm](https://www.geeksforgeeks.org/a-search-algorithm/)
20+
[Manhattan Distance](https://www.datacamp.com/tutorial/manhattan-distance)
21+
[ChatGPT](https://chatgpt.com/)

path-data0

Lines changed: 0 additions & 9 deletions
This file was deleted.

path-data1

Lines changed: 0 additions & 5 deletions
This file was deleted.

path-data2

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)