Copyright: Copyright 1998 Barry J. Paul
Citation: --- KLogic ---


The blue, cyan, and red generate marks. The blanks do not.


Introduction
KLogic: Introduction

Thank you for trying KLogic. We welcome your comments, suggestions and bug reports.

Please email the author:  bpaul@hoflink.com

Please read about License Information and Registration.

KLogic is a deductive game of the type whose best known example is called "MasterMind." This program allows you to play at eight different levels. Additionally, four of those levels may be customized,  providing a large number of game options.

Our game involves arrays of small spots which must be colored in a particular pattern. Not everyone can distinguish among the various colors used in KLogic so we have provided a Text Display which substitutes letters for colors. The Color Display and Text Display each come in two sizes. Some may find the smaller displays a little cramped but they allow you to see more of the game at once.

We suggest you read the following topics in order.

•	Installing and Removing KLogic

•	Playing the Game

•	Customizing KLogic


OtherLevels

Playing Other Levels

If you have not yet read Playing Level 1 you should do so before reading this topic.

You change the game's level by making a new selection from the Level Menu. Other levels differ from Level 1 in four ways:

•	The number of spots in the solution may be different.

                     Possible Number of Spots: 4 -- 10

•	The number of letters (or colors)  in the palette may be different.

                     Possible number of letters (or colors): 6 -- 10

•	The number of guesses may be different.

                     Possible number of guesses: 8 - 25

•	The "Standard Rule" may be replaced by the rule "Blanks Allowed."

For instance, the default settings for Level 8 are:

See Also [ Color Display ]

Only the last item on the list requires discussion. When Blanks Allowed is in effect any of the spots in the solution may be empty.  And, of course,  you may also have blank spots in your guesses. But when a guess is evaluated only non-blank spots are considered. For example:

                            See Also [ Color Display ]

The 'C', 'A', and 'F' generate marks. The blanks do not.

Next : Sample Games


Customizing

Customizing KLogic

When KLogic starts up it is set to play at Level 1 and to use the Large Color display. During a session you may change those settings but if you close and then reload the program you will be back to Level 1 and Large Color. But if you wish, you may specify other settings and save them to disk. Then the program will always start with your preferences.

Levels 5 - 8 may be redefined. Your redefinitions may take effect only for a single session or you can save them to disk so that they will be in effect each time you run the program.

To make any of these changes pick Customize from the Level Menu or pick Set Default from the Display Menu. In either case you will arrive at the Configure KLogic Dialog, where you can customize one or more features.

•	Default Display: In the Default Display section select the display you want and click
Set Default.  [ Example ]  If you then Save Your Settings to disk, the selected display will be in effect each time you run KLogic.

•	Default Level: In the Levels section select the level you want from the drop-down list and click Set Default.  [ Example ] If you then Save Your Settings to disk, the selected level will be in effect each time you run KLogic.

•	Customize a Level: Only levels 5 - 8 can be customized. In the Levels section select the level  you wish to customize from the drop-down list and click Customize to obtain the View/Customize Dialog.

When you finish making settings click OK on the Configure KLogic Dialog  to get the Save New Settings Dialog.  Or you may click Cancel to abandon your changes and return to play

•	View a Level: In the Levels section delect the level you want to view from the drop-down list and click View to see the Level's Settings.


InstallRemove
Installing and Removing KLogic

To install KLogic just copy the following files to a single directory:

•	KLogic.exe

•	KLogic.hlp

•	KLogic.cnt

If you customize KLogic it will create an additional file:

•	KLogic.cfg

To remove KLogic just delete the files.


                          Viewing a Level's Settings

In the illustration you have selected  Level 3.  Now click on

View  to examine the level's settings.

always start up set for Level 3. Note that this change will not

take effect unless you  Save Your Settings to Disk.


                          Setting the Default Level

In the illustration you have selected  Level 3.  Now click on

Set Default  to make that the default level. i.e. KLogic will

always start up set for Level 3. Note that this change will not

take effect unless you  Save Your Settings to Disk.


                       Setting the Default Display

In the illustration you have selected  Large Text.  Now click on

Set Default  to make that the default display. i.e. KLogic will

always start up set for Large Text. Note that this change will not

take effect unless you  Save Your Settings to Disk.


                                Save New Settings Dialog

Arrive here when you click OK on the Configure KLogic Dialog.

