Jump to content
Sign in to follow this  
NerdFencer

Funny Code

Recommended Posts

NerdFencer

Here is some code written specifically to be funny.

#cs ----------------------------------------------------------------
; This is an attempt to prove that code can be funny
; Thanks to XKCD for getting me started
#ce ----------------------------------------------------------------

Func getRandomNumber()
    Return 4    ; Chosen by a fiar dice roll, guarenteed to be random
EndFunc

Func answerQuestion($sQuestion)
    Return Chr(48+(6*9-Mod(6*9,13))/13)&Chr(48+Mod(6*9,13)) ; Returns 42
    ; The answer to the ultimate question must ultimately be the answer to whatever they want to know
EndFunc

Func getBooleanInput()
    Local $Elvis = Number(InputBox("Boolean Input","Please input some number"))
    Return Not($Elvis==0xDEAD)
EndFunc

Func Main()
    Local $HELL_FREEZES_OVER = False
    Local $msg
    GUICreate("some GUI")
    GUISetState()
    Do
        $msg = GUIGetMsg()
        Switch $msg
            Case -3
                Exit
            Case Default
                Sleep(15)
        EndSwitch
    Until $HELL_FREEZES_OVER
EndFunc

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Share this post


Link to post
Share on other sites
JRSmile

the ultimate Function was something like that i thought:

func ask($sQuestion) 
Local $len = StringLen($sQuestion) 
Local $hex = StringToBinary($sQuestion) 
Return BinaryMid($hex,1,$len/2+($len/2*-1))+(13.369409517746299538437052363521*3.1415) 
EndFunc

$a=StringSplit("547275737420796F757220546563686E6F6C75737421","")For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4)Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])))''Chr("a")&"HI"Next;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile;MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)

Share this post


Link to post
Share on other sites
doudou

Very funny!

All this is effectively equivalent to:

Func WhatIsTheAnswer($whatEver)
   Return 42
EndFunc

If someone of you would come up with a function that would work on calculation of the answer for 7.5 million years, that would be an achievement...

By the way, tried this already? Look at the top result...


UDFS & Apps:


DDEML.au3 - DDE Client + Server[*]
Localization.au3- localize your scripts[*]
TLI.au3 - type information on COM objects (TLBINF emulation)[*]
TLBAutoEnum.au3 - auto-import of COM constants (enums)[*]
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector

- OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Share this post


Link to post
Share on other sites
dani

If someone of you would come up with a function that would work on calculation of the answer for 7.5 million years, that would be an achievement...

Here you go :mellow:

Func WhatIsTheAnswer($whatEver)
  $iMillion     = 1000000
  $iDaysPerYear = 365.25  
  $iDays        = 7.5 * $iMillion * $iDaysPerYear  
  For $i = 1 To $iDays/24
    Sleep(2147483647) ; Max value for Sleep (= 24 days)
  Next
  Return 42
EndFunc

Share this post


Link to post
Share on other sites
doudou

Here you go :mellow:

Func WhatIsTheAnswer($whatEver)
  $iMillion     = 1000000
  $iDaysPerYear = 365.25  
  $iDays        = 7.5 * $iMillion * $iDaysPerYear  
  For $i = 1 To $iDays/24
    Sleep(2147483647) ; Max value for Sleep (= 24 days)
  Next
  Return 42
EndFunc

Nope, inadequate approach! It is NOT CALCULATING!

Write an algorithm, which does actual calculation and prove that it would take 7.5 million years to complete (best regards from Alan Turing), then we talk!


UDFS & Apps:


DDEML.au3 - DDE Client + Server[*]
Localization.au3- localize your scripts[*]
TLI.au3 - type information on COM objects (TLBINF emulation)[*]
TLBAutoEnum.au3 - auto-import of COM constants (enums)[*]
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector

- OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Share this post


Link to post
Share on other sites
NerdFencer

Very funny!

All this is effectively equivalent to:

Func WhatIsTheAnswer($whatEver)
   Return 42
EndFunc

If someone of you would come up with a function that would work on calculation of the answer for 7.5 million years, that would be an achievement...

By the way, tried this already? Look at the top result...

The way it is implemented in the function computes the equation 6*9, does a base conversion, and returns the answer as a string, which is more true to the story than just returning the numeric quantity 42. I quote the ultimate question, "What do you get if you multiply six by nine?"

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Share this post


Link to post
Share on other sites
doudou

The way it is implemented in the function computes the equation 6*9, does a base conversion, and returns the answer as a string, which is more true to the story than just returning the numeric quantity 42. I quote the ultimate question, "What do you get if you multiply six by nine?"

Well, if you put it like this...

And still I doubt Deep Thought took this method and spent 7.5 million years with that. After all the ultimate question isn't "What do you get if you multiply six by nine?" but "What's the address of Stravo's club in London?".

Chapter 25:

"Just there, number forty-two," shouted Ford Prefect to the taxi-driver. "Right here!"

LOL

Edited by doudou

UDFS & Apps:


DDEML.au3 - DDE Client + Server[*]
Localization.au3- localize your scripts[*]
TLI.au3 - type information on COM objects (TLBINF emulation)[*]
TLBAutoEnum.au3 - auto-import of COM constants (enums)[*]
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector

- OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Share this post


Link to post
Share on other sites
JRowe

But the ultimate question and the ultimate answer can't exist in the same universe, so the question actually was "what is 6*9"

Share this post


Link to post
Share on other sites
doudou

But the ultimate question and the ultimate answer can't exist in the same universe, so the question actually was "what is 6*9"

Wait, in the NerdFencer's script they exist even in the same function!

Now the Universe is doomed!!!

We all are gonna die!


UDFS & Apps:


DDEML.au3 - DDE Client + Server[*]
Localization.au3- localize your scripts[*]
TLI.au3 - type information on COM objects (TLBINF emulation)[*]
TLBAutoEnum.au3 - auto-import of COM constants (enums)[*]
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector

- OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×