Page:
Singed Piper (formerly Mark1)resident bagpiper
342 posts
Location: Vermont, USA


Posted:
/*

I believe this thread to have

the intrinsic creativity that

UCOF's thread lacked

*/



0 PRINT "THE LYRICS TO THE BEST SONG EVER\n"

1 PRINT "Aleph not bottles of beer on the wall,\n"

2 PRINT "Aleph not bottles of beer,\n"

3 PRINT "You take one down,\n"

4 PRINT "And pass it around,\n"

5 PRINT "Aleph not bottles of beer on the wall.\n"

6 GOTO 1





/*I got an 89.9% on the geek test*/

EDITED_BY: Singed Piper (formerly Mark1) (1113216852)

Q:What's the difference between the Great Highland Bagpipes and the Northumbrian Pipes?
A:The Great Highland Pipes burn longer.


flidBRONZE Member
Carpal \'Tunnel
3,136 posts
Location: Warwickshire, United Kingdom


Posted:
i was always told it was good syntax to start with 10 and increment in 10s for line numbers, that way you can insert upto 9 lines at a later date inbetween lines, without messing with gotos



Written by: Sym_

Written by: flid

Sym: That's a pretty funky wall, i could use one of those (I could make a fortune out of drunk people!)






Hehe! Is my code the only one without any errors? OK, it's PHP, but it's also very simple!






have a looksie here for it running (with $i set to 10), then guess why i thought it was a funky wall i could make a fortune out of wink

jemima (jem)SILVER Member
Pooh-Bah
1,750 posts
Location: london, United Kingdom


Posted:
Why do I feel left out NOT being such a geek ? ubblol

Never assume
Always Acknowledge


SymBRONZE Member
Geek-enviro-hippy priest
1,858 posts
Location: Diss, Norfolk, United Kingdom


Posted:
oh crap! footinmouth redface

There's too many home fires burning and not enough trees


Singed Piper (formerly Mark1)resident bagpiper
342 posts
Location: Vermont, USA


Posted:
so, the idea of incrementing lines by 10 is someones idea of style... however, using GOTO statements at all in most cases is a horrible violation of style and is simply bad code. I simply allowed them because i was writing VERY simple code

Q:What's the difference between the Great Highland Bagpipes and the Northumbrian Pipes?
A:The Great Highland Pipes burn longer.


FearpigSILVER Member
member - tee hee "member"
279 posts
Location: Bethnal Green, London, England (UK)


Posted:
Oh dear... I read this thread and now have an urge to write it in Action Script or Lingo!!

I need to get out more.

"Whats wrong with the cat?" - Mrs Schrödinger


flidBRONZE Member
Carpal \'Tunnel
3,136 posts
Location: Warwickshire, United Kingdom


Posted:
Written by: Singer

using GOTO statements at all in most cases is a horrible violation of style and is simply bad code




in a language like c/perl/java etc yes, but why is it a horrible violation of style or bad code in 1980's basic?

SymBRONZE Member
Geek-enviro-hippy priest
1,858 posts
Location: Diss, Norfolk, United Kingdom


Posted:
Action script isn't much different from PHP:

for (i=10; i<1; i++) {
trace(etc etc);
}

I am tempted to make it in flash thoug.

Written by:

I need to get out more.



odd...people keep saying that to me, I can't think why though.

There's too many home fires burning and not enough trees


=Flashpoint=SILVER Member
Pasta of Muppets
2,722 posts
Location: in the interwebs..., United Kingdom


Posted:
ubblol @ Sniper

Half an hour to play Dizzy!!!

ohmygodlaserbeamspewpewpew!
ubbrollsmileubbrollsmileubbrollsmileubbrollsmile


SniperBRONZE Member
Snoochie-boochie-noochies!
663 posts
Location: United Kingdom


Posted:
dizzy = god. never did find the tape with the maze one on tho. spellbound rawked.

ready
load "BRING BACK THE C64!"
press play on tape

found "BRING BACK THE C64!"

linden rathenGOLD Member
Carpal \'Tunnel
6,942 posts
Location: London, UK


Posted:
gunna resist the urge to revive my knowledge of VB - would be really annoying to have 1billion pop up boxes on screen - each with another verse *weg*

back


JauntyJamesSILVER Member
Carpal \'Tunnel
3,533 posts
Location: Hampshire College, MA, USA


