View Single Post
  #31  
Old May 27th, 2010, 08:53 PM
Ed Kolis's Avatar

Ed Kolis Ed Kolis is offline
General
 
Join Date: Apr 2001
Location: Cincinnati, Ohio, USA
Posts: 4,547
Thanks: 1
Thanked 7 Times in 5 Posts
Ed Kolis is on a distinguished road
Default Re: Off Topic Thread

To get back off-topic, thought I'd share some nursery rhymes... programmer style!

Code:
// Little Bunny Foofoo v1.0 beta
public static void Main()
{
	var foofoo = new Bunny();
	foofoo.Size = 0.001; // foofoo is a little bunny
	var forest = new Forest();
	forest.PopulateMice(typeof(FieldMouse), 50); // TODO - more diverse mouse population
	foofoo.HandleMice(forest);
	var fairy = new Fairy(Alignment.Good);
	for (var chances = 3; chances > 0; chances--)
	{
		fairy.SetDesiredVisibilityOf(foofoo, "mouse handling", false);
		fairy.Warn(foofoo, "mouse handling", "goonification", chances);
		foofoo.HandleMice(Forest);
	}
	fairy.SendLink(foofoo, "somethingawful.com"); // should turn him into a goon!
}
// Mouse event handler
private static void HandleMice(this Bunny bunny, Forest forest)
{
	foreach (var mouse in forest.Mice.OfType())
	{
		bunny.Scoop(mouse); // prevents mouse out of range exception
		bunny.Bop(mouse.Head);
	}
}

REM ANNUAL TODO LIST
1 PRINT "1-2 BUCKLE SHOE"
2 GOSUB BUKLSHOE
3 PRINT "3-4 SHUT DOOR"
4 GOSUB SHUTDOOR
5 PRINT "5-6 PICK UP STICKS"
6 GOSUB PIKUPSTX
7 PRINT "7-8 LAY THEM STRAIGHT"
8 GOSUB LAYMSTRT
9 PRINT "9-10 BEGIN AGAIN"
10 GOTO 1

// Dog Finding Script
// TODO - figure out why we're getting out of memory errors
function FindMyLittleDog() {
	// Find all dogs in world
	var dogs = Array();
	for (var i = 0; i < world.length; i++) {
		if (world[i].type == "dog")
			dogs.append(world[i]);
	}
	// Criterion: it's a little dog
	var littleDogs = Array();
	for (var i = 0; i < dogs.length; i++) {
		if (dogs[i].height < 15)
			littleDogs.append(dogs[i]);
	}
	// Criterion: it's a he
	var littleMaleDogs = Array();
	for (var i = 0; i < littleDogs.length; i++) {
		if (littleDogs[i].sex[0] == 'M' || littleDogs[i].sex[0] == 'm')
			littleMaleDogs.append(littleDogs[i]);
	}
	// TODO - check with SPCA on ethicality of these next search criteria
	var withCuts = Array();
	for (var i = 0; i < littleMaleDogs.length; i++) {
		if (littleMaleDogs[i].cuts["ears"] < 5 && littleMaleDogs[i].cuts["tail"] > 10)
			withCuts.append(littleMaleDogs[i]);
	}
	// Where oh where could he be?!?
	return FindMyLittleDog();
}
__________________
The Ed draws near! What dost thou deaux?
Reply With Quote