aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorymherklotz <ymherklotz@gmail.com>2016-12-11 15:02:13 +0000
committerymherklotz <ymherklotz@gmail.com>2016-12-11 15:02:13 +0000
commit5e28a82b5e8638392d5527dbce8aa44008280b04 (patch)
tree9cfeebba5a899659f95ee7fdd2de56d78198de4d
parent6183b0b485db3822bc2202e6f147ec426375a5d5 (diff)
downloadA-star-algorithm-5e28a82b5e8638392d5527dbce8aa44008280b04.tar.gz
A-star-algorithm-5e28a82b5e8638392d5527dbce8aa44008280b04.zip
test of algorithm
-rwxr-xr-xbin/mainbin418208 -> 418104 bytes
-rw-r--r--src/main.cpp19
2 files changed, 11 insertions, 8 deletions
diff --git a/bin/main b/bin/main
index b0d7f2e..a37b561 100755
--- a/bin/main
+++ b/bin/main
Binary files differ
diff --git a/src/main.cpp b/src/main.cpp
index dbc00ea..17fe9ad 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -25,7 +25,7 @@ int main(int argc, char *argv[]) {
// create a render window of size 800x600 with a title.
sf::RenderWindow window(sf::VideoMode(2500, 1250), "A* Algorithm");
- window.setFramerateLimit(2);
+ // window.setFramerateLimit(2);
// print out the window size.
cout << "window size: " << window.getSize().x << ", " << window.getSize().y << endl;
@@ -52,6 +52,9 @@ int main(int argc, char *argv[]) {
// create the array of the right size using the constants.
int tiles[cols * rows];
+ for(int i = 0; i < cols * rows; ++i)
+ tiles[i] = 0;
+
// create a tile map that will be used to display the array.
TileMap map;
@@ -81,15 +84,15 @@ int main(int argc, char *argv[]) {
tiles[(int)(mouse.x / tile_size) + cols * (int)(mouse.y / tile_size)] = 0;
}
- // for(int i = 0; i < cols * rows; ++i)
- // if(tiles[i] != 1)
- // tiles[i] = 0;
-
for(int i = 0; i < cols * rows; ++i)
- tiles[i] = 0;
+ if(tiles[i] != 1)
+ tiles[i] = 0;
- for(int i = 0; i < 600; ++i)
- tiles[rand() % (cols * rows)] = 1;
+ // for(int i = 0; i < cols * rows; ++i)
+ // tiles[i] = 0;
+ //
+ // for(int i = 0; i < 600; ++i)
+ // tiles[rand() % (cols * rows)] = 1;
tiles[start_y * cols + start_x] = 3;
tiles[end_y * cols + end_x] = 2;