Posted:
actually, i think a rather bigger problem with mine is that the "int" variable can't hold one billion, at leat i dont think it can, but i'm to lazy to go look up a bigger one so that'll have to do

-James

"How do you know if you're happy or sad without a mask? Or angry? Or ready for dessert?"


SniperBRONZE Member
Snoochie-boochie-noochies!
663 posts
Location: United Kingdom


Posted:
hence the dim...long

think int is somewhere around +-2.7mil

Singed Piper (formerly Mark1)resident bagpiper
342 posts
Location: Vermont, USA


Posted:
too true, try long double in c++ or mabey bigInt if you have the files.

Q:What's the difference between the Great Highland Bagpipes and the Northumbrian Pipes?
A:The Great Highland Pipes burn longer.


=Flashpoint=SILVER Member
Pasta of Muppets
2,722 posts
Location: in the interwebs..., United Kingdom


Posted:
10 print "Spectrum Rocks"
20 goto 10
----------------------------------
10 print "Harrier Attack was the best game ever"
20 goto 10

ohmygodlaserbeamspewpewpew!
ubbrollsmileubbrollsmileubbrollsmileubbrollsmile


Puresockaddict
406 posts
Location: Oxford, UK


Posted:
The challenge here, of course, is to write it in perl in as few characters as possible. I'm not a perl programmer though, so I'll leave it to you guys and actually get on with my dissertation for once biggrin

"Take that, math!"


flidBRONZE Member
Carpal \'Tunnel
3,136 posts
Location: Warwickshire, United Kingdom


Posted:
If you read the full thread, i've already done it in 1 line (on my terminal anyway)

SymBRONZE Member
Geek-enviro-hippy priest
1,858 posts
Location: Diss, Norfolk, United Kingdom


Posted:
It's hard to get it much shorter than the PHP/AS verson with Perl as it uses the same for (x,There's too many home fires burning and not enough trees


flidBRONZE Member
Carpal \'Tunnel
3,136 posts
Location: Warwickshire, United Kingdom


Posted:
well, you can compress the text like i did

SymBRONZE Member
Geek-enviro-hippy priest
1,858 posts
Location: Diss, Norfolk, United Kingdom


Posted:
That doesn't count - it's not writing neeter code.

There's too many home fires burning and not enough trees


flidBRONZE Member
Carpal \'Tunnel
3,136 posts
Location: Warwickshire, United Kingdom


Posted:
surely neater code is that which is more readable (with comments for the dumbass who'se getting your job soon), and hence not as short as possible (assumign there's no performance hit by doing so)?

SymBRONZE Member
Geek-enviro-hippy priest
1,858 posts
Location: Diss, Norfolk, United Kingdom


Posted:
I would say it's better code, not neeter. Messy code doesn't become neeter by adding comments, but it becomes better.

Anyway, in this case it explains itself doesn't it?

There's too many home fires burning and not enough trees


sinjaxBRONZE Member
Member
28 posts
Location: Southampton, United Kingdom


Posted:
public class BottlesOfBeerSong
{
public static void main(String args[]) throws TooGreedyException
{
Wall wall = new Wall(Integer.parseInt(args[0]),100);
You you = new You();
while(wall.hasMoreBottles())
{
System.out.println(wall.countBottlesString() + " " + wall.getBottleString() + " on the " + wall.toString());
System.out.println(wall.countBottlesString() + " " + wall.getBottleString() + "!");
you.takeOneDown(wall);
System.out.println(wall.countBottlesString() + " " + wall.getBottleString() + " on the " + wall.toString());
}
}
}


abstract class Bottle
{
private float units;
Bottle()
{

}
Bottle(float units)
{
this.units = units;
}
public float getUnits()
{
return units;
}
public abstract void deductUnits(float units) throws TooGreedyException;
}

class TooGreedyException extends Exception
{
public TooGreedyException(String s)
{
super(s);
}
}

class BottleOfBeer extends Bottle
{
public BottleOfBeer(float units)
{
super(units);
}
public BottleOfBeer()
{

}

public void deductUnits(float units) throws TooGreedyException
{
if(getUnits() - units < 0) throw new TooGreedyException("Not enough beer");
}
}

class Person
{
Person p;
float drunkenness;
public void passItAround(Bottle b, float drink) throws TooGreedyException
{
b.deductUnits(drink);
drunkenness+=drink;
if(p!=null) p.passItAround(b,drink);
}

public void setNeighbour(Person n)
{
if(p==null)
p = n;
else
p.setNeighbour(n);
}
}

