From 7f66e61e7e81c85a9aab9587dc40df9d73220033 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 17 Apr 2024 10:57:43 +0200 Subject: [PATCH] Sync the `zebra-puzzle` exercise's docs with the latest data. --- .../zebra-puzzle/.docs/instructions.md | 21 +++++++++++-------- .../zebra-puzzle/.docs/introduction.md | 14 +++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 exercises/practice/zebra-puzzle/.docs/introduction.md diff --git a/exercises/practice/zebra-puzzle/.docs/instructions.md b/exercises/practice/zebra-puzzle/.docs/instructions.md index bf62a85..c666e33 100644 --- a/exercises/practice/zebra-puzzle/.docs/instructions.md +++ b/exercises/practice/zebra-puzzle/.docs/instructions.md @@ -1,6 +1,13 @@ # Instructions -Solve the zebra puzzle. +Your task is to solve the Zebra Puzzle to find the answer to these two questions: + +- Which of the residents drinks water? +- Who owns the zebra? + +## Puzzle + +The following 15 statements are all known to be true: 1. There are five houses. 2. The Englishman lives in the red house. @@ -18,12 +25,8 @@ Solve the zebra puzzle. 14. The Japanese smokes Parliaments. 15. The Norwegian lives next to the blue house. -Each of the five houses is painted a different color, and their -inhabitants are of different national extractions, own different pets, -drink different beverages and smoke different brands of cigarettes. - -Which of the residents drinks water? -Who owns the zebra? - -For folks who are interested in practicing using Unison Abilities, you may want to look at the `Each` ability for expressing list comprehensions, provided by the standard library. More on using the `Each` ability can be found in the [Unison share docs.](https://share.unison-lang.org/@unison/code/latest/namespaces/public/base/latest/;/types/abilities/Each) +Additionally, each of the five houses is painted a different color, and their inhabitants are of different national extractions, own different pets, drink different beverages and smoke different brands of cigarettes. +~~~~exercism/note +There are 24 billion (5!⁵ = 24,883,200,000) possible solutions, so try ruling out as many solutions as possible. +~~~~ diff --git a/exercises/practice/zebra-puzzle/.docs/introduction.md b/exercises/practice/zebra-puzzle/.docs/introduction.md new file mode 100644 index 0000000..c8b7ef7 --- /dev/null +++ b/exercises/practice/zebra-puzzle/.docs/introduction.md @@ -0,0 +1,14 @@ +# Introduction + +The Zebra Puzzle is a famous logic puzzle in which there are five houses, each painted a different color. +The houses have different inhabitants, who have different nationalities, own different pets, drink different beverages and smoke different brands of cigarettes. + +To help you solve the puzzle, you're given 15 statements describing the solution. +However, only by combining the information in _all_ statements will you be able to find the solution to the puzzle. + +~~~~exercism/note +The Zebra Puzzle is a [Constraint satisfaction problem (CSP)][constraint-satisfaction-problem]. +In such a problem, you have a set of possible values and a set of constraints that limit which values are valid. +Another well-known CSP is Sudoku. +[constraint-satisfaction-problem]: https://en.wikipedia.org/wiki/Constraint_satisfaction_problem +~~~~