Caruychen / 42Hive-Lem_in

Integrated smart ant colony transport system
2 stars 0 forks source link

Cnysten #4

Closed crl-n closed 2 years ago

crl-n commented 2 years ago

Minor pull request adding a debug rule to the makefile and x and y coordinate members to the flow_node struct. The debug rule for the makefile simply adds the -g to the compiler flags when make debug is run. The coordinate members are necessary to store the x and y coordinates of the parsed input.

Caruychen commented 2 years ago

Nice idea to add the debug rule to the makefile. One question about the x and y coordinates, will they be needed for solving the main problem, or are they only required as visual data?

crl-n commented 2 years ago

The x and y coordinates are only necessary for the visualization, as far as I can tell. To me, it seems like even though they don't seem to play a role in the solving BUT they seem to be a mandatory part of the input.

image

By this I mean that, in my interpretation, a line describing a node with missing coordinate information would be an invalid line. So 1 2 3 is a valid line but 1 or 1 2 is invalid, in my interpretation.

At the moment I'm building the parser so it takes the coordinates into account in validation and stores them. I think it makes sense to do so, even if they would remain unused in the end, because IF we decide to use them, the information would be already readily available.

crl-n commented 2 years ago

About the debug rule. This is a really really basic debug rule. We can improve on it later. I actually already modified it in the parser branch. It would be nice to make it discover if debug symbols are available, so that it would recompile any files that are missing debug symbols. As it is in this version, you need to run make clean to get debug symbols if there were already compiled object files with no debug symbols.

Caruychen commented 2 years ago

Sounds like a fair point made about the coordinate data!

Im looking forward to getting to know more about the debug rules. Haven't worked with them much before so it would be interesting.

Promise I'll get around to the other pull request soon. Looks really good, just need some more time for a proper look 👍

crl-n commented 2 years ago

Sweet!

I've added some similar, new debug rules in some other branches. I've been using a debug for -g and fsan for -fsanitize=address.

These are super simple rules and it can be done smarter. The issue with this style of debug rules is that they require you to recompile everything each time you want to use them. This is because the Makefile just checks for changes in the source files, but it doesn't check with what flags which object file was compiled. So if you are missing debug symbols in some object file, Makefile won't detect that and won't recompile it with the debug symbols. Recompiling everything solves that problem, but that means you're spending more time compiling than would be necessary.

I think the easiest solution would be to have separate folders for debug and fsan builds. But based on some googling it does seem you can use some commands to check for debug symbols. That way you wouldn't have to have separate build directories but I just haven't found the time to test that.

Anyways, let's look into it more together and figure out a smart way to do it!

And no worries about the other pull request, just make sure to enjoy all of your vacation to the max! I'm also quite close to submitting another big pull request for the hashtable branch. It will contain some minor changes to the parser code as well.

See you soon, can't wait to have you back!