davidrmiller / biosim4

Biological evolution simulator
Other
3.21k stars 460 forks source link

Add const to variables, and specify the types on numeric constants. #7

Open GregEakin opened 3 years ago

GregEakin commented 3 years ago

Sometimes it's easier to match the numeric values to their types, and identify the constant variables.

davidrmiller commented 3 years ago

Thanks @GregEakin for all the work you did on this. I like the micro-efficiency improvements (e.g., changing default double precision evaluations to float), and I'm inclined to accept changes like that. Some of the other proposed changes explicitly document how the gcc compiler understands the code (e.g., const qualifiers on some local variables and 'u' suffixes on 0) but they don't change the code that the compiler generates. Those may be more a matter of style, and I'll give those further review. Thanks for your impressive work on this.

GregEakin commented 3 years ago

You're welcome @davidrmiller. For me, this is the best way to lean about a new piece of code: roll up my sleeves and get down in the details. Then once I can see how the overall flow of the code work, I too will revert some of these changes that make the code look complex. The language has default functionally built-in, let's use it to simplify the code. So, take what you want and leave the rest.

I was impressed with your video, and how you simulated thousands of generations, to show the selection process in action. It's going to be fun to introduce new selection mechanism, such as food, and see what happens.

GregEakin commented 3 years ago

I moved the important changes into review #26. Let me know if you like them or not, and I'll resolve the merge conflicts on this branch.

davidrmiller commented 2 years ago

@GregEakin , I appreciate the work that went into this. I like some of the changes (and some were implemented in another PR), but some of the modifications in this RP I would omit.

Would you mind if I just hand-picked some changes from this PR and applied them? I would be happy to do that.

Alternatively, if you prefer to be more involved in the process, let me know and we can discuss the individual changes in more detail, then you could revise the PR.

Thanks again for your help in this project.