Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Re: Re: Better algorithm for Number Place Puzzle

by dash2 (Hermit)
on May 23, 2004 at 22:35 UTC ( #355780=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Better algorithm for Number Place Puzzle
in thread Better algorithm for Number Place Puzzle

Mmm. Seems like you think you have an easy solution, but you don't want to use it. What makes you think this problem has more than one solution?
A massive flamewar beneath your chosen depth has not been shown here
  • Comment on Re: Re: Re: Better algorithm for Number Place Puzzle

Replies are listed 'Best First'.
Re: Re: Re: Re: Better algorithm for Number Place Puzzle
by davidj (Priest) on May 23, 2004 at 22:53 UTC
    There is any easy solution: on a 36x36, let the top row be the numbers 1-36, the second row be 2-36,1, the third row be 3-36,1,2, and so on. But that's not the point of the exercise. The point is to find a way to build some intelligence into a program that will randomly generate solutions of any size.

    The problem does have more than one solution. Swapping any two rows or columns of one solution will generate another solution. This can be done repeatedly in any number of combinations to generate thousands of solutions. But again that is not the point of the exercise.

      If the top row has numbers 1-36, and the second row has numbers 2-36, 1, then the top right 6x6 grid contains the number 36 twice. It was my understanding that this wasn't allowed.


        You are absolutely right. Don't know what I was thinking. But then, its the weekend. I can't think too hard all the time :)

      Hmm. In a 36x36, using your solution, the top left 6x6 grid would contain multiple 2's-11's.

      I guess if you move 6 along each time? But then after 6 rows you start repeating.

      But OK, fair enough... you're not interested in the algorithm but more in intelligence to find solutions. Well, I guess one thing would be how you approach the search space.

      At the moment, your approach seems to be "start with some numbers then guess some more". Perhaps an alternative approach would be to think of it as an ordering. You have 36 1's, 36 2's.... and 36 36's. This is your set of numbers. Lay your set out in some initial order. See if it works, if not, try swapping two set members at random.

      That's the initial, brute force solution - pretty stupid and slow. The smarts come in when you decide which numbers to swap.

      Gosh, what you are doing sounds like much more fun than the sort of programming I have to do ;-)

      A massive flamewar beneath your chosen depth has not been shown here

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://355780]
[afoken]: http://floating- ?
[haukex]: What Every Computer Scientist Should Know About Floating-Point Arithmetic?
[Discipulus]: the winner is..
[Discipulus]: Mr haukex from Germany! thanks a lot to the other parteciapant our dear Mr afoken.. ;=)
[Discipulus]: no, seriously thanks both, i missed 'scientist' and 'floating point' and the resarche was imposible..
Discipulus go to his cell to bookmark this
[haukex]: Well to be honest I just did a super search for "every should know floating" ;-)

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2017-06-26 20:51 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (594 votes). Check out past polls.