Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Logic Puzzle Challenge
Index -> General Programming
Goto page 1, 2, 3, 4, 5, 6  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wtd




PostPosted: Sun Jul 24, 2005 5:53 pm   Post subject: Logic Puzzle Challenge

I have a 9 by 9 grid.

Each space may contain a number between 1 and 9.

Each row and rolumn may only contain unique numbers.

The grid is further divided into 9 3 by 3 grids.

Each of these smaller grids may only contain unique numbers.

You start out with:

code:
*681*3***
*5**64*3*
2*****846
7**2**18*
1*56**7**
8**75***4
****8**52
*84*9***7
*72**63**


Where asterisks represent unknowns.

Write a computer program which computes the unknowns.
Sponsor
Sponsor
Sponsor
sponsor
1of42




PostPosted: Sun Jul 24, 2005 6:09 pm   Post subject: (No subject)

O.M.F.G.

This is the puzzle that's sweepnig through Canada in the Globe, isn't it? (Name escapes me at the moment).

I'll have to give it a try though.
Hikaru79




PostPosted: Sun Jul 24, 2005 6:12 pm   Post subject: (No subject)

1of42, yes it is, but don't say the name because then people might be tempted to cheat by looking up existing algorithms. Security by obscurity Wink

I'm working on it too Very Happy
wtd




PostPosted: Sun Jul 24, 2005 6:12 pm   Post subject: (No subject)

The example is the July 22nd puzzle. Smile

Oh, and the output should be the same as the input, but with the final values in place of asterisks.
Delos




PostPosted: Sun Jul 24, 2005 6:13 pm   Post subject: (No subject)

I've solved a couple of them. Remind me of my precious Rubicks cube in many respects. Since they are all computer generated, I figure there must be an algorithm to *create* them, thus there ought to be one to solve them.
I have some ideas, though most are pretty long and tedious.

[mod:f88bf0f35e="wtd (I'm guessing)"]One word removed to maintain a fair competition.[/mod:f88bf0f35e]
wtd




PostPosted: Sun Jul 24, 2005 6:17 pm   Post subject: (No subject)

I know it can be solved.

code:
$ wc grid_solver.py
 100  314 3174 grid_solver.py
$


Wink
MysticVegeta




PostPosted: Mon Jul 25, 2005 9:15 am   Post subject: Re: Logic Puzzle Challenge

wtd wrote:

Where asterisks represent unknowns.
Write a computer program which computes the unknowns.


What do you mean? We dont know the relations between the numbers, how to compute the asterisks??? Confused
wtd




PostPosted: Mon Jul 25, 2005 11:24 am   Post subject: Re: Logic Puzzle Challenge

MysticVegeta wrote:
wtd wrote:

Where asterisks represent unknowns.
Write a computer program which computes the unknowns.


What do you mean? We dont know the relations between the numbers, how to compute the asterisks??? Confused


The same number may not occur twice in any row, column, or smaller 3 by 3 grid.
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Mon Jul 25, 2005 4:45 pm   Post subject: (No subject)

Aight, took me 17 whole min...

rizzix wrote:
__________________
|4-6-8 |1-2-3-|5-7-9-|
|9-5-7-|8-6-4-|2-3-1-|
|2-3-1-|9-7-5-|8-4-6-|
|~~~~|~~~~|~~~~|
|7-4-6-|2-3-9-|1-8-5-|
|1-9-5-|6-4-8-|7-2-3-|
|8-2-3-|7-5-1-|9-6-4-|
|~~~~|~~~~|~~~~|
|6-1-9-|3-8-7-|4-5-2-|
|3-8-4-|5-9-2-|6-1-7-|
|5-7-2-|4-1-6-|3-9-8-|
~~~~~~~~~~~~~~
wtd




PostPosted: Mon Jul 25, 2005 4:48 pm   Post subject: (No subject)

Yes, I can solve it by had in around 10 minutes.

Now, show me the program you used to programmatically generate that answer. Smile
rizzix




PostPosted: Mon Jul 25, 2005 4:51 pm   Post subject: (No subject)

i didn;t... it was by hand... Razz i'll work on an algorithm later.. right now i just did that to kill time, altough i got soo much stuff to do pfft...
Hikaru79




PostPosted: Mon Jul 25, 2005 8:34 pm   Post subject: (No subject)

I'm almost done my Python program. Awesome challenge, wtd, I really feel like my Python improved from doing this!

I'll send it to you as soon as it is done, wtd.
wtd




PostPosted: Tue Jul 26, 2005 3:01 am   Post subject: (No subject)

Hikaru79 wrote:
I'm almost done my Python program. Awesome challenge, wtd, I really feel like my Python improved from doing this!

I'll send it to you as soon as it is done, wtd.


Great. I'm working on retooling mine to be more object-oriented... and... you know... work.

The messy one works. The clean, elegant one... not so much. Yet.
bugzpodder




PostPosted: Tue Jul 26, 2005 9:41 pm   Post subject: (No subject)

i am assuming this is an attempt to show that python is much better than C++ in doing this. since i dont know python i'll have to stick to what i know. when i have time this weekend, I'll churn up something in C++. Stay tuned.
wtd




PostPosted: Tue Jul 26, 2005 9:57 pm   Post subject: (No subject)

Any language works. I just picked Python because it has a handy feature in its standard library for this problem. No, I'm not going to tell you what the handy feature is, because that would give away how to solve the problem. Smile
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 6  [ 82 Posts ]
Goto page 1, 2, 3, 4, 5, 6  Next
Jump to:   


Style:  
Search: