3 ms·
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 da
by 3JPLW 14y ago
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-L8510 https://gist.github.com/anonymous/5133829#file-simcityui-js-...
- UberMouse 14y agoThat looks correct, the population starts fudging as soon as you pass 500 pop http://np.reddit.com/r/SimCity/comments/1a6oeo/proof_that_the_game_is_misleading_regarding/ http://np.reddit.com/r/SimCity/comments/1a6oeo/proof_that_th...
- skeoh 14y agoIs it just me or are these 'yoda conditions' (http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html 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.
- skore 14y agoMajor 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".
- skore 14y agoTo stop people from upvoting me: I'm in the tabs camp. There, I've said it.
- lmm 14y agoIt's just you. Once you're used to them they're just as easy to read as "normal" conditionals, if not easier.
- rorrr 14y agoNo, 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 ...".
- loopdoend 14y agoThis 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 http://closure-compiler.appspot.com/home).
- caipre 14y agoJavascript? 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?