A little programming chalenge - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: A little programming chalenge (/thread-171909.html) |
A little programming chalenge - Patrice - 09-15-2010 Hello all, Here is a little programming chalenge (no prices). I will present my solution at HHC 2010. It is all about optimization: be as fast as possible. The goal is to fill as much as possible places in a figure while respecting the rule. The figure is a square or a rectangle. The rule is that there must be no more than 3 consecutive places filled in a row, a colomn or a diagonal.
Here is a 4*4 square : . * * * Since the amount of calculus grows quickly, the programming can be done on a PC.
If you are under a minute of runtime, just make the figure bigger: To compare the results, give the size of your figure, the number of time you have try to fill a place, the timing in seconds, and the language for advice : 4 4 12 0 D Be smart guys :-)
Patrice Edited: 16 Sept 2010, 1:30 a.m. after one or more responses were posted
Re: A little programming chalenge - David Hayden - 09-15-2010 Thanks for posting this Patrice. I always like programming challenges. I think there may be more to the problem than you're stating. For example, if I leave all of the places on the board unfilled, that would meet the rules that you've stated. So are we trying to fill in as many places as possible? Thanks. See you at HHC2010!
Dave
Re: A little programming chalenge - Chuck - 09-15-2010 I don't think that would satisfy the "fill as much as possible" rule.
Re: A little programming chalenge - Patrice - 09-16-2010 You right, Chuck !
Quote: This sentence is not clear enough ? well ! I don't know when I will this forum again, I take plane in 6 hours.
Patrice
Re: A little programming chalenge - David Hayden - 09-16-2010 Oops! I don't know how I missed that the first time around.
Re: A little programming chalenge - Patrice - 09-24-2010 Hi all, Just arrived in Fort Collins. Anyone working on the chalenge ?
Patrice
Re: A little programming chalenge - David Hayden - 09-24-2010 I thought about it a little and tried playing with it on paper, but didn't get much beyond that. One problem I found was figuring out when I had an optimum answer.
Re: A little programming chalenge - Egan Ford - 09-24-2010 I cannot make HHC this year (too much work), I just canceled yesterday, so I may have time this weekend to work on it.
Re: A little programming chalenge - Steve Perkins - 09-24-2010 I thought about it for a while. It's a worthy challenge. I thought it was pretty easy, then I read it again and noticed the "diagonal" requirement.
I'm interested to see the results folks get.
Re: A little programming chalenge - Egan Ford - 09-25-2010 Quote:My first not-so-smart pass (quick and dirty): 4 4 12 0 C 4 5 15 0 C 5 5 18 0 C 5 6 22 1 C 6 6 26 14 C 6 7 31 234 C 7 7 36 0 Just thought about it.I have a rather large project due. So, I'll try for a smart solution next weekend.
Edited: 25 Sept 2010, 9:22 p.m.
Re: A little programming chalenge - Patrice - 09-26-2010 Nice beginning Egan, Brute force attack ? Too bad you were not at HHC. I have not presented my solution to the problem at the conference because schedule was too tight. I have done it only on reduced comity after the end of the conference. I will post my solution in another treat on the forum, so that, you can continue your search and device a solution on your own.
Patrice
|