Deductive logic lies at the heart of all programming endeavors. Without logic and reason, we would not have, well, just about anything you associate with "civilization" - and certainly there would be no programming. The better you are at deductive logic, the better you will be at writing software.
So we've decided to offer a weekly quiz to help you strengthen your deductive logical thinking and problem solving skills. These quizzes have nothing to do with PL/SQL or SQL, but we hope you will find them entertaining and worth a few minutes of your time. We truly believe that the faster and easier you can sort through the choices of the logic puzzler, the better equipped you will be to write and debug your code.
The weekly logic puzzle mimics the game of Mastermind, a classic game of deductive logic. Generally, you will be presented with a set of guesses and their clues, and then you must decide which of the choices are a valid deduction from that information.
How the game works
The objective of the game is to guess the sequence of numbers that are in the four-digit solution. Each guess consists of a four digit number, each of whichmust be between 1 and 7. [Note: in the "real" Mastermind game, you use colors for the guesses, but that makes it difficult for people who are color blind to play.]
Clues are given for each guess. Each "P" clue means that a digit is in the solution and it is in the right position (in "classic" Mastermind, this is a black clue). Each "N" clue means that a digit (the number is in the solution, but it is not in the right position (in "classic" Mastermind, this is a white clue). The position of the clue does not correlate with the digits. In other words, the first clue does not apply to the first digit in the guess.
You will be presented with a set of guesses and clues. From that information, you must pick the choices that either are valid deductions from this information, or a possible solution. Here is an example:
[Note: this has been updated since the original posting to fix an error...thanks, Iudith!]
# | Guess | Clues |
---|---|---|
1 | 1 2 3 4 | P,N |
2 | 1 3 6 7 | N |
- 7 5 2 4
- 6 2 4 5
- 2 6 5 4
- 5 must be in the solution.
- Either 6 or 7 must be in the solution, but not both.
- 1 is not in the solution.
So....I hope you find the time to play the logic puzzler. And, as with PL/SQL and SQL quizzes, you are welcome to submit your own logic puzzler for use on the site
Cheers, Steven Feuerstein