The buttons are self-explanatory.


MakeGuess

Making A Guess

See Also: [ Color Display ]

The Selection spot at the right of the Palette starts out blank. Click on one of the letters in the Palette and it will appear in the Selection spot. Click on a different letter and the Selection spot will change to match it. If you now click on one of the Game Row spots it will acquire the letter in the Selection spot. If you change the palette selection and re-click the Game Row spot its letter will change. If you right-click a Game Row spot it will become blank.

In the example above we clicked on "B" in the Palette and then clicked on the second spot in the Game Row.

Remember that Level 1 follows the Standard Rule -- you must have a letter in each spot to complete a guess.   e.g. Your guess might look like this:

See Also: [ Color Display ]

Now click OK to complete your guess and see it evaluated.

See Also: [ Color Display ]

The symbols "$ X" are the evaluation of your guess -- that 's explained in Evaluating A Guess. You now have a second Game Row for your next guess. Enter a second guess and you will get a third row, and so on, until you find the solution or use up your ten guesses.

Note that completing a guess turns the OK button into a DUP button. Click any DUP button to copy the contents of its row to the active Game Row. This is convenient if you want, say, to try a previous guess with a single spot altered.

Remember:

•	Left click a letter in the Palette to select it.

•	Left click a Game Row spot to give it the selected color.

•	Right click a Game Row spot to clear it.

•	The Standard Rule requires you to fill all spots in the Game Row.

•	Click OK to complete your guess.

•	Click DUP  to copy a previous guess to the current Game Row.

Next: Evaluating A Guess


Playing Level 1

To start play:

•	Select Small Text from the Display Menu.

•	Select Level 1 from the Level Menu.

•	Select Play Game from the Game Menu.

You will see:

See Also: [ Color Display ]

KLogic will randomly select a pattern of four letters to be placed in the spots of the Game Row on top -- the possible letters are those which appear in the Palette below the Game Row. Your goal is to guess the exact pattern.  e.g. The solution might be:

See Also: [ Color Display ]

In Color Display there are no letters, the Palette contains six different colors and each Game Row spot must be filled with one of the colors.

The solution's letters may or may not all be different. Level 1 follows the Standard Rule:  Each spot must contain a letter. An alternate rule, Blanks Allowed, is used in some other levels. (See Playing Other Levels )

You find the solution by trying to guess it. (See Making A Guess)

Each time you guess you will be told how closely your guess matches the solution. (See Evaluating A Guess) These replies are the clues you will use in trying to deduce the solution.

You are allowed ten guesses. If you guess the solution exactly -- the correct letters in the correct order -- you win. If you run out of guesses you lose. You may also give up a game by selecting Quit Game from the Game Menu. If you quit the game you will be shown the solution.

Next : Playing Other Levels


PlayingGame

Playing the Game

There are four display modes available from KLogic's "Display" Menu:

•	Large Color

•	Small Color

•	Large Text

•	Small Text

Our discussions are illustrated with images from the Small Text   Display. Each illustration is accompanied by a link to the equivalent image from the Small Color Display.

Our game can be played  at eight different levels and  four of those levels may be customized,  providing a large number of game options. But all of the various levels are simple variations on the game offered in Level 1.  To learn how to play read each of the following topics in order.

•	Playing Level 1

•	Playing Other Levels

•	Sample Games


Sample Games

Beginners can use these games to get a general idea of how to approach KLogic games while experienced players may pick up a pointer or two.  We do not claim that the approach used to find the solutions of these games is, in any sense, technically correct. Each KLogic player will discover his or her own techniques of play. That's part of the game's appeal.

•	Game 1

•	Game 2

•	Game 3

•	Game 4


                           Configure KLogic Dialog

Configure KLogic from this dialog. There are two ways to reach it.

•	Select  Customize  from the  Level  Menu

•	Select  Set Default  from the  Display Menu


ViewCustomize
View/Customize Dialog

In our example we are offered three possible definitions for Level 6:

•	Original Settings: Level 6 as it was when you first got KLogic.

•	Settings on Disk: The settings currently saved in the KLogic.cfg file for Level 6. If you have no KLogic.cfg file then these settings will be the same as the Original Settings.

•	Customize: These are the settings you have chosen from the four drop-down lists.

In any case click the button beneath your choice to give Level 6 new settings.  Your choice will have no effect until you Save Your Settings. At that time you may limit the application of your settings to the current session or you may save them to disk so they will be in effect each time you use KLogic.


                                           View a Level

When you view one of the levels ( 5 - 8 ) which can be customized,

you will see the settings which were in effect when you left the game

area. To view the original settings or the settings currently saved on

disk, click Customize in the Configure KLogic Dialog to look at the

View/Customize Dialog.


EvaluateGuess

Evaluating A Guess

If you have not yet read Making A Guess you should do so before reading this topic.

Suppose that the solution you are seeking is:

See Also: [ Color Display ]

And suppose you have made this guess:

See Also: [ Color Display ]

The '$' indicates that exactly one letter ( the 'D' )  is precisely correct -- the right letter in the right spot.. The 'X' indicates that, additionally, there is one more letter ( an 'A' ) that fits the solution but is not in the right spot. In Color Display the '$' becomes a blue Square and the 'X' becomes a red square. A guess can yield anywhere from 0 to 4 of these marks, with one '$' for each precisely correct (right letter in the right spot) letter. The total of the '$'s and 'X's answers the question "How many exact matches could I get if I were allowed to rearrange the letters in my guess?"  Let's take a second guess at the same solution:

See Also: [ Color Display ]

Our second guess has two spots exactly right, hence the two '$'s. We could rearrange the guess to get all four spots exactly right so there are a total of four marks. Or we could say that the two 'X's are generated by the first two spots in the guess -- the right letters in the wrong spots.

Our example comes from Level 1 which follows the Standard Rule. See Playing Other Levels for a discussion of how guesses are evaluated when playing Blanks Allowed.

Many more guess evaluations are shown in Sample Games, which discusses how to use evaluations to deduce solutions.


Sample1

Sample Game 1

For our first sample game, we'll look at a Level 1 game in considerable detail.

There are 1296 possible solutions to a Level 1 game. Our first three guesses narrow that down to a more managable 24. (If you are new to this type of game you may find it instructive to try  writing out all 24 possible solutions.)

Guess [1] tells us that either there is an 'A' in the left half of the solution or a 'B' in the right half. Guess [3] tells us that either there is an 'E' in the left half of the solution or an 'F' in the right half.

                    See Also: [ Color Display ]

Combining these two results gives us the four possibilities listed below.  Guess [4 ] is designed to, with certainty, eliminate three of them. For now, ignore the actual result and check that each possibility would cause a different result for guess [4 ].

•	An 'A'  and an 'E' in the left half  --> '$ X'

•	A 'B' and an 'F' in the right half  --> 'No Matches'

•	An 'A' in the left half and an 'F' in the right half  --> '$'

•	An 'E' in the left half and a 'B' in the right half --> 'X'

So after guess [4 ] we know there is an 'A' in the left half of the solution and an 'F' in the right half.

What are the other two letters? Obviously  'CD', 'CC', or 'DD'. Furthermore, one of them will be in the left half and one in the right half. Now look at guess [2]. If the solution had a 'C' on the left and a 'D' on the right the result would be '$$'. A 'D' on the left and a 'C' on the right would yield 'XX'.

But our result is '$X' so the solution contains two 'C's or two 'D's and our first four guesses have left us with eight possible solutions. (Try listing the 8 posible solutions.)

Guess [5] tries one of the remaining possiblities.  The result 'XX' tells us two things: We needed two 'D's instead of the 'C's; and the 'A' and 'F' are each in the wrong place. And since we know that the 'A' is in the left half and the 'F' in the right we can now deduce the solution:

Solution for Sample 1

Points of Interest :

•	Our first three guesses -- each using two colors -- are good technique, helping us to develop a preliminary picture of the solution.

•	Guess [4 ] illustrates a key point.  Suppose instead of guessing 'AAEE' we try 'AAFF', which looks similar.  Given a different solution, the result might  be:

See Also: [ Color ]

But which letter belongs in the solution -- 'A' or 'F'?  Our original guess [4 ] was cabable of distinguishing among four possibilities but the alternate guess gives the same result for two of those possibilities. In choosing guesses (after the first few) you should consider how many different results the guess might yield. The greater the number of possible results, the more effective the guess is likely to be.

Next: Sample Game 2


Sample2

Sample Game 2

