-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made the grid, and started implementing the A-star algorithm
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Promp the user for input | ||
echo "Enter a commit comment:" | ||
read user_command | ||
|
||
# Check if the input is empty | ||
if [ -z "$user_command" ]; then | ||
echo "Error: No comment entered." | ||
exit 1 | ||
fi | ||
|
||
# Run the command provided by the user | ||
eval "sudo git add ." | ||
eval "sudo git commit -m \"$user_command\"" | ||
eval "sudo git push -u origin main" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import heapq | ||
|
||
# A* Algorithm Class | ||
class AStar: | ||
def __init__(self, grid, start, end): | ||
# Grid | ||
self.grid = grid | ||
|
||
# Positions | ||
self.start = start | ||
self.end = end | ||
|
||
self.open_list = [] | ||
heapq.heappush(self.open_list, (0, start)) # (priority, node) | ||
|
||
def print_grid(grid, path=None): | ||
if path: | ||
for (x, y) in path: | ||
if (x, y) != start and (x, y) != end: | ||
grid[x][y] = "*" | ||
for row in grid: | ||
print(" ".join(str(cell)) for cell in row) | ||
|
||
# Define a 5x5 grid (0 = false, 1 = obstacle) | ||
grid = [ | ||
[0, 1, 0, 0, 0], | ||
[0, 1, 0, 1, 0], | ||
[0, 0, 0, 1, 0], | ||
[0, 1, 1, 0, 0], | ||
[0, 0, 0, 0, 0] | ||
] | ||
|
||
start = (0, 0) | ||
start = (4, 4) | ||
|
||
|