Well, i'm in a 800x600 grid. This grid has an object moving randomly. vertically 1 meaning the top 600 meaning the bottom. as an object lays on the right side it will follow the randomly moving object.
It will only move down, as it won't, for some bizarre reason, move upward. And on top of that sometimes it gets caught, the moving object that is.... but i haven't posted that, as I will fix that.
Like I said, it will only move down... and if the direction allows it. Which is direction 3 I believe.
Lines 26 and 39 are checking the exact same conditions as lines 19 and 33 respectively, I am unsure if this is intentional, but it doesn't look like it would be.
Hmm, yeah I probably noticed that some time ago... but forgot ha. But would that fix the problem?
I know I can make it more concise by not checking the same thing twice.... But they're all running on one thread. So I don't see it really slowing down or needing that optimization. Or am I missing something completely?
I could just reading it wrong. It just looks like you would mean to check greater than on line 19, less than on line 26, greater than on line 33, and less than on line 39. Where as currently you're checking greater than for every line.
Hmm.. Well I feel I should point out that I have no experience with SFML, so I'm just looking through the code to see if there's perhaps anything I can spot that wouldn't be library specific.
I'm still looking through it, but I have spotted one thing:
under float Computer::crunch(), if by any chance all of those if / else if statements fail, it will return copy uninitialized.
Well, typically you don't want to leave bugs like that open, even if you're sure it will never happen. Especially when something like that would be easily solved with a final 'else' statement, which could even throw an error if by some chance all other statements fail.
For example, what if it wasn't programmed with a 0% chance of happening like you're expecting and instead had a .1% chance of happening? If that .1% occurs and you had it accounted for, you could know where the bug occured as soon as it happened. Otherwise you may never be able to debug it out and find it. Heck, some times a game can even go on for a little while with a bad return like that without any noticable effects before it crashes.
I'm not saying this may happen in this specific case, just saying that it's always good practice to account for such possibilities. Why leave a potential bug, no matter how remote, when you don't have to? Just a good habit to get into, imo.