Coding competitions
AIman
Posts: 531
I was just thinking that it would be fun to have a competition to see who can do a project in the shortest amount of code. Obviously it would have to be broken out by age or skill level, but still, the projects could be different for the different languages.
For example, the shortest code for running a servo with a sonar attached, or the shortest code for GPS or tempature sensing.
In short (bad pun) take the top 10 or 20 most commonly used items and show the shortest code.
BUT HERE'S THE CATCH - the contestants have to post their code so others can use it AND it has to have comments for each line of code so others can follow it.
The theory is we could learn a lot from each other while still having fun.
Thoughts?
For example, the shortest code for running a servo with a sonar attached, or the shortest code for GPS or tempature sensing.
In short (bad pun) take the top 10 or 20 most commonly used items and show the shortest code.
BUT HERE'S THE CATCH - the contestants have to post their code so others can use it AND it has to have comments for each line of code so others can follow it.
The theory is we could learn a lot from each other while still having fun.
Thoughts?
Comments
The problem with more complicated things is you easily run into rewarding shorter code, regardless of the quality of execution, as long as it meets the bare minimum requirements.
I don't think it is a bad idea, but the requirements for each set of code need to be well specified if we are to make it a competition. Do you allow any pre-existing objects, just ones that are "well accepted", anything in the OBEX, or none at all?
My main intent is to get people thinking about the most commonly used things and ways to make the code shorter. A lot of times people code longer because they don't know how to code in shorter ways or haven't ever been shown how to code in shorter ways.
To use a VBA example the following two pieces of code do the same thing in Excel - get the value from cell A1 using a variable called test.
i=1
test = ThisWorkbook.Worksheets("Sheets1").Range("A" & i).Value
or
Test = ThisWorkbook.Worksheets("Sheets1").Range("A1").Value
Verses
Sheets("Sheet1").select
Range("A1").select
test = Range("A1").value)
They do the same thing except that the very first one allows for a dynamic range while the others are static.
To put this in terms of robotics, coding a servo with sonar by sonar pulses being sent in between the servo pulses allows for a servo to go back and forth while running a sonar. The coding is much shorter than running two loops and trying to get them to match.
http://forums.parallax.com/showthread.php?136008-Black-Friday-Deals&p=1054736&viewfull=1#post1054736