Interesting styling choices to say the least



  • I found this interesting JS application (a game actually) that supports a number of interesting "features" full source: 

    http://www.a1javascripts.com/games/bgate/bgate.html

     Some of the magical features include random indentation at points, two elses for about 50 is ifs (no else ifs).  Every variable is stored in a form, all the visible ones are editable, oh and for kicks the code is double-spaced. A sample:

     

    [code]

    if (1 > yourlife) {

    alert("YOU ARE DEAD")

    document.game.experience.value = "DEAD"

    document.game.money.value = 0

    document.bgColor="black"

    return false

    }

    if (randum == 2) {

    document.game.badguy.value = "Rabbit"

    document.game.enemyattack.value = 1

    document.game.enemyarmor.value = 8

    document.game.badlife.value = 6

    }

    if (randum == 3) {

    document.game.badguy.value = "Funky Chicken"

    document.game.enemyattack.value = 2

    document.game.enemyarmor.value = 8

    document.game.badlife.value = 8

    }

    [/code]

     PS: For some reason code bbtags don't work, what should I be using instead?



  • randum.

    nuff said. 



  • I have some coworkers who double space their code. For the most part I don't know why. I can think of reasons to block code into paragraph-like chunks with whitespace fore and aft, but why double space every line?



  • @Lingerance said:

    I found this interesting JS application (a game actually) that supports a number of interesting "features" full source: 

    http://www.a1javascripts.com/games/bgate/bgate.html

     Some of the magical features include random indentation at points, two elses for about 50 is ifs (no else ifs).  Every variable is stored in a form, all the visible ones are editable, oh and for kicks the code is double-spaced. A sample:

    if (1 > yourlife) {

    alert("YOU ARE DEAD")
    
    document.game.experience.value = "DEAD"
    
    document.game.money.value = 0
    
    document.bgColor="black"
    
    return false
    

    }

     if (randum == 2) {
    
    document.game.badguy.value = "Rabbit"
    
    document.game.enemyattack.value = 1
    
    document.game.enemyarmor.value = 8
    
    document.game.badlife.value = 6
    
    }
    
     if (randum == 3) {
    
    document.game.badguy.value = "Funky Chicken"
    
    document.game.enemyattack.value = 2
    
    document.game.enemyarmor.value = 8
    
    document.game.badlife.value = 8
    
    }</pre><p>&nbsp;PS: For some reason code bbtags don't work, what should I be using instead?<br></p><p></blockquote></p><p>An actual &lt;pre&gt; tag in HTML might work, testing.</p><p>Anyway - obviously it's double-spaced so if they need to add something later they don't have to change all the line numbers.&nbsp;</p>


  • Random832! Your avatar! What have you d



  • @Welbog said:

    I can think of reasons to block code into paragraph-like chunks with whitespace fore and aft


    That's what I do. I also include a comment at the top of the "chunk". Double-spacing every line would just give me a headache and make it really hard to look through.



  • @PSWorx said:

    randum.

    nuff said. 

    More like "Randum and Randumber" if you ask me!




  • SOS DAN 4EVA

     Also I am likink bstorer's avatar and also psworx's. Very clever u guise.


     



  • i like 

     if (1 > yourlife)

     just one of those odd quirks.  Nothing wrong with it, just most people I know would have written

    if (yourlife < 1)

     kind like:  for(int i = 0; strLength > i; i++) , there's nothing wrong with it, but who writes like that?



  • ::performs an UPDATE query on the universe so as to reverse Random832's icon::

    (...man, I really need a life. And I just switched to the Nagato-san icon a couple weeks ago too.)



  • @codeman38 said:

    ::performs an UPDATE query on the universe so as to reverse Random832's icon::

    (...man, I really need a life. And I just switched to the Nagato-san icon a couple weeks ago too.)

    You could try a greasemonkey script. That comes pretty close to UPDATE'ing the universe. 



  • @codeman38 said:

    ::performs an UPDATE query on the universe so as to reverse Random832's icon::

    (...man, I really need a life. And I just switched to the Nagato-san icon a couple weeks ago too.)

     I hear that'll work better if executed from an IP based in Canada.
     



  • Canada? That's gotta be fake!



  • Finally managed to get it to reverse as suggested... the old one got all pixel-y anyway, I couldn't even change it, then I had to defeat some kind of giant bug and then suddenly changing it worked.

    Weird. 



  • Doublespacing happens when you save text in editors that are using different line endings. (if editors aren't very smart)



  • Speaking of broken text editors, here's a WTF I stumbled upon today: you can't undo a find/replace all in Notepad. It only undoes the last one changed. Not to mention that it takes a noticeable amount of time to complete on a file that isn't even very big!



  • @Welbog said:

    I have some coworkers who double space their code. For the most part I don't know why. I can think of reasons to block code into paragraph-like chunks with whitespace fore and aft, but why double space every line?

     They're probably liberal arts students. All liberal arts papers are double spaced.



  • This code looks a lot like the stuff I wrote long before I hit puberty.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.