gemot encubed  

Go Back   gemot encubed > Gemot > General Discussion

General Discussion Theres a Clannad of AIR-headed Kanon fodder being shot by the Little Busters After Tomoyo on a Planet-arian.

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 2005-06-03, 09:28
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default Not the Daily WTF...

...but Key's code never ceases to amuse me.

The following gem is part of Kanon Standard Edition's title menu, and it's too good not to share:
Code:
if (1 == 1) {
    SetSkipAnimations (0)
} else if (1 == 0) {
    SetSkipAnimations (1)
}
This exact snippet appears seven or eight times in the title menu.

Clearly it's the result of naive macro expansion, but come on, VisualArt's... if I, an amateur, can write a compiler that optimises out cases like that in my spare time, surely your professional programmers can manage something... -_-;;
  #2  
Old 2005-06-03, 11:15
curlyconnor
Guest
 
Posts: n/a
Default

Well, I don't exactly see what's so bad about that. But then again, I know NOTHING about programming code.
  #3  
Old 2005-06-03, 11:22
zalas zalas is offline
 
 
Join Date: Feb 2004
Location: fushigi misuterii
Posts: 1,831
Send a message via ICQ to zalas
Default Re: Not the Daily WTF...

Quote:
Originally Posted by Haeleth
...but Key's code never ceases to amuse me.

The following gem is part of Kanon Standard Edition's title menu, and it's too good not to share:
Code:
if (1 == 1) {
    SetSkipAnimations (0)
} else if (1 == 0) {
    SetSkipAnimations (1)
}
This exact snippet appears seven or eight times in the title menu.

Clearly it's the result of naive macro expansion, but come on, VisualArt's... if I, an amateur, can write a compiler that optimises out cases like that in my spare time, surely your professional programmers can manage something... -_-;;
I think it's more that the time spent on optimizing it out wouldn't achieve significant enough gains, since they expect people's computers to run fast enough that it wouldn't matter.
  #4  
Old 2005-06-03, 12:17
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default Re: Not the Daily WTF...

Quote:
Originally Posted by zalas
I think it's more that the time spent on optimizing it out wouldn't achieve significant enough gains, since they expect people's computers to run fast enough that it wouldn't matter.
Well, ye-ess... but if efficiency is not a concern, you have to ask yourself why they bother compiling to bytecode in the first place, when other systems manage perfectly well executing from (compressed and encrypted) text.

(If they were worried about people being able to read their scripts, all they have to do is use Perl... :p)

Not to mention that if their compiler was written with an eye to saving programmer time, and therefore uses a simple lex/yacc setup instead of something complex and custom-built, it would probably take all of half an hour to add constant folding and compile-time evaluation of constant conditions. You'd think they'd do it out of pride if nothing else... ^^;
  #5  
Old 2005-06-03, 12:20
Shii's Avatar
Shii Shii is offline
Obsessive
 
Join Date: Jun 2005
Location: Cloudy Water
Posts: 497
Send a message via ICQ to Shii
Default

Quote:
Originally Posted by curlyconnor
Well, I don't exactly see what's so bad about that. But then again, I know NOTHING about programming code.
If 1 + 1 = 2, do this.
On the other hand, if 1 + 1 = 3, do this instead.



