2 Pages   < 1 2
 Monster spawning formula?
 Jan 9 2019, 08:32 PM Post #21 Voyager Group: Members Plus Posts: 141 Joined: 24-October 07 From: Reading Member No.: 4,011 referrer:Google Search QUOTE (Roland @ Jan 8 2019, 08:44 PM) It seems overly complicated to multiply by .5 and divide by 2. If I had written such inefficient code when I was in college, I'm sure it would have drawn a negative comment from my profs. But, then, that was back when computers were slow and efficient coding mattered.As Nudibranch suggested, the real reason is likely to be repeated tweaking of code, but there can be a difference between multiplying by a half and dividing by two. Consider the following expressions in python:>>> ((15 * .5) / 2) + 14.75>>> ((15 / 2) * .5) + 14.5>>> (15 / 4) + 14Given the Int() call in the Mordor code, I don't think DA was trying to leverage this sort of effect, and if he was there are better ways to do it. I'd certainly call out that code in a review if I saw it at work, but when you're working on something complicated in your own time, sometimes it's more important that it's right than that it's elegant. korexus.

 2 Pages   < 1 2
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 Lo-Fi Version Time is now: 22nd September 2019 - 07:27 PM