...

View Full Version : fun bug finding challenge! with interesting comments



gabsillis
12-05-2012, 05:29 PM
I've made this bug riddled code with some funny comments that make it even more difficult. Who's gonna be the first one to make it work?









//to underdstand recursion, see bottom of the file


/*long long ago, in a galaxy far far away*/













//For all those endeavoring to debug this code, I fear for you...
//your task is one of great difficulty
//for those here for the comments...
//read on!


// Autogenerated, do not edit. All changes will be undone.


//the purpose of this horribly convoluted code is to draw a line on a webpage
//for the future me... I apologize in advance

///quick interest calculator.. sorry I need it for class
var principal = 5000;
var rate = 0.1;
var int = 0;
var totalint = 0;
for (i=0,i<5;i++){
// if i ever see this again i'm going to start bringing guns to work
int = principal*rate;
principal = principal + int;
totalint = totalint+int;
// This comment is self explanatory.
console.log(principal);
console.log(totalint);
}
var drawline = function(){
//put the body of the function here
//oh wait! its just below!
// batmon.c drives the rastamobile
for(i=0;i<5;i++){//drunk,fix later
//Debug this!
//muhahahahaha
///////////////////////////this line, along with this code, is heavily commented.
//no debugging software allowed, Cheater!
var x=i;//x is I, I is x, computer will now calculate x... Computer will now calculate I... Computer is calculating me!!!!!!
var bit = 0;//or 1
var byte = 8*bit;
var kilobit = 1024*byte/8;
var megabyte = 1024*kilobit*8;
var gigabyte = //do the math;
var/*give variable name y*/ y /*define variable y as 2*/ = 2;
var slope = 3*x*x;
var yintercept = 2;//bug
/*moth*///<-- thats a bug too!
var debug = function(){
//magic, do not touch
//moth
}
debug("ant");
var ans = slope+yintercept;
console.log("answer");
}
//now draw the variable ans after all ans has been calculated
// sometimes I believe compiler ignores all my comments
};

//catching exceptions is for communists
//thats why I use javascript
var function = function(){
/* Mark: If there's one thing you learn from this code, it is this...
Never, ever fly Air France. Their customer service is absolutely
the worst. I've never heard the words "That's not my problem" as
many times as I have from their staff -- It should, without doubt
be their corporate motto if it isn't already. Don't bother giving
them business because you're just a pain in their side and they
will be sure to let you know the first time you speak to them.

If you ever want to make me happy just tell me that you, too, will
never fly Air France again either (in spite of their excellent
cuisine).

Update by oej: The merger with KLM has transferred this
behaviour to KLM as well.
Don't bother giving them business either...

Only if you want to travel randomly without luggage, you
might pick either of them.
*/
return 1;//returns 1
};
function(){
if (i <3 = you){
console.log("hi mom, or hi Dad");
};

/*
You may think you know what the following code does.
But you dont. Trust me.
Fiddle with it, and youll spend many a sleepless
night cursing the moment you thought youd be clever
enough to "optimize" the code below.
Now close this file and go play with something else.
*/


//initialize christmas tree portion of code
var toConnect = []
var toRead = [ ]
var toWrite = [ ]
var primes = [ ]
var responses = {}
var remaining = {}
// I put on my robe and wizard hat...




//ALL YOUR BASE ARE BELONG TO US

//now time for stage 2! ar ye ready? set? debug!
//I'm sorry, but our princess is in another castle.
//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth
//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth
//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth
//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth
//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth
//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth
//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth
//moth

//moth

//moth

//moth

//moth

//moth
// there are almost more moths here than the national debt! still 12 trillion to go though

//moth

//moth

//moth
//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth
//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

//moth

moth

//moth

moth

//moth

//moth

//mtoh

//Spider! got you!


/* Halley's comment -->)*/
//you only see that comment once every 75 years



// hack for ie browser (assuming that ie is a browser)


//the safety pig has arrived
/*

_
_
_._ _..._ .-', _.._(`))
'-. ` ' /-._.-' ',/
) \ '.
/ _ _ | \
| a a / |
\ .-. ;
'-('' ).-' ,' ;
'-; | .'
\ \ /
| 7 .__ _.-\ \
| | | ``/ /` /
/,_| | /,_/ /
/,_/ '`-'
*/
//sorting function =)
var sort = function(one, two, tree){
var first = ;
var second = ;
var third = ;
if (one.lenth<two.length & one.lenth <three.length){
first = one;
}
else if (two.length<one.length && two.length<three.length){
first = two;
}
else if (three.length<one.length && three.length<two.length){
fist = three;
}
if (two.length < one.length < three.length || tree.length < one.length < two.length)//{
second = one;
}
else if (one.length < two.length < three.length || tree.length < two.length < one.length){
second = two;
}
else if (one.length < three < two.length || two.length < three.length < one.length){
second = three;
}
if(one /= second && one /= first){
third = one;
}
else if(two /= second && two /= first){
third = two;
}
else if(three /= second && three /= first){
third = three;
}
};
//to understand recursion, see the top of this file

gabsillis
12-06-2012, 01:03 PM
anyone want to try it?

Old Pedant
12-06-2012, 07:54 PM
Here. Your code reduced to the only useful and correct parts:


<script type="text/javascript">
</script>


Sheesh. Who would WANT to bother?

gabsillis
12-11-2012, 03:15 PM
haha! I like that reply



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum