[oclug] Programming Wars: April 2001
Vic Gedris
vic at worldwidepunk.com
Fri Mar 9 11:32:36 EST 2001
Here's a quick update for the Programming Wars contest! Feel free to
email me personally or post to the group if you have any questions about
it.
I will need a couple of people to help "judge" the entries. Please let
me know if you can do that. We will also need a laptop to test
everyone's programs on at the April meeting. If someone can volunteer
one, that would be very nice.
Prizes for the winners are being furnished by Computer Books For Less
and Giffin Scientific (free stuff, hey, you gotta like that).
Let's hope this goes over well, and you enjoy doing it!
Cheers,
Vic
--
------------------------------------------------------------------------
vic at worldwidepunk.com WORLD WIDE PUNK http://www.worldwidepunk.com
------------------------------------------------------------------------
THE PROGRAM:
This month's program will be a simple clone of the 'tree' utility.
Tree is like a form of 'ls', the difference is that 'tree' provides a
depth-indented list of files and directories in a tree-like format.
For example, running the 'tree' command on a user's home directory
might produce output like:
[vic at iggy vic]$ tree
.
|-- files
| |-- acrobatreader.tar.gz
| |-- downloads
| | |-- gcombust.tar.gz
| | `-- mozilla.tar.gz
| |-- resume.pdf
| `-- xboing.rpm
|-- mail
| |-- inbox
| |-- oclug
| |-- outbox
| `-- sent
|-- mp3list.txt
`-- public_html
|-- index.html
`-- mypic.jpg
The syntax for the tree command must work like this:
tree [options] [directory]
Where [options] may include -d -s -ds or -sd (or nothing at all!), and
[directory] is an optional directory where the tree should start from.
The -d option lists directories ONLY.
The -s option lists the size of the file/directory before the filename:
|-- [ 14056567] linux-2.2.17.tar.bz2
So a valid command can also be:
tree -d -s /usr/src/linux
Other notes:
- All output should be to STDOUT
- Hidden files (beginning with a .) are *never* to be displayed
- Symbolic links must show what the link destination is:
|-- cache -> /tmp/netscapecache
- Broken symlinks (where the destination file does not exist!) should
be in brackets:
|-- cache -> (/tmp/netscapecache)
- If you don't have 'tree' installed on your computer, you should be
able to download a package from your distro's FTP site to use as
reference. Just copying the source code is not cool. ;-)
- There is no need to implement any of the other 'tree' options or
features. Remember, points go towards simplicity and size of code.
THE RULES:
1) In the spirit of Linux, the solutions should be made available
under the terms of the GPL, and maybe we will post them to the
website.
2) The program must run under Linux (Duh!)
3) You can use any language you want that has a working compiler or
interpreter under Linux. If you use something other than C/C++,
sh/bash, Perl, or Python, please email me to make sure I can
install it on the test machine in time for the demos.
4) If your program requires external modules/libraries/headers/etc
that are not part of the standard distribution of the language,
let me know well in advance.
5) You can work as an individual, or in teams.
6) An individual or team can submit more than 1 solution, but only one
of those solutions can win.
7) To win, you must bring a floppy disk containing the source code to
your solution to the next OCLUG meeting (April 5th, 2001). You
can also email me your code at least two days in advance (or more
if you think I might have problems with the language!) to make
sure I can get it to run in advance. At least 1 group member
must attend the OCLUG meeting if you want to win.
8) Discussion of solutions/algorithms is encouraged.
HOW TO WIN:
To win, solutions must be reasonably correct and free of errors.
Programs will be judged on the following criteria:
1) Fastest execution speed
2) Smallest size (byte size of source file)
3) Most elegant solution. A matter of taste, but code that is short,
simple to understand, and well planned out should win. This will
be voted on.
4) Best overall
_______________________________________________
oclug mailing list
oclug at lists.oclug.on.ca
http://www.oclug.on.ca/mailman/listinfo/oclug
More information about the OCLUG
mailing list