
-----------------------------------
wtd
Tue Aug 24, 2004 5:15 pm

Programming challenges
-----------------------------------
The "Hello world" thread in Spam, which I shamelessly took over, got me thinking about doing more such threads.

The basic idea is:


Post a clearly described problem.
Others come in and solve the problem in their programming language of choice.


Guidelines:


Problems should not involve graphical elements.  This is merely to ensure that all languages (some of which don't have integrated solutions for graphics) are on a roughly equal playing field.  Also, the majority of the program should involve solving the problem, not manipulating pixels.
Each member is allowed to submit a maximum of one solution in Turing, C++, or Java, due to the popularity of these languages.
Each member should only submit a maximum of two solutions per day.
Submitted solutions should adhere to standard naming conventions for the language they're written in.
It's not a contest.  There's no best answer.  The goal is simply to see both how others would solve the same problem in the same language, and  how the problem is solved in other programming languages.
Solutions should be tested before being submitted.  Members posting problems can specify multiple sets of input to the program and the matching correct output for testing purposes.


Thoughts?  :)

-----------------------------------
bugzpodder
Wed Aug 25, 2004 9:30 am


-----------------------------------
i dont think many ppl are interested in this... btw clearify if hte problems should be algorithmic in nature... if not what should be the problems like

-----------------------------------
Tony
Wed Aug 25, 2004 3:32 pm


-----------------------------------
if not what should be the problems like

I think wtd ment no visualization type of problems. Though those tend to be much more fun since you can visually enchance your results rether than spitting out same sets of numbers as everybody else, but you achieved the result in say ruby rether than turing :? 

point is - there needs to be a goal to be reached (nicest animation), or a limitation (in # of lines... that was fun) or anything that is tangeble (fastest execution) to compare the entries. Something as a driving force to make you program and show that you're better than everybody else is (untill catalyst submits his entry :lol: )

-----------------------------------
wtd
Wed Aug 25, 2004 5:14 pm


-----------------------------------
i dont think many ppl are interested in this... btw clearify if hte problems should be algorithmic in nature... if not what should be the problems like

Well, the problems can be "real world" things, but they should lean toward algorithmic.  

Real software is layered.  You use one set of code, for instance, to determine what moves characters should make, and another to draw those movements.  The two shouldn't be mixed.

I think that the emphasis here has typically been on the latter, at the expense of the former, and that concentrating on the algorithms, rather than just manipulating pixels would be a good thing.  :)

-----------------------------------
Martin
Thu Aug 26, 2004 12:20 pm


-----------------------------------
Okay, here's a warmup. The Barn Door problem, stolen from USACO.

 It was a dark and stormy night that ripped the roof and gates off the stalls that hold Farmer John's cows. Happily, many of the cows were on vacation, so the barn was not completely full.

The cows spend the night in stalls that are arranged adjacent to each other in a long line. Some stalls have cows in them; some do not. All stalls are the same width.

Farmer John must quickly erect new boards in front of the stalls, since the doors were lost. His new lumber supplier will supply him boards of any length he wishes, but the supplier can only deliver a small number of total boards. Farmer John wishes to minimize the total length of the boards he must purchase.

Given M (1 