Mercurial > public > algo-animator
annotate README.md @ 32:b1a605eb721a
accept user inputs
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Thu, 29 Jun 2023 19:45:49 +0100 |
parents | 61104b22a25d |
children | 576431310c8a |
rev | line source |
---|---|
4
035d3880da04
render text with number of elements on screen
Dennis C. M. <dennis@denniscm.com>
parents:
diff
changeset
|
1 # algo-animator |
035d3880da04
render text with number of elements on screen
Dennis C. M. <dennis@denniscm.com>
parents:
diff
changeset
|
2 |
31
61104b22a25d
I think it is working now...
Dennis C. M. <dennis@denniscm.com>
parents:
28
diff
changeset
|
3 An interactive program to visualize sorting algorithms. |
61104b22a25d
I think it is working now...
Dennis C. M. <dennis@denniscm.com>
parents:
28
diff
changeset
|
4 |
61104b22a25d
I think it is working now...
Dennis C. M. <dennis@denniscm.com>
parents:
28
diff
changeset
|
5 This project is inspired by - off course - the video by Timo Bingmann called |
61104b22a25d
I think it is working now...
Dennis C. M. <dennis@denniscm.com>
parents:
28
diff
changeset
|
6 [15 sorting algorithms in 6 minutes](https://www.youtube.com/watch?v=kPRA0W1kECg). |
21 | 7 |
24 | 8  |
26 | 9  |
24 | 10 |
31
61104b22a25d
I think it is working now...
Dennis C. M. <dennis@denniscm.com>
parents:
28
diff
changeset
|
11 |
21 | 12 ## Compile |
13 | |
4
035d3880da04
render text with number of elements on screen
Dennis C. M. <dennis@denniscm.com>
parents:
diff
changeset
|
14 ```bash |
28 | 15 mkdir build |
16 cd build | |
17 cmake .. | |
18 make | |
32 | 19 ``` |
20 | |
21 **Currently I've only tested this project on Linux. However, I would like to prepare it so | |
22 that it can be used on Mac and Windows. However, my cross-platform experience is almost | |
23 non-existent. Maybe in the future I'll check how to do it** | |
24 | |
25 # Run | |
26 | |
27 To customize the program you can pass the following arguments. | |
28 | |
29 ```bash | |
30 ./algo_animator WINDOW_WIDTH WINDOW_HEIGHT RECTANGLE_WIDTH SPACE_BETWEEN_RECTANGLES | |
31 ``` | |
32 | |
33 The default values are: | |
34 | |
35 ```bash | |
36 WINDOW_WIDTH = 1920 | |
37 WINDOW_HEIGHT = 1080 | |
38 RECTANGLE_WIDTH = 5 | |
39 SPACE_BETWEEN_RECTANGLES = 1 | |
4
035d3880da04
render text with number of elements on screen
Dennis C. M. <dennis@denniscm.com>
parents:
diff
changeset
|
40 ``` |
32 | 41 |
42 Run the program in a window with width of 1920 pixels and height of 1080 pixels, | |
43 fit the screen with rectangles with width of 50 pixels, and add a space between | |
44 rectangles of 3 pixels. | |
45 | |
46 ```bash | |
47 ./algo_animator 1920 1080 50 3 | |
48 ``` | |
49 | |
50  | |
51 | |
52 | |
53 # Examples | |
54 | |
55 ## Normal mode | |
56 | |
57 Just run the program and press `ENTER` | |
58 | |
59 ## Slow motion | |
60 | |
61 Use `u` to increase the delay, then `ENTER` to run the algorithm | |
62 **The delay is applied after each iteration** | |
63 | |
64 ## Pause mode | |
65 | |
66 Press `ENTER` then `p` | |
67 | |
68 ## Sequential mode | |
69 | |
70 Press `q` then press `ENTER` to visualize the algorithm step by step. |