Timeline for Maze generator in C
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 3, 2022 at 17:02 | comment | added | elonma1234 | ok, here is part 2: codereview.stackexchange.com/questions/277850/… | |
Jul 3, 2022 at 16:51 | comment | added | G. Sliepen | Great! If you updated your code and want your new version to be reviewed, just post a new question here on Code Review. See what to do when someone answers your question. | |
Jul 3, 2022 at 16:28 | comment | added | elonma1234 |
i'd appreciate it if you atleast looked at the generatemaze() function and told me if there's still something to improve
|
|
Jul 3, 2022 at 16:24 | comment | added | elonma1234 | thank you, here is the fully refactored code if you want to do a new review lol github.com/kyopa/maze-generator/blob/main/main.c | |
Jul 3, 2022 at 15:42 | comment | added | G. Sliepen | You should only need a stack of coordinates. | |
Jul 3, 2022 at 15:05 | comment | added | elonma1234 | should I make a stack for them aswell? | |
Jul 3, 2022 at 14:45 | comment | added | elonma1234 | how would you keep track of the coordinates? Since you need to consider the case where you pop a cell from the stack and need its coordinates | |
Jul 3, 2022 at 10:42 | comment | added | G. Sliepen |
Yes, you can do it like that. Even in a single line if you want: Maze maze = {colMAX, rowMAX, malloc(rowMAX * colMAX)}; Indeed in generatemaze() you should keep track of which coordinate you are at. Creating a struct point {size_t x; size_t y;} might also be nice.
|
|
Jul 3, 2022 at 10:16 | comment | added | elonma1234 |
and how should I get a random neighbor? In the generatemaze function should I keep track of a point ?
|
|
Jul 3, 2022 at 9:27 | comment | added | elonma1234 |
like this I mean: Maze maze = {colMAX, rowMAX}; maze.cells = malloc(rowMAX * colMAX);
|
|
Jul 3, 2022 at 9:15 | comment | added | elonma1234 |
So I should malloc the cells array in the maze struct?
|
|
Jul 2, 2022 at 21:07 | history | edited | Mast♦ | CC BY-SA 4.0 |
Corrected spelling
|
Jul 2, 2022 at 19:52 | history | answered | G. Sliepen | CC BY-SA 4.0 |