added README and gitignore
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
target
|
||||
@@ -0,0 +1,10 @@
|
||||
# Project
|
||||
|
||||
This is a classic A* implementation written in c.
|
||||
The project is split into:
|
||||
- `frontend`: An interactive raylib visualization
|
||||
- `backend`: The independent algorithm (can be used elsewhere)
|
||||
|
||||
## Background
|
||||
|
||||
I wrote this as a prototype and copied it almost 1 to 1 into my [other projects](https://git.magnusku.de/Magnus/topdown_game) code.
|
||||
+10
-1
@@ -5,10 +5,19 @@
|
||||
|
||||
#include "../include/astar.h"
|
||||
|
||||
bool is_collider(int i) {
|
||||
if (i == -1 || i == 10) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void reset_field(afield_t *field, int** map) {
|
||||
for (int r = 0; r < field->rows; r++) {
|
||||
for (int c = 0; c < field->columns; c++) {
|
||||
bool is_obstacle = map[r][c] != -1 ? true : false;
|
||||
bool is_obstacle = is_collider(map[r][c]);
|
||||
|
||||
field->map[r][c] = (anode_t){
|
||||
.parent = {-1, -1},
|
||||
|
||||
Reference in New Issue
Block a user