From 6183b0b485db3822bc2202e6f147ec426375a5d5 Mon Sep 17 00:00:00 2001 From: ymherklotz Date: Sun, 11 Dec 2016 14:58:33 +0000 Subject: better commit --- bin/main | Bin 417472 -> 418208 bytes src/main.cpp | 16 +++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/main b/bin/main index a2e13a4..b0d7f2e 100755 Binary files a/bin/main and b/bin/main differ diff --git a/src/main.cpp b/src/main.cpp index feb3bc0..dbc00ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,8 +21,11 @@ int main(int argc, char *argv[]) { cout << "executing " << argv[0] << endl; cout << "arguments given: " << argc - 1 << endl; + srand(time(NULL)); + // create a render window of size 800x600 with a title. sf::RenderWindow window(sf::VideoMode(2500, 1250), "A* Algorithm"); + window.setFramerateLimit(2); // print out the window size. cout << "window size: " << window.getSize().x << ", " << window.getSize().y << endl; @@ -49,9 +52,6 @@ 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,9 +81,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) - if(tiles[i] != 1) - tiles[i] = 0; + 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; -- cgit