Euler Bricks
EvanSkyberg (0)

I made this program after learning about Euler Bricks, as I thought they were very interesting. It brute-forces every Euler Brick, so long as they don't have a previously "discovered" volume. It technically discovers 6 bricks every time it displays only one. Are there any more tips to optimize this program?

You are viewing a single comment. View All
Giothecoder (122)

Use a function macros instead of regular functions to reduce call overhead. 😜 jk.

Uh, small and kinda weird thing: switch the order in which you test the conditionals, so like
(cond1 && cond2) becomes (cond2 && cond1). This is because of short circuiting. If you don’t know what that is it’s really easy, just look it up. Actually going on that I suggest just putting the results of the calls in a bool for each and then use those in the conditionals to reduce the amount of calls your making. That’ll be better.