• Re: Mastermind puzzle (with 3 digits)

    From Ammammata@21:1/5 to All on Mon Feb 26 08:57:57 2024
    XPost: rec.puzzles.crosswords

    HenHanna laid this down on his screen :
    3 digit lock
    [682]: One number is correct and well-placed
    [614]: One number is correct but wrongly placed
    [206]: Two numbers are correct but wrongly placed
    [738]: Nothing is correct
    [780]: One number is correct but wrongly placed

    042

    --
    /-\ /\/\ /\/\ /-\ /\/\ /\/\ /-\ T /-\
    -=- -=- -=- -=- -=- -=- -=- -=- - -=-
    ........... [ al lavoro ] ...........

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Phil Carmody@21:1/5 to HenHanna on Tue Feb 27 19:04:58 2024
    Dumb x-post removed.

    HenHanna <HenHanna@gmail.com> writes:
    3 digit lock
    a) [682]: One number is correct and well-placed
    b) [614]: One number is correct but wrongly placed
    c) [206]: Two numbers are correct but wrongly placed
    d) [738]: Nothing is correct
    e) [780]: One number is correct but wrongly placed

    d & e =>
    f) in [780], 7 and 8 are incorrect, so 0 is wrongly placed

    f & c =>
    g) in [206], 0 is correct, but wrongly placed, so 0 is in the first position

    progress: [0__]

    a & b =>
    h) 6 cannot be correct as its position doesn't change

    h & d =>
    i) in [682], 2 is correct, and well-placed

    progress: [0_2]

    b & h =>
    j) in [614], 4 is correct but wrongly placed

    solution: [042]

    This is not a task for python. Prolog might be a better language if you desperately want to code an answer rather than using just simple logic,
    but surely that's more effort than the above, which is trivial.

    Of course, an automated solver could be repurposed into a puzzle
    generator. Parametrise the size and the alphabet, and you could probably generate puzzles that were bordering on the impractical for a human to
    solve.

    Phil
    --
    We are no longer hunters and nomads. No longer awed and frightened, as we have gained some understanding of the world in which we live. As such, we can cast aside childish remnants from the dawn of our civilization.
    -- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Carl G.@21:1/5 to HenHanna on Tue Feb 27 10:30:03 2024
    XPost: rec.puzzles.crosswords

    On 2/25/2024 1:07 PM, HenHanna wrote:

    What's another great problem like this one?


                    (i just wrote (non-elegant) Python code.)


    Could you share a short, VERY Readable Pythonic code that solves this?

           Thank you!


                    https://i.imgur.com/72LGJjj.jpeg

            3 digit lock
                         [682]: One number is correct and well-placed
                         [614]: One number is correct but wrongly placed
                         [206]: Two numbers are correct but wrongly placed
                         [738]: Nothing is correct
                         [780]: One number is correct but wrongly placed


    HINT -- A mark of a great puzzle,  this one contains a surprise or two.

    I currently don't have time to write code (plus I don't write a lot of
    Python code), but I would suggest writing a Boolean function that takes
    the test number, a "correct and correctly placed" count, and a "correct,
    but wrongly placed" count, for arguments and returns "True" when the
    clue conditions are met, "False" otherwise. Then call the function
    within a loop that cycles over all allowed numbers and checks if all
    conditions are met for each number. It may not be any more "elegant"
    than the code you wrote, but it could be easily adapted for other
    problems (different clues, only test for digits 0 to 4, etc.) The code
    could be made very readable, especially if clues are each on their own
    line. If letters were used instead of digits, the function would not be limited to ten values. The function could also be used as a tool to
    create similar puzzles by looking for clue-sets that yield unique
    solutions.

    ObPuzzle1: Write a "one-liner" program (in Python, Powershell, Basic
    script, etc.), that, although inelegant (even obfuscated :)), finds the solution.

    ObPuzzle2: How many five-clue "clue-sets" for 3-digit numbers (like the example) have an unique solution? The clues could be 0 to 3 "correct
    and well-placed, 0 to 3 "correct but wrongly-placed" (up to 3 "correct").
    --
    Carl G.


    --
    This email has been checked for viruses by AVG antivirus software.
    www.avg.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Blue-Maned_Hawk@21:1/5 to HenHanna on Sat Mar 2 22:10:28 2024
    XPost: rec.puzzles.crosswords

    HenHanna wrote:

    What's another great problem like this one?


    (i just wrote (non-elegant) Python code.)


    Could you share a short, VERY Readable Pythonic code that solves this?

    Thank you!


    https://i.imgur.com/72LGJjj.jpeg

    3 digit lock
    [682]: One number is correct and well-placed
    [614]: One number is correct but wrongly placed
    [206]: Two numbers are correct but wrongly placed
    [738]: Nothing is correct [780]: One number is
    correct but wrongly placed


    HINT -- A mark of a great puzzle, this one contains a surprise or two.

    My answer: mreb sbyybjrq ol sbhe cerprrqvat gjb frrzf gb zrrg nyy bs gur erdhverzragf.

    Now to see if i was correct…



    --
    Blue-Maned_Hawk│shortens to Hawk│/ blu.mɛin.dÊ°ak/ │he/him/his/himself/Mr. blue-maned_hawk.srht.site
    …assuming i'm understanding things correctly, which i may not be.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From HenHanna@21:1/5 to All on Sun Mar 10 01:07:28 2024
    XPost: rec.puzzles.crosswords

    Blue-Maned_Hawk wrote:

    HenHanna wrote:

    What's another great problem like this one?


    (i just wrote (non-elegant) Python code.)


    Could you share a short, VERY Readable Pythonic code that solves this?

    Thank you!


    https://i.imgur.com/72LGJjj.jpeg

    3 digit lock
    [682]: One number is correct and well-placed
    [614]: One number is correct but wrongly placed
    [206]: Two numbers are correct but wrongly placed
    [738]: Nothing is correct [780]: One number is
    correct but wrongly placed


    HINT -- A mark of a great puzzle, this one contains a surprise or two.

    My answer: mreb sbyybjrq ol sbhe cerprrqvat gjb frrzf gb zrrg nyy bs gur erdhverzragf.

    Now to see if i was correct…



    --
    Blue-Maned_Hawk│shortens to Hawk│/ blu.mɛin.dÊ°ak/ │he/him/his/himself/Mr. blue-maned_hawk.srht.site
    …assuming i'm understanding things correctly, which i may not be.





    Here, i can see your XFACE, but...

    Your sig seems to contain strange chars.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)