The first three guesses of our Level 1 Game have produced only three marks. Why? A little thought will convince you that one letter -- an 'E' or an 'F' -- must appear three times in the solution.

                    See Also: [ Color Display ]

Also the 'X' in guess [3] is significant:

•	If the solution has three 'E's then one of the 'E's in the guess must be misplaced. So, from guess [2], the fourth letter is a 'C' in the left half.

•	If the solution has three 'F's then one of the 'F's in the guess must be misplaced. So, from guess [2], the fourth letter is a 'D' in the right half.

So our first three guesses have left us with only four possible solutions. Guess [4 ] eliminates two of those possibilties so we try a third possibility in guess [5]. As it happens, that guess fails so we are left with only one possibility.

 Solution for Sample 2

Exercise:

When guess [4 ] came up 'No Matches' we were left with two possibilities. When we tried one of them as guess [5] it happened to have been the wrong one, so we would have needed a sixth guess to win this game. Find an alternate guess [4 ] which would guarantee we would not need a sixth guess.

Answer to Exercise

Next: Sample Game 3


          Possible Solutions After Three Guesses

AECD   CDBF   ACFC   CAFC   ECBC   CEBC

AEDC   CDFB   ADFD   DAFD   EDBD   DEBD

EACD   DCBF   ACCF   CACF   ECCB   CECB

EADC   DCFB   ADDF   DADF   EDDB   DEDB


Possible Solutions After Four Guesses

   ACCF   ACFC   CACF  CAFC

   ADDF   ADFD   DADF  DAFD


 Possible Solutions After Three Guesses

   ECEE   CEEE   FFFD   FFDF


Here is one answer to the exercise. Consider the four

possible solutions left after guess [3] and compare each

of them to this guess. Check that each of them would yield a

different result. Then we would be certain to win on guess [5].


Sample3

Sample Game 3

We noted in Game 1 that a Level 1 game has 1296 possible solutions. A Level 3 game has a few more than that -- 262,144 to be exact. Let's see if we can narrow that down. Our first four guesses implement the same technique we used in Game 1 and Game 2.

                    See Also: [ Color Display ]

Guess [5] repeats the technique of Game 1's guess [4 ]. By comparison with [2] and [4 ] it tells us that we have  a 'G' and a 'D', both in the left half of the solution. From guess [1], the remaining four letters are 'A's and 'B's. Check the result of guess [1] to see that there are two possibilities. (Remember there is room for only one 'A' or 'B' in the left half.) :

•	There are three 'A's and one 'B' with the 'B' in the right half.

•	There are three 'B's and one 'A' with the 'A' in the right half.

Put this all together and we are down to 36 possible solutions. Guess [6] tries one of them with three 'A's and a 'B' but gets only four marks. This tells us we needed three 'B's and an 'A', which we try in guess [7]. At this point we are down to two possibilities -- try to work them out. We try one of them in [8] but miss. So the remaining possibilty is the solution.

Solution for Sample 3

Further Analysis:

We claimed above that after guess [7] there were only two possible solutions left. Let's look at that. We already know that the left half of our solution contains 'G', 'B', 'D' in some order, while the right half has 'A', 'B', 'B' in some order. That means that if two of the left half letters in [7] are placed correctly, so is the third. Similarly, the right half cannot have exactly two letters placed correctly. Then, since guess [7] produced four '$'s, either the left half or the right half must be exactly correct. If it is the left half that is correct we need to switch two letters on the right and the solution is either 'GDBBAB' or 'GDBBBA'. But neither of those is consistent with the result of guess [6]. So the right half is correct and we much switch two letters on the left. That gives us three possibilities: 'GBDABB',  'BDGABB', or 'DGBABB'. The last of them is not consistent with the result of guess [6]. That leaves the first two.

Next: Sample Game 4


                                Possible Solutions After Five Guesses

 GDAAAB   DGAAAB   AGDAAB   GDBBBA   DGBBBA   BGDBBA

 GDAABA   DGAABA   AGDABA   GDBBAB   DGBBAB   BGDBAB

 GDABAA   DGABAA   AGDBAA   GDBABB   DGBABB   BGDABB

 GADAAB   DAGAAB   ADGAAB   GBDBBA   DBGBBA   BDGBBA

 GADABA   DAGABA   ADGABA   GBDBAB   DBGBAB   BDGBAB

 GADBAA   DAGBAA   ADGBAA   GBDABB   DBGABB   BDGABB