(yup, I'm registering on this forum too... I want to register on all visual-story related forums :v)
  #6  
Old 2005-06-03, 14:23
emperor emperor is offline
Regular
 
Join Date: Jun 2004
Location: Germany
Posts: 96
Default

Quote:
Originally Posted by Shii
Quote:
Originally Posted by curlyconnor
Well, I don't exactly see what's so bad about that. But then again, I know NOTHING about programming code.
If 1 + 1 = 2, do this.
On the other hand, if 1 + 1 = 3, do this instead.
(yup, I'm registering on this forum too... I want to register on all visual-story related forums :v)
Did you really understand this? Basically the problem here is that there is no need for the if after the else, since else already means that what this asks for HAS to be true. The flag can only be true or not. Basically it's like: If [the number that can only be 1 or 0] is 0 then do something[0]. Else look if the number is 1 and if that is the case do something[1]. Obviously this can be shortened to if the number is 0 then do something[0], else do something[1].
If the problem is what I interpreted it as then I hope this can now be understood by...everybody.
  #7  
Old 2005-06-03, 15:02
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

Look closer, emperor. I wouldn't describe 1 as something that can be either 1 or 0. ;)
  #8  
Old 2005-06-03, 15:14
emperor emperor is offline
Regular
 
Join Date: Jun 2004
Location: Germany
Posts: 96
Default

Why did I read it as an l....
  #9  
Old 2005-06-03, 15:15
JudicatorOmega JudicatorOmega is offline
Local
 
Join Date: Jan 2004
Location: San Jose, CA
Posts: 100
Default

Your right, this was too good not to share with everyone.

Code:
if (1 == 1) {SetSkipAnimations (0)}
 else {SetSkipAnimations (1)}
That is what I would write, but if I was a real programmer, I would have used something even shorter than that and placed it elsewhere. I really believe you don't need to have that same thing going on 8 times when it only needs to be used once.

Maybe they did it like that, so that in case the number is -1, SetSkipAnimations() is not used at all. Hehehehehe... J/K

Oh and BTW, isn't 1 always going to equal 1?
__________________
"Its hard not to be jaded by the time your my age." - Kitsune, Love Hina TV Series
"I wonder if we'll meet again someday, on that hill..." - Precious Memories, Kimi Ga Nozomu Eien OP Single
  #10  
Old 2005-06-03, 15:18
emperor emperor is offline
Regular
 
Join Date: Jun 2004
Location: Germany
Posts: 96
Default

It is...this is what makes it even more stupid. Anyways...correctly this whole thing is supposed to be only
SetSkipAnimations (0)
  #11  
Old 2005-06-03, 15:25
JudicatorOmega JudicatorOmega is offline
Local
 
Join Date: Jan 2004
Location: San Jose, CA
Posts: 100
Default

Well hey, I guess thats the big joke, and why I mentioned "1 is always going to be 1". Nonetheless, if the first 1 was actually a variable, then the statement could still be shortened. I believe they left it in because they were indecisive over wether they would include animations or not.
__________________
"Its hard not to be jaded by the time your my age." - Kitsune, Love Hina TV Series
"I wonder if we'll meet again someday, on that hill..." - Precious Memories, Kimi Ga Nozomu Eien OP Single
  #12  
Old 2005-06-04, 01:57
Aldareon Aldareon is offline
Local
 
Join Date: Dec 2003
Location: Australia
Posts: 176
Default

Oh you misguided souls ....

Obviously the compiler went further than interpret the programmer's intent and had future upgradability in mind. The compiler took into account all the project's setbacks including other KEY release timings, extrapolated the statistical data and realized that Kanon would be released at a time when everyone has their own quantum processing computer. With the inter-dimensional computational ability that such creatures possess, 1 => 1, as well as 0.5 (eg mathematical rounding error) and quite possibly - 0 (erratic voltage translation? who knows!)

Unfortunately by the time we all get our hands on a matrix-like quantum computer I doubt we'd even be playing Kanon on it. I say unfortunately because this means we miss out on the inter-dimensional features that Kanon has to offer ~_~

Okay, okay .. so quantum comps don't actually work like that (theoretically), but I'd like to think it's a valid reason ^_^
  #13  
Old 2005-06-04, 08:45
GreatSaintLouis GreatSaintLouis is offline
Addicted
 
Join Date: Feb 2005
Posts: 807
Default

So does this completely disable the ability of SetSkipAnimations to be 1 (which I'm assuming refers to - taking a wild guess here - skipping animations like page transitions), or are there other ways to go about doing so besides divining the mystical properties of 1 and all its possible values in what appears to be some sort of Schrödinger's Kanon?
  #14  
Old 2005-06-04, 20:48
K
Guest
 
Posts: n/a
Default

Perhaps this is stepping in the funny, but isn't this just a bugtesting function, with the intent to:

1. skip animations, making testing faster (by switching around the "1 ==" parts with a quick Find->Replace)
2. make sure RealLive isn't so damn messed up it doesn't know 1 = 1.
3. act as a quick exercise for familiarizing themselves with the code, which then could be used for the above purposes as well.

Uh, if I ruined anything then this post never existed, okay? And if I'm completely wrong, then same, I guess >_>;
  #15  
Old 2005-06-05, 04:00
Slipgate Slipgate is offline
Obsessive
 
Join Date: Dec 2004
Posts: 264
Default

Are we sure that it's not interpreting (for the first 1) what a VARIABLE is at some point? Something like a typedef or something? Which it's losing the actual name for but interpreting the value of for the one time it went through decompiling?

K's thought is the other thing I would think. A programmer doesn't write "if 1 is 1" comparisons if he's actually meaning to write anything meaningful.
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 14:08.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.