Greetings my fellow spongineers! Recently Iv’e become quite addicted to code-golfing challenges, so I decided to make my own golfing contest on the Sponge Forums. I also saw another one of these topics on the forums but it was inactive and lacked a good description and guidelines. There is unfortunately no programming section of the Sponge forums so i’m just gonna keep this in the off topic section for now.
I’ve unfortunately had to suspend updates to the Weekly Programming Contests to due a lack of support, and lack of time on my part. Regardless, I will still be active on the Sponge forums and around the community.
Some Information on the Contest:
All the challenges are CODE GOLF which means that you try and make your program have as few bytes as possible. The winner is the person whose source code solves the problem in the fewest number of characters.
WHITESPACE COUNTS but you can compress your code using tools like this: http://codebeautify.org/javaviewer. Be nice though and also post a readable version of your code as well, so others don’t have to format it in an IDE!
All submissions must be written in JAVA to ensure fairness, but nice solutions in other languages are welcome even though they will not count
Each week I will close the existing challenge, post the winner down below, and open a new one at the same time
Each challenge will be posted a separate thread, with this one acting as a hub, to find the current challenge, view older ones, and post suggestions for the contest
Some of the challenges might have solutions elsewhere on the internet and I can’t prevent you from copying other peoples’ code but it ruins the point of the contest which is to have fun
For ease of communication, I will often use the word import to refer to any direct use, through imports (static or not) or fully qualified class names, outside outside of the current class.
Rules:
The submission with the fewest number of characters wins
You must post the character count with your submission or it will not count
Imports are allowed unless otherwise noted and they do not count towards code length.
If imports are allowed, the use imports within the standard Java API ONLY are permitted unless an external library explicitly stated otherwise to be allowed for that specific challenge.
If imports are not allowed, means the use of any class, in any way shape or form outside of the java.lang, package is prohibited.
Static imports are never allowed
All methods must be static and have a public access modifier
If you win by finding a way to shorten someone else’s code, you will be given the win, and they will receive an honorable mention
Also, watch out because if I can think of a sorter solution than the winner… Well, my submissions count too
This sounds like an awesome idea! May I suggest two things:
White-space should not count towards character limit, its not particularly a good program if we can’t read it
Perhaps the first challenge could be a (fully functional) program (with a main method and all that) that reads the amount non-white-space characters in a file?
EDIT: Also, when talking about the “bytes” of the Java program, are we speaking in terms of source or compiled?
Thanks for the suggestions! Hopefully I answered your questions in the revised post. I also already had an idea for first challenge, Iv’e posted it here: [Week One] Programming Contest - Sorting Arrays
It would be interesting to see more challenges like the sorting one where there are many possible methods to do the same thing, but in these cases there is no one clear best for fewest characters.
Yeah, sorry about that. I didnt really think the first one through. The challenge ends in a couple days though so ill be sure to have a better one for week two.