You are not logged in.

#1 2006-01-10 01:39:35

iBertus
Member
From: Greenville, NC
Registered: 2004-11-04
Posts: 2,228

January Programming Competition

January Programming Competition

The goal of this months programming competition is to create a simple utility for reformatting one string given a second formatting string. Each person may create a custom syntax for the formatting string or simply duplicate an already existing one. Please use a logical formatting syntax and nothing too cryptic. For example "tar.gz|tgz" could be an example formatting string that would replace all instances of "tar.gz" with "tgz" in the source string.

The following are requirements for each difficulty level. You may expand your program beyond the scope of these guidelines but your program must do at least the following:

Novice - You must create a simple utility that can match and replace characters in a source string with characters from a formatting string. You do not have to worry about case. This is the basic requirement and may be met using any programming method of the users choice. Your program may not simply call a prexisting program. It must do the work internally. Have fun!

Intermediate - Your program must be able to do everything in novice category and also provide an option (maybe a command line switch) to make the process case sensitive. Note that you should be able to do both a case sensitive and unsensitive operation. Also, you must provide a means of setting the range the formatting operation, instead of always operating on the entire string.

Advanced - You must complete all the above with the addition of processing of pre-defined fields. For example, "001|%d" could mean to replace "001" with the current date. This is a simplistic example, but you get the point. You may create as many of these fields as you wish and these don't have to be limited to static information just the date. Something like a counter (numeric or alphanumeric) would be nice too.

Remember, these are basic requirements. You should probably make a better program than I've outlined here. Also, language is not a factor here and zsh/bash style scripts meet the requirements.

Due Date: Sat, January 28

Programming Competition Guidelines

Offline

#2 2006-01-10 06:23:12

dust
Member
Registered: 2005-06-04
Posts: 152
Website

Re: January Programming Competition

I'm kind of confused. This seems more like a 1 line command than an application. Is there something I'm just not getting?


Writing stories for a machine.

Offline

#3 2006-01-10 13:13:06

Komodo
Member
From: Oxford, UK
Registered: 2005-11-03
Posts: 674

Re: January Programming Competition

That's a really nicely laid out post iBertus, thank you for following the guidelines - you've set a good example wink

dust wrote:

I'm kind of confused. This seems more like a 1 line command than an application. Is there something I'm just not getting?

You've got to write a utility that hase sed-like capabilities dust... I don't know how else iBertus could've explained it, lol! It's not something you could do in one line (unless you use perl and start sufficiently far to the left wink )


.oO Komodo Dave Oo.

Offline

#4 2006-01-10 14:09:00

dust
Member
Registered: 2005-06-04
Posts: 152
Website

Re: January Programming Competition

Heh, now I understand.


Writing stories for a machine.

Offline

#5 2006-01-10 14:24:43

Komodo
Member
From: Oxford, UK
Registered: 2005-11-03
Posts: 674

Re: January Programming Competition

For any moderators reading: Would it be possible to sticky each monthly programming competition, this one included?


.oO Komodo Dave Oo.

Offline

#6 2006-01-10 16:33:38

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: January Programming Competition

Komodo wrote:

For any moderators reading: Would it be possible to sticky each monthly programming competition, this one included?

No problem, but we'll make just one month sticky at a time though, eh?

Dusty

Offline

#7 2006-01-10 18:02:13

Komodo
Member
From: Oxford, UK
Registered: 2005-11-03
Posts: 674

Re: January Programming Competition

Dusty wrote:
Komodo wrote:

For any moderators reading: Would it be possible to sticky each monthly programming competition, this one included?

No problem, but we'll make just one month sticky at a time though, eh?

No shit sherlock! I meant in the same way as you do for monthly screenshot threads, big D wink


.oO Komodo Dave Oo.

Offline

#8 2006-01-10 20:16:39

iBertus
Member
From: Greenville, NC
Registered: 2004-11-04
Posts: 2,228

Re: January Programming Competition

dust wrote:

This seems more like a 1 line command than an application.

That would be a perfectly valid submission big_smile

I picked this type of program because it's a simple starter program for the first competition. Also, it can be expanded greatly by those who feel inspired to over achieve.

Please note a revision to the current guidelines... look up!

Offline

#9 2006-01-10 20:30:31

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: January Programming Competition

iBertus wrote:

Please note a revision to the current guidelines... look up!

Awwwwwww, that blows away my entire idea of submitting sed wrapped in a shell script.  Party-pooper!

Offline

#10 2006-01-10 21:57:07

iBertus
Member
From: Greenville, NC
Registered: 2004-11-04
Posts: 2,228

Re: January Programming Competition

Cerebral wrote:
iBertus wrote:

Please note a revision to the current guidelines... look up!

Awwwwwww, that blows away my entire idea of submitting sed wrapped in a shell script.  Party-pooper!

:twisted: I knew that somebody was going try that  :twisted:

Offline

#11 2006-01-11 16:12:02

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: January Programming Competition

Heh - novice is like 15-20 lines of bash, woot - I'll give you something in all bash... then haskell

Offline

#12 2006-01-11 17:01:08

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: January Programming Competition

