Programmer Humour :)
SoulSkorpion
Join Date: 2002-04-12 Member: 423Members
Especially directed at anyone who's doing\done a Computer Science course <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->
English:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
If you're happy and you know it, clap your hands.
If you're happy and you know it, clap your hands.
If you're happy and you know it,
And you really want to show it,
If you're happy and you know it, clap your hands.
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Discrete mathematics:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
for all x, Happy(x) ^ Knows(it, x) -> ClapHands(x)
for all x, Happy(x) ^ Knows(it, x) -> ClapHands(x)
for all x, Happy(x) ^ Knows(it, x) ^ ReallyWantsToShow(it, x) -> Happy(x) ^ Knows(it, x) -> ClapHands(x)
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Pseudocode:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
LOOP twice
?IF happy AND know it
? ?clap hands
?END IF
END LOOP
IF happy AND know it AND really want to show it
?IF happy AND know it
? ?clap hands
?END IF
END IF
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
C++:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
//ClapHands.cpp
#include <world>
namespace globals
{
?extern std::person *you
}
int main()
{
?for(int c = 0; c < 2; c++)
?{
? ?if( globals::you == HAPPY && globals::you->Know(IT))
? ?{
? ? ?globals::you->ClapHands();
? ?}
?}
?if( globals::you == HAPPY && globals::you->Know(IT) && globals::you->WantToShow(IT|REALLY) )
?{
? ?globals::you->ClapHands();
?}
?return 0;
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Java:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
//ClapHandsClass.java
public class ClapHandsClass
{
public static void main(String [] args)
{
?for(int counter = 0; counter < 2; counter++)
?{
? ?if( Java.Lang.Object.World.People[YOU].GetIsHappy() && Java.Lang.Object.World.People[YOU].Know(IT) )
? ?{
? ? ? Java.Lang.Object.World.People[YOU].Clap( Java.Lang.Object.World.People[YOU].BodyParts[HANDS] );
? ?}
?}
?if( Java.Lang.Object.World.People[YOU].GetIsHappy() && Java.Lang.Object.World.People[YOU].Know(IT) && Java.Lang.Object.World.People[YOU].ReallyWantToShow(IT) )
?{
? ?if( Java.Lang.Object.World.People[YOU].GetIsHappy() && Java.Lang.Object.World.People[YOU].Know(IT) )
? ?{
? ? ? Java.Lang.Object.World.People[YOU].Clap( Java.Lang.Object.World.People[YOU].BodyParts[HANDS] );
? ?}
?}
}
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
C:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
//ClapHands.c
#include <world.h>
extern PERSON you;
int main(){
?int c;
?for(c=0;c<2;c++){
? ?are(&you,HAPPY|KNOW_IT)?Clap(&you,HANDS):;
?}
?are(&you,HAPPY|KNOW_IT|REALLY_WANT_TO_SHOW_IT)?Clap(&you,HANDS):;
?return 0;
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
<!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->
[edit]believe it or not, I'm actually having to debug this code <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->[/edit]
English:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
If you're happy and you know it, clap your hands.
If you're happy and you know it, clap your hands.
If you're happy and you know it,
And you really want to show it,
If you're happy and you know it, clap your hands.
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Discrete mathematics:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
for all x, Happy(x) ^ Knows(it, x) -> ClapHands(x)
for all x, Happy(x) ^ Knows(it, x) -> ClapHands(x)
for all x, Happy(x) ^ Knows(it, x) ^ ReallyWantsToShow(it, x) -> Happy(x) ^ Knows(it, x) -> ClapHands(x)
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Pseudocode:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
LOOP twice
?IF happy AND know it
? ?clap hands
?END IF
END LOOP
IF happy AND know it AND really want to show it
?IF happy AND know it
? ?clap hands
?END IF
END IF
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
C++:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
//ClapHands.cpp
#include <world>
namespace globals
{
?extern std::person *you
}
int main()
{
?for(int c = 0; c < 2; c++)
?{
? ?if( globals::you == HAPPY && globals::you->Know(IT))
? ?{
? ? ?globals::you->ClapHands();
? ?}
?}
?if( globals::you == HAPPY && globals::you->Know(IT) && globals::you->WantToShow(IT|REALLY) )
?{
? ?globals::you->ClapHands();
?}
?return 0;
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Java:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
//ClapHandsClass.java
public class ClapHandsClass
{
public static void main(String [] args)
{
?for(int counter = 0; counter < 2; counter++)
?{
? ?if( Java.Lang.Object.World.People[YOU].GetIsHappy() && Java.Lang.Object.World.People[YOU].Know(IT) )
? ?{
? ? ? Java.Lang.Object.World.People[YOU].Clap( Java.Lang.Object.World.People[YOU].BodyParts[HANDS] );
? ?}
?}
?if( Java.Lang.Object.World.People[YOU].GetIsHappy() && Java.Lang.Object.World.People[YOU].Know(IT) && Java.Lang.Object.World.People[YOU].ReallyWantToShow(IT) )
?{
? ?if( Java.Lang.Object.World.People[YOU].GetIsHappy() && Java.Lang.Object.World.People[YOU].Know(IT) )
? ?{
? ? ? Java.Lang.Object.World.People[YOU].Clap( Java.Lang.Object.World.People[YOU].BodyParts[HANDS] );
? ?}
?}
}
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
C:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
//ClapHands.c
#include <world.h>
extern PERSON you;
int main(){
?int c;
?for(c=0;c<2;c++){
? ?are(&you,HAPPY|KNOW_IT)?Clap(&you,HANDS):;
?}
?are(&you,HAPPY|KNOW_IT|REALLY_WANT_TO_SHOW_IT)?Clap(&you,HANDS):;
?return 0;
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
<!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->
[edit]believe it or not, I'm actually having to debug this code <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->[/edit]
Comments
Anyways, this was funny.
I get everything except c++, although i can follow it, but wouldnt be able to code it.
The java one looks alot longer than it needs to be.....
me thinks about it.
C: DOS run
run DOS run
me thinks about it. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
Yeah, that was intentional. I was trying to caricature the languages, you could say <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
/me waits for some one to right the 2 line scheam one <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
amusing side line:
One of our projects was to write a program (java) that would turn any fraction (x/y) into an egyption frac (just adding things like 1/x + 1/y + 1/z ... never repeating a denomenator, yah it sucks)
Well our programs all ran horribly (some just wouldn't) then one of the seniors showed me his program that did the same thing in scheam. It took longer to print the ans then to calculate it... Stupid delta.... <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
lolfighter... you didn't get the english one? <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->
Anyways, this was funny. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
NOOOO! Must learn C++ before I turn into Lolfighter!!!
Hehe, seriously though, that sounds the way i'm going if I don't actually buckle down in this next year at college..... <!--emo&:0--><img src='http://www.unknownworlds.com/forums/html/emoticons/wow.gif' border='0' style='vertical-align:middle' alt='wow.gif'><!--endemo-->
((if ( (and (pred-happy()) (pred-knowit())) ) clap-hands())(if ( (and (pred-happy()) (pred-knowit())) ) clap-hands())(if ( (and (and (pred-happy()) (pred-knowit())) (really-want-to-show-it())) clap-hands())(if ( (and (pred-happy()) (pred-knowit())) ) clap-hands()))
ph34r the parens. PH34R!!!
I understood all of the C++ one....yay
Hooray for "C++ FOR DUMMIES v.4"!!!
<a href='http://99-bottles-of-beer.ls-la.net/' target='_blank'>http://99-bottles-of-beer.ls-la.net/</a>
Examples:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->#include <iostream>
using namespace std;
int main()
{
int bottles = 99;
while ( bottles > 0 )
{
cout << bottles << " bottle(s) of beer on the wall," << endl;
cout << bottles << " bottle(s) of beer." << endl;
cout << "Take one down, pass it around," << endl;
cout << --bottles << " bottle(s) of beer on the wall." << endl;
}
return 0;
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->(define bottles
(lambda (n)
(cond ((= n 0) (display "No more bottles"))
((= n 1) (display "One bottle"))
(else (display n) (display " bottles")))
(display " of beer")))
(define beer
(lambda (n)
(if (> n 0)
(begin
(bottles n) (display " on the wall") (newline)
(bottles n) (newline)
(display "Take one down, pass it around") (newline)
(bottles (- n 1)) (display " on the wall") (newline)
(newline)
(beer (- n 1))))))
(beer 99)
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->ALWAYS beer;
rule Drink {
for tenbeers in 9 8 7 6 5 4 3 2 1 "" {
for beers in 9 8 7 6 5 4 3 2 1 0 {
b = $(tenbeers)$(beers);
if ( $(b) != 99 ) {
ECHO "$(b) bottles of $(<) on the wall!";
}
if ( $(b) = 0 ) {
EXIT "No more $(<)!";
}
ECHO "$(b) bottles of $(<) on the wall. $(b) bottles of $(<). Take one down,";
ECHO "pass it around...";
}
}
}
Drink beer;
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
actauly the java one is wrong, seeing how it usses no oop <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
I meen the only thing you could do was crreate a clap hands sub routine, but you could and it would be fun <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
//ClapHandsClass.java
public class ClapHandsClass
{
import Java.Lang.Object.World.People;
public static void main(String [] args)
{
for(int counter = 0; counter < 2; counter++)
{
if( People[YOU].GetIsHappy() && People[YOU].Know(IT) )
{
People[YOU].Clap( People[YOU].BodyParts[HANDS] );
}
}
if( People[YOU].GetIsHappy() && People[YOU].Know(IT) && People[YOU].ReallyWantToShow(IT) )
{
if( People[YOU].GetIsHappy() && People[YOU].Know(IT) )
{
People[YOU].Clap( People[YOU].BodyParts[HANDS] );
}
}
}
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
I can read that and understand. Help me.
I can read that and understand. Help me. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
Enough beer will purge even the most durable skills and/or memories.
I can read that and understand. Help me. <!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
Enough beer will purge even the most durable skills and/or memories. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
Don't I know it! Ive already erased all knowledge of ADA!
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
eeprom equ $b600
option equ $1039
portc equ $1003
ddrc equ $1007
scdr equ $102f
scsr equ $102e
LCD_stdScr1 fcc "Are you happy?"
LCD_stdScr2 fcc "a:"
LCD_ss1_chars equ 14
LCD_ss2_chars equ 2
LCD_statusG fcc "*claps hands*"
org eeprom
lds $01fb
ldaa #%10100000
staa option
jsr LCD_StdScr
cli
main ldaa #%00010000
staa adctl
main_happy ldaa portc
ldab $ff
cba
ble main_isHappy
jsr LCD_happy
bra main
LCD_isHappy ldd LCD_statusG
lsra
lsra
lsra
lsra
anda #%00001111
oraa #%00110000
jsr LCD_sendChar
ldd LCD_statusG
anda #%00001111
oraa #%00110000
jsr LCD_sendChar
rts
LCD_sendChar psha
sendChar_loop ldaa scsr
bpl sendChar_loop
pula
staa scdr
rts
end
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Okay, so it looks terrible in the forums. Actually, I doubt that program would even run - I'm dead tired, haven't touched ASM in at least a year, and can't remember most of the commands. <!--emo&???--><img src='http://www.natural-selection.org/forums/html/emoticons/confused.gif' border='0' style='vertical-align:middle' alt='confused.gif'><!--endemo-->
.....honestly, that's just a hack job from a similar program I wrote many many moons ago. Can't even remember what the program did, but it was close to a simple user input program.
C++ was my second language, Java my third. So Java annoys the hell out of me, because of all the nice little things I can't do any more in it (one example: no default parameter values).
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->For even more fun, see:
<a href='http://99-bottles-of-beer.ls-la.net/' target='_blank'>http://99-bottles-of-beer.ls-la.net/</a><!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
That C++ one made me laugh out loud <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->actauly the java one is wrong, seeing how it usses no oop<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
There's more wrong with it than that. There's also the fact that "world" is not inside Java.Lang.Object. It's a joke <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Could be worse..... assembly<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
Heh... I was going to do an IJVM version, but I kinda forgot.
...
Anyway, here's another one.
Whitespace:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
<!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->