class You extends Person
{
int totalPersons = 1;
public void takeOneDown(Wall wall) throws TooGreedyException
{
System.out.println(toString() + " take one down");
Bottle b = wall.getNextBottle();
if(b == null)
return;

this.passItAround(b,b.getUnits()/totalPersons);
}

public void passItAround(Bottle b, float units) throws TooGreedyException
{
System.out.println("You pass it around");
super.passItAround(b, units);
}

public void setNeighbour(Person n)
{
totalPersons++;
super.setNeighbour(n);
}

public String toString()
{
return "You" ;
}
}

class Wall implements BottleFactory
{
private int count;
private float units;
public Wall(int start, float units)
{
this.count = start;
this.units = units;
}

public boolean hasMoreBottles()
{
if(count > 0 || count == BottleFactory.INFINATE)
return true;
else
return false;
}
public Wall(float units)
{
this.count = BottleFactory.INFINATE;
this.units = units;
}

public Bottle getNextBottle()
{
if(count >= 0) count--;
if(count >= 0 || count == BottleFactory.INFINATE)
return new BottleOfBeer(units);
else
return null;
}

public int countBottles()
{
return count;
}

public String countBottlesString()
{
if(count == BottleFactory.INFINATE)
return "Infinate";
else if (count >0 )
return ""+ count;
else
return "no";
}

public String getBottleString()
{
if(count > 1 || count == BottleFactory.INFINATE || count < 0)
return "bottles of beer";
else if(count == 1)
return "bottle of beer";
else
return "bottles of beer";
}

public String toString()
{
return "wall";
}
}

interface BottleFactory
{
public static int INFINATE = -2;
public Bottle getNextBottle();
public String getBottleString();
}


oh yes...it compiles
features:
- Dynamic runtime bottle allocation
- Guaranteed fair neighbour bottle distribution
- Monitored neighbour drunkenness ratio
- Multi-platform
- Fully-extensible

And no, i'm not avoiding doing real work

Efficient humour: "heh...wang smile"


JauntyJamesSILVER Member
Carpal \'Tunnel
3,533 posts
Location: Hampshire College, MA, USA


Posted:
i wonder, is there a geekier thread on Hop? i love you guys...
ubblove ubblove

-James

"How do you know if you're happy or sad without a mask? Or angry? Or ready for dessert?"


Sir_Sheepold hand
725 posts
Location: Chester, UK


Posted:
too much time on your hands!

Spoiling Christmas for small children since 2003.


SymBRONZE Member
Geek-enviro-hippy priest
1,858 posts
Location: Diss, Norfolk, United Kingdom


Posted:
clap clap clap

There's too many home fires burning and not enough trees


flidBRONZE Member
Carpal \'Tunnel
3,136 posts
Location: Warwickshire, United Kingdom


Posted:
now rewrite it with swing, and put an error check in for people who don't add a number of bottles on the command line smile

flidBRONZE Member
Carpal \'Tunnel
3,136 posts
Location: Warwickshire, United Kingdom


Posted:
Written by:

i wonder, is there a geekier thread on Hop?




there's plenty of me and sym_ arguing over whether macs suck or not smile

SymBRONZE Member
Geek-enviro-hippy priest
1,858 posts
Location: Diss, Norfolk, United Kingdom


Posted:
But I always win

Oops...there I go again! wink

After that amazing attempt I might just make a Flash one now...*grabs Powerbook and starts work....*

There's too many home fires burning and not enough trees


Singed Piper (formerly Mark1)resident bagpiper
342 posts
Location: Vermont, USA


Posted:
sinjax, i did not expect that... KUDOs... i thought this thread was going to peter out after about 5 responses... anyone else know python?

Q:What's the difference between the Great Highland Bagpipes and the Northumbrian Pipes?
A:The Great Highland Pipes burn longer.


sinjaxBRONZE Member
Member
28 posts
Location: Southampton, United Kingdom


Posted:
A swing front end

[censored]

there goes my wednesday

Efficient humour: "heh...wang smile"


Page:

Similar Topics

Using the keywords [honor ucof] we found the following existing topics.

  1. Forums > In honor of UCOF.... [75 replies]

      Show more..

HOP Newsletter

Sign up to get the latest on sales, new releases and more...