Back to hackBCA Home

Code Golf

Code golf is the activity of writing the shortest code to do something. Despite what it sounds like, this can actually be very entertaining! There are many resources online, including the Code Golf Stack Exchange site, which offers both tips for golfing in various languages and many golfed submissions.

You may choose to golf in whatever language you want, but be aware that some languages are better than others for golfing.

Once you are sure you're done writing your code, submit it with the appropriate form.

If you have any questions, feel free to contact the organizers.

Rules

Your submission may be either a function or a full program. It may take it's input via standard terminal input, or function parameters. It may output via standard terminal output, or via function returns. Leading or trailing whitespace in your code is okay.

Say, for example, the question was about getting the average of two numbers. The following python code would all be valid submissions.

Novice Challenge

Submit

There are many, many sorting algorithms out there, each with it's own pros and cons. You may have learned about a couple, like Bubble, Insertion, Merge, and Quick Sort. The challenge here is to write a sorting algorithm (any of your choosing) in as few characters as possible. Your submission will only be required to sort numbers.

Because the task is to implement a sorting algorithm, you may not use any sorting functions provided by the language/standard libraries. Also, to ensure that you are actually writing decent code, your algorithm must be able to sort ten thousand items in less than a second.

Advance Challenge

Submit

The theme of the hackathon is to reinvent something! I've taken a look, and these roman numerals seem old, clunky, and outdated, so I want a way to get rid of these. At the same time, I've also heard pretty good things about the base-12 counting system. For this, your submission will convert roman numerals to base-12 numbers.

A Quick Primer on Duodecimal

A Quick Primer on Roman Numerals