Sample4

Sample Game 4

A Level 8 game, with the Blanks Allowed rule in effect,  has 43,046,721 possible solutions. Our first four guesses, testing all available letters, produce seven marks. That clearly indicates a blank in the solution. (If one of those guesses had produced four marks we would not be certain of that.)

See Also: [ Color Display ]

Guess [5], clarifying [2] and [4], yields '$X'. This clearly shows one 'C' and one 'H', both in the left half of the solution. Then, again from [2] and [4], there are one 'D' and two 'G's, all in the right half. We now use guess [6] to clarify the result of [3]. The single mark tells us there is an 'E' in the left half (actually in spot 3 or 4) and an 'F' in the right half.

After six guesses we can name all seven letters in the solution and place each in either the left or right half. Then we also know which half holds the blank. The left half holds 'CEH - ' in some order and the right half holds 'DFGG' in some order. Furthermore the 'E' is in spot 3 or 4.

Guess [7] tries a possible solution. (Note that we only get seven marks because the blank, although it belongs in the solution, does not produce a mark.) The single '$' indicates that exactly one of our letters is in the correct spot.

If the correct spot is in the left half then the two 'G's are both in the wrong place and the right side must be 'GDFG' or 'GFDG'. We try one of these in guess [8], leaving the left half as it was, and get three '$'s. Since the left half of this guess is the same as in [7] at least two of our exact matches are in the right half. But we cannot have three right half spots exactly right since then the fourth would be correct as well. So we know that the left side, 'CHE - ' , has exactly one letter  correctly placed. (Note that the ' - ', the blank, may or may not be correctly placed. ) Then the right side is one of the possibilities we mentioned above. It can't be the first so it 's 'GFDG'.

The right side of guess [9] is known to be correct, accounting for the four '$'s in the result. So all three letters on the left must be repositioned. We previously determined that 'E' is in spot 3 or 4, so we now know that spot 3 holds an 'E'.  That leaves us three possiblities. We try two of them in guesses [10] and [11]. They fail, leaving us only one possibility:

Solution for Sample 4

Exercise -- Find A Better Guess:

In our game we would have won on the twelfth guess. But our guess [10] was poorly chosen. An alternate guess would have guaranteed we needed no more than 11 guesses to win the game. Can you find it?

Answer to Exercise


  After guess [9] we know five of our spots exactly and the solution has to be:

                                                                 ??E?GFDG

 Furthermore we know that the remaining spots contain 'CH - ' in some order,

   that spot 1 is not 'C', and that spot 2 is not 'H'. That leaves us  with  three possible

   solutions:

                                HCE-GFDG   H-ECGFDG   -CEHGFDG

 The second or third of these would be a better choice than our actual guess [10].

   In either case we would have one chance in three that guess [10] would win the

   game for us. And if not we would be sure to get it on guess [11]. Note that the first

   of the possibilities would not suffice. It would result in '$$$$$$X' whichever of the

   other two possibilities were the actual solution, leaving us unable to guarantee a

   win on guess [11].


License

License Information

Thank you for trying KLogic. We welcome your comments, suggestions and bug reports.

Please email the author:  bpaul@hoflink.com

KLogic is shareware. You may try it for free for 21 days.  After that you must  Register KLogic and pay for it if you wish to keep using it.

The file KLogic.zip may be freely distributed subject to these restrictions:

•	You may not charge anything for distributing KLogic.

•	You may not alter KLogic.zip or any of the files inside it.

•	You may not distribute any portion of the KLogic.zip package, only the whole file.

In other words you may give a copy of KLogic to anyone you please as long as you do not charge for it and you transfer it exactly as the author packaged it.


Register

Registering KLogic

KLogic is shareware. You may try it for free for 21 days. After that you must pay for it if you wish to continue using it.

            Price: $5.00 by check or money order payable to Barry J. Paul

            Send your payment to:   Barry J. Paul

                                                           P.O. Box 305

                                                           Great Neck, NY   11022

Your payment entitles you to a copy of any future version of KLogic without additional cost. Please send your email address with your payment so we may acknowledge it.

This copy of KLogic is fully functional. It does not even have a "nag screen" to remind you to register. We depend on your sense of fair play to encourage you to support the shareware idea.

License Info