Tiny Thor (made with Monkey X)
Develop on Windows or OSX and deploy easily
Crypt of the Necrodancer (made with Monkey X)
New Star Soccer - BAFTA Winner 2013!!! (made with Monkey X )
Ted - The code editor of Cerberus X
Avalon Legends (made with Monkey X)
Race Time (made with Monkey X)

Can you guess the output of this code?

Holzchopf Dec 4, 2018

  1. Holzchopf

    Holzchopf Moderator Staff Member Moderator CX Code Contributor 3rd Party Module Dev

    Messages:
    263
    Likes Received:
    117
    Trophy Points:
    43
    Today I'm challenging you a bit =) Have a look at this code and try to figure out, what it will produce. Then run it. Don't worry, it won't destroy anything.

    Strict

    Function Main:Int()
    Quirky.Run()
    Return 0
    End

    Class Quirky
    Function Run:Void()
    Local i:Int, o:Int, O:Int, I:Int
    Local txt:String
    Local name1:String = "Alice"
    Local name2:String = "Bob"

    ' try to guess the output
    Print("I'm up!")
    #rem
    Well actually that one was easy, wasn't it?

    But behold! It's getting worse >:)
    #end


    ' let's see if we can break it
    For i = 5 To 1 Step -1
    Print(i)
    Next
    Print("I'm still up!")
    ' that was too easy, try some maths
    For i = 5 To 1 Step -1
    o = i * 4 - 6
    O = -o * 5 - 11
    I = (O - 19) / -20
    Print(I)
    Next

    Print("I'm still up!")

    '.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
    ' JUST SOME COMMENTS - DO YOU THINK THEY INFLUENCE THE CODE IN ANY WAY?
    #rem

    Or, maybe, I'm a magician and all this is just to distract you from the real
    thing that's going on

    #end
    .'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'

    ' guess again
    Print("I'm still up!")
    ' WAIT WHAT?
    Print "Who said that? (Looking at "+name1+" who's standing next to Bob)
    ' It's always important to have director instructions in scripts like
    ' these, isn't it?
    ' Now let's find Bob.
    Print( name2 ) ' <- here he is
    ' (Yes he is. Now find him in the output window)
    ' Somehow we're still looking for bob..?
    ' Anyways... Do you know the meaning of these emojis?
    ' ( ͡° ͜ʖ ͡°)
    ' ¯\_(ツ)_/¯
    ' ʕ•ᴥ•ʔ
    ' (⊙_☉)
    ' .·´¯`(>▂<)´¯`·.
    ' )))'"[o..O]'"(((
    ' (o・_・)ノ”(ᴗ_ ᴗ。)
    ' ლ(ಠ_ಠლ)
    Print("Done finding Bob yet?")
    End

    ' this overloads Print so it always appends "Simon says:"
    Function Print:Void(pString:String)
    .Print "Simon says: ~q" + pString + "~q"
    End
    End


    HA HA I like how the syntax highlighter of the forum breaks some lines before the code does :D

    Now be honest - did you guess everything correct?

    Edit damn the syntaxhighlighting of the forum software is better than that one of TED/Mollusk and already gives away some things
     
    Last edited: Dec 5, 2018
  2. MikeHart

    MikeHart Administrator Staff Member Administrator Moderator

    Messages:
    1,237
    Likes Received:
    300
    Trophy Points:
    83
    Nope ....
     
    Last edited: Dec 5, 2018
  3. Holzchopf

    Holzchopf Moderator Staff Member Moderator CX Code Contributor 3rd Party Module Dev

    Messages:
    263
    Likes Received:
    117
    Trophy Points:
    43
    Psst! :D

    (but honestly: don't worry, not a single comment influences the code)
     
  4. MikeHart

    MikeHart Administrator Staff Member Administrator Moderator

    Messages:
    1,237
    Likes Received:
    300
    Trophy Points:
    83
    Btw. I fixed your #rem #end issue. #end has to be always written small.
     
  5. Holzchopf

    Holzchopf Moderator Staff Member Moderator CX Code Contributor 3rd Party Module Dev

    Messages:
    263
    Likes Received:
    117
    Trophy Points:
    43
    Nooooo this gives away the quirks in the code :-O

    Edit
    Had to remove the code tags. Seeing things through the forum-syntax-highlighting is cheating :p

    Edit II
    But thanks for the corrections anyways. I'll try to remember that ;-)