Re:SimCity’s Sims Don’t Seem That Smart After All
by 3JPLW on Wednesday March 13, 2013 @04:56PM
(#5371061)
Yup. And this is supported by the supposedly leaked piece of GUI code that appeared on Gist 2 days ago. If that code leak is authentic and reasonably up to date (there are references to an alpha version), then it means that this is happening at the GUI layer.
simcity.GetFudgedPopulation = function (a) {
a = "undefined" !== typeof a ? a : simcity.gGlobalUIHandler.mLastPopulation;
if (500 >= a)
return a;
if (40845 < a)
return Math.floor(8.25 * a);
a = Math.pow(a - 500, 1.2) + 500;
return Math.floor(a)
};
https://gist.github.com/anonymous/5133829#file-simcityui-js-...
Re:SimCity’s Sims Don’t Seem That Smart After All
by skeoh on Wednesday March 13, 2013 @07:19PM
(#5371759)
Is it just me or are these 'yoda conditions' (http://www.codinghorror.com/blog/2012/07/new-programming-jar...) confusing and difficult to read? They make sense but it's so jarring to see that I have to read the condition twice to be sure I understand it.
Re:SimCity’s Sims Don’t Seem That Smart After All
by skore on Wednesday March 13, 2013 @08:09PM
(#5372105)
Major code smell for me as well, but I've seen some rather big projects do them, so I always file it under "tabs vs. spaces".
Re:SimCity’s Sims Don’t Seem That Smart After All
by skore on Thursday March 14, 2013 @07:16AM
(#5374232)
To stop people from upvoting me: I'm in the tabs camp. There, I've said it.
Re:SimCity’s Sims Don’t Seem That Smart After All
by lmm on Wednesday March 13, 2013 @08:43PM
(#5372323)
It's just you. Once you're used to them they're just as easy to read as "normal" conditionals, if not easier.
Re:SimCity’s Sims Don’t Seem That Smart After All
by rorrr on Wednesday March 13, 2013 @11:50PM
(#5372972)
No, it's not just him. Yoda conditions are hard to read, because they don't follow the natural language. You don't say "If 5 dollars is more than what I have...", instead you say "If I have less than 5 dollars ...".
Re:SimCity’s Sims Don’t Seem That Smart After All
by loopdoend on Thursday March 14, 2013 @01:02AM
(#5373188)
This is a result of the code being transpiled from their scripting language and run through Google's Closure Compiler. You'll get the same behavior on conditions if you try it out (http://closure-compiler.appspot.com/home).
Re:SimCity’s Sims Don’t Seem That Smart After All
by caipre on Wednesday March 13, 2013 @11:14PM
(#5372870)
Javascript? I haven't been tracking the details of this game at all, but is the GUI really done in Javascript? Are they using a custom engine of some sort? How can that possibly be performant?
Re:SimCity’s Sims Don’t Seem That Smart After All
by UberMouse on Wednesday March 13, 2013 @05:39PM
(#5371297)
That looks correct, the population starts fudging as soon as you pass 500 pop
http://np.reddit.com/r/SimCity/comments/1a6oeo/proof_that_th...
Actually this does not seem to be the case at all [0]. Some people have figured out that the total population numbers are are either bugged or faked. For a supposed 100,000 pop town, the actual population is around 15,000.
[0] http://forum.ea.com/eaforum/posts/list/9359265.page