exercism / prolog

Exercism exercises in Prolog.
https://exercism.org/tracks/prolog
MIT License
29 stars 39 forks source link

Add non-zebra puzzle logic exercise #85

Closed sshine closed 7 months ago

sshine commented 5 years ago

zebra-puzzle seems like the Prolog exercise.

Three drawbacks I see with it are: 1) the problem instance is repeated across the internet, and 2) solutions that fit this problem instance is repeated across the internet (in particular on Rosettacode), 3) if one were to solve this exercise in Prolog without copy-pasting from existing solutions, perhaps a smaller instance of the problem in another exercise might work?

zebra-puzzle has 5x5 dimensions; how about a problem with 3x3 dimensions with a completely different theme? Perhaps a theme where you have to solve a murder; three persons (Butler, Countess, Lawyer), three potential murder weapons (Letterscale, Candlestick, Telephone), and three rooms (Bedroom, Kitchen, Attic). This should force the student to at least understand what they're copy-pasting.

I don't know if it ruins the free-form structure of the exercise, but I've always wanted to create a puzzle generator for this type of exercise. If we did that, the exercise should be able to handle arbitrary instances of the problem.

Average-user commented 5 years ago

I think thats a good idea. There is this puzzle that I found once. Seems like an option.

bulding with 5 floors
     a. Adam does not live on the top floor
     b. Bill does not live on the bottom floor
     c. Cora does not live on either t  - Building with 5 floors
ding with 5 floors
     a. Adam does not live on the top floor
     b. Bill does not live on the bottom floor
     c. Cora does not live on either the top 
        or the bottom floor
     d. Dale lives on a higher floor than Bill
     e. Erin does not live on a floor adjacent
        to Cora's
     f. Cora does not live on a floor adjacent
        to Bill's
ErikSchierboom commented 1 year ago

I think it's fine to have zebra-puzzle (we just added it) and to then have a different logic puzzle exercise too.

ErikSchierboom commented 1 year ago

I've changed the title a bit

kytrinyx commented 1 year ago

I think it's fine to have zebra-puzzle (we just added it) and to then have a different logic puzzle exercise too.

I agree. We might not want to add them in problem-specifications, but they're brilliant for the prolog track.

ErikSchierboom commented 1 year ago

PR added for the floors puzzle: https://github.com/exercism/prolog/pull/239

ErikSchierboom commented 1 year ago

I've added three logic-based puzzles:

https://github.com/exercism/prolog/pull/239 https://github.com/exercism/prolog/pull/238 https://github.com/exercism/prolog/pull/237

I'm open to more ideas!