in reply to Re: Odd Ball Challenge
in thread Odd Ball Challenge

zby,
All the information is there. Your code should not be a translation of a solution to the riddle, it should be a solution-generator. Your code has to figure out how to divide 12 balls into groups, weighing 2 groups at a time for a total of 3 times. The problem is not solved unless the set of groupings and weighings results in the ability to determine which 1 of the 12 balls is odd and how it is odd (heavy or light).

In a previous reply I outlined two approaches one might take but anyone is free to come up with another one. Printing out a constant isn't trivial if the programmer doesn't explicitly state the constant but rather writes code to go look for a solution and gives it criteria to know when it is successful.

Cheers - L~R

Replies are listed 'Best First'.
Re^3: Odd Ball Challenge
by zby (Vicar) on Jun 24, 2005 at 12:39 UTC
    So take following riddle - "How much is it 2 + 2?". You want a program that would print a program printing solution to this riddle. I say this the solution to this is:
    print "print 4;";
    But you say that this is not enough, that the solution should somehow compute the "print 4;" output.
      zby,
      No, the riddle would be more like:

      Produce a prime number whose sum when added to itself is the same as the product if multiplied by itself.

      The point is that until you know the answer is 2 + 2 = 4 = 2 * 2, you can't write a program that prints out 4. The challenge is not to figure out the solution and then write a translation of that solution into the program. The challenge is to write a program that given the rules can figure out a solution (since there may be more than one).

      If it is still not clear and you need another example, see Challenge: Setting Sun Puzzle.

      Cheers - L~R

        The question is how much knowlege can I use in the solution. That is you need to define the proces of 'finding the solution'.