Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra-puzzle: sync #1228

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions exercises/practice/zebra-puzzle/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -18,7 +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.
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.

Which of the residents drinks water?
Who owns the zebra?
~~~~exercism/note
There are 24 billion (5!⁵ = 24,883,200,000) possible solutions, so try ruling out as many solutions as possible.
~~~~
15 changes: 15 additions & 0 deletions exercises/practice/zebra-puzzle/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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
~~~~
Loading