phrakture wrote:

then haskell

you are evil!


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#13 2006-01-11 20:12:26

LB06
Member
From: The Netherlands
Registered: 2003-10-29
Posts: 435

Re: January Programming Competition

One question: if it is not allowed to write a wrapper around sed, what is allowed? I mean, if you do a perl/python implementation you're basically writing a wrapper around s/// or sub(), right?

Offline

#14 2006-01-11 20:37:45

arooaroo
Member
From: London, UK
Registered: 2005-01-13
Posts: 1,268
Website

Re: January Programming Competition

I agree with LB06. I know it's difficult to come up with challenges (just for the record, I've been trying to think some up myself), but I think this challenge is dead easy in some languages, and tough in others. That's fine for those with multiple languages under their belt, and can pick the best one for the job.

I personally think that making challenges that are actually 'applications' would be better, rather than 'programs', if you get my drift.

No offense to those involved - I promise.

Offline

#15 2006-01-11 20:42:01

Komodo
Member
From: Oxford, UK
Registered: 2005-11-03
Posts: 674

Re: January Programming Competition

perhaps the challenge should be restricted to writing it in Bash? That way no string-related libraries could be used...


.oO Komodo Dave Oo.

Offline

#16 2006-01-11 20:51:04

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: January Programming Competition

yay. lets start something cool...then put a bunch of silly rules on it, and make it as unfun as possible.
hooray for needless administrativa!

If people only know one language..then let them use that language..or.. gasp.. learn a new one!

I should write mine in perl just to spite you all..
*devil horns*


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#17 2006-01-11 20:52:45

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: January Programming Competition

LB06 wrote:

One question: if it is not allowed to write a wrapper around sed, what is allowed? I mean, if you do a perl/python implementation you're basically writing a wrapper around s/// or sub(), right?

I think the point is that sed easilly supports the intermediate and advanced portions... yes the novice stuff is very short, code wise, but for a novice it brings to light some very important techniques.  I think the true point of this is when you start adding "%foo" fields and case (in)sensitivity stuff.

Offline

#18 2006-01-11 21:05:26

LB06
Member
From: The Netherlands
Registered: 2003-10-29
Posts: 435

Re: January Programming Competition

phrakture wrote:
LB06 wrote:

One question: if it is not allowed to write a wrapper around sed, what is allowed? I mean, if you do a perl/python implementation you're basically writing a wrapper around s/// or sub(), right?

I think the point is that sed easilly supports the intermediate and advanced portions... yes the novice stuff is very short, code wise, but for a novice it brings to light some very important techniques.  I think the true point of this is when you start adding "%foo" fields and case (in)sensitivity stuff.

True. Being a perl-novice, I figured that this was the perfect opportunity to make myself a bit familiar with Perl. The actual replace part is no longer than 5 lines, but I've already learned a lot about pipes and command line args.

Btw, I like this assignment. I was just asking if the script that I was working on would be valid, but on second thought it doesn't really matter to me smile.

Offline

#19 2006-01-11 21:10:36

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: January Programming Competition

I think the sed constraint was basically to say "use the utilities provided by the language.  I mean, even in C you could just use system("sed blah blah");

Offline

#20 2006-01-11 22:45:25

Komodo
Member
From: Oxford, UK
Registered: 2005-11-03
Posts: 674

Re: January Programming Competition

cactus wrote:

yay. lets start something cool...then put a bunch of silly rules on it, and make it as unfun as possible.
hooray for needless administrativa!

Since when did someone put silly rules on it? The specifics of each month's competition are up to the poster, not anyone else, so the 'administrativa', as you so espagnolically put it, isn't involved. Any suggestions I make are just that - suggestions - and have no more weight or authority than anyone else's.

It really DOESN'T matter what people code it in, since they won't win if they do crap code that steals functions from a library, and doesn't implement the functionality itself. Plus, as LB06 and phrakture pointed out, the objective is to learn  big_smile


.oO Komodo Dave Oo.

Offline

#21 2006-01-11 23:09:36

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: January Programming Competition

espagnolically?

??

isn't "espagnol"..the french word for.. spanish?


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#22 2006-01-12 00:30:50

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: January Programming Competition

Hilarious - I have a javascript implementation.  Haskell fails for having some of the worst string handling ever.

Offline

#23 2006-01-12 01:04:14

iBertus
Member
From: Greenville, NC
Registered: 2004-11-04
Posts: 2,228

Re: January Programming Competition

I'm glad everyone seems to be having a good time with this. Yes, the goal is to learn and have fun! I did not want to place any language restrictions on this because the final submission will provide us all with a library of examples for many different languages.

Offline

#24 2006-01-12 02:44:21

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: January Programming Competition

Yeah, I enjoy this one alot - it's not that difficult of a thing to do, so it gives me the chance to try some crazy obscure stuff (I made a tclsh version too, but it sucked)

Offline

#25 2006-01-12 04:42:35

iBertus
Member
From: Greenville, NC
Registered: 2004-11-04
Posts: 2,228

Re: January Programming Competition

Damn, phrak! You going for the prize in every category? lol

Offline

Board footer

Powered by FluxBB