in reply to Re^2: My first cpan module - App::ForKids::LogicalPuzzleGenerator
in thread My first cpan module - App::ForKids::LogicalPuzzleGenerator

You are probably right about the matrix. I have a website which contains the puzzles and there are some diagrams generated to fill them:

http://www.pawelbiernacki.net/4kids/logicalpuzzle/4x4/puzzle_4x4_en_US_0.jsp.

I think the diagram reflects the matrix you have mentioned.

The version on my website is available in different languages but I was not sure how to apply gettext on a Perl project by ExtUtils::MakeMaker, so I simply removed the translations.

Pawel Biernacki
  • Comment on Re^3: My first cpan module - App::ForKids::LogicalPuzzleGenerator

Replies are listed 'Best First'.
Re^4: My first cpan module - App::ForKids::LogicalPuzzleGenerator (updated)
by LanX (Saint) on Feb 23, 2018 at 22:34 UTC
    Actually I'm not sure how complicated your clauses can become, I'm a bit too busy to dive in now.

    But the example given in the OP should be solvable by filling 3 zeros for each clause and applying simple deduction rules on the 3x3 cuts.

    I think the strength of prolog comes to play if you apply more complicated rules.

    Please don't take this as a critic of your work, just theoretical observations. :)

    update

    Applying the rules given on a 3x3x3 matrix displayed by 3 cuts by name:

    • like The one who likes apples is not a blacksmith => 3 zeroes at (apple&blacksmith) x names.
    • and so on:
    FRUITS PROFESSIONS NAMES W B F pineapples apples 0 0 John pears 0 0 0 pineapples 0 apples 0 0 0 Patrick pears 0 pineapples 0 0 0 apples 0 0 0 James pears 0

    Deductions:

    • The apple cut has only one free field
    • => John is a witcher who likes apples
    • All free fields in the witcher and John cut must be filled with zeroes.
    FRUITS PROFESSIONS NAMES W B F pineapples 0 0 0 apples 1 0 0 John pears 0 0 0 pineapples 0 apples 0 0 0 Patrick pears 0 pineapples 0 0 0 apples 0 0 0 James pears 0 0

    Deductions:

    • The James cut has only one field free
    • => James is a blacksmith who likes pears.
    • the remaining fields in blacksmith and pears cut are filled with zeroes.
    FRUITS PROFESSIONS NAMES W B F pineapples 0 0 0 apples 1 0 0 John pears 0 0 0 pineapples 0 0 apples 0 0 0 Patrick pears 0 0 0 pineapples 0 0 0 apples 0 0 0 James pears 0 1 0
    • Only one field free
    • => Patrick is a fisherman who like pineapples.

    I did it manually, hope everything is right and I made the technique of a solver clearer.

    I think you need more complicated rules to challenge people and take advantage of the power of prolog. :)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Wikisyntax for the Monastery

      Putting things into perspective! ;)

      FRUITS PROFESSIONS NAMES W B F pineapples . . . apples . 0 0 John pears 0 0 0 pineapples 0 . . apples 0 0 0 Patrick pears 0 . . pineapples 0 0 0 apples 0 0 0 James pears . . 0

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Wikisyntax for the Monastery