Code Golf Challenge #2Friday 19 October
On Wednesday 17th October, Seed Software attended a STEM careers fair at the University of Hull. Aiming at second year Computer Science students who are looking for an industrial placement year in 2019/20.
As part of the careers fair, we have devised a code golf challenge for students to complete, with the winner taking home an Amazon Echo Dot.
For anyone not aware, Code Golf is a competition where participents try to complete a challenge using the fewest characters possible. In order to achieve this, you'll have to write code that you wouldn't dream about putting in your coursework though!
"Create a program which outputs all of the numbers in the Fibonacci sequence (1, 1, 2, 3, 5...) between 2 numbers"
- The 2 numbers are passed into the method as args into the main method of the program
- The 2 numbers are inclusive (so if 3 is one of the arguments, 3 should be outputted)
- All of the numbers must be seperated by a comma, the output must only contain numbers, commas and whitespace
- Remember that there are two 1's in the sequence!
You should create a valid C# Console Application that can be run from the Command Line eg. "MyProgram.exe 5 180"
Your program should print the output to the Console window.
Your program's Source Code should contain the fewest amount of characters as possible.
All characters will be counted, including; but not limited to;
- Variable names
- Using statements
The name of the program i.e. The name that is typed in at the Command Prompt is not included.
You are not permitted to use any Library or Code that is not part of the .NET framework.”
Tips and Tricks
Here's a couple of tips which will help shave off those precious characters from your entry:
- Remember to shorten your variables as much as possible, the shorter the better.
- Don't forget that whitespace counts as characters, when optimising your entry get rid of all unnecessary whitespace.
- If you use an if statement or anything using braces, see if you can reorganise your code to remove the braces, every set of braces removed is an extra 2 characters saved.