IPB

Welcome Guest ( Log In | Register )

2 Pages V  < 1 2  
Reply to this topicStart new topic
> Monster spawning formula?
korexus
post Jan 9 2019, 08:32 PM
Post #21


Explorer
***

Group: Members Plus
Posts: 129
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) + 1
4.75
>>> ((15 / 2) * .5) + 1
4.5
>>> (15 / 4) + 1
4

Given 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.
Go to the top of the page
 
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 25th March 2019 - 02:40 AM
Bridged By IpbWiki: Integration Of Invision Power Board and MediaWiki © GlobalSoft
Copyrights and Credits