online casino bonus
 
Online Casino Bonus Welcome to best online casino bonus, And this is a no deposit online casino bonus site !
Top Online Casino
Best Casino Bonuses
No Deposit Casinos
Best Poker Room
Monthly Casino Bonuses
High Roller Casinos
Casinos list A - B
Casinos list C
Casinos list D - H
Casinos list I - O
Casinos list P - S
Casinos list T - Z
Poker Rooms list A - O
Poker Rooms list P
Poker Rooms list Q - Z
Sports Book Bonuses
Bingo Bonuses
Casino Affiliate
Poker Affiliate
Sports Book Affiliate
Bingo Affiliate
Payment Method
Casino School
Free Casino Games
Casino Articles
Links Exchange
Best online casino and poker online articles
casino gambling poker blackjack Roulette
ExtremeTech: Exercise Your Mind!

ColorClue puts your logic skills to the test. Can you take a set of clues and deduce their meaning? Can you do it quickly? The program creates a hidden pattern of colored boxes-either four boxes by four boxes, five by five, or six by six. The four-by-four game has four different colors with four squares of each color, and so on. The colors are not randomly arranged; all the squares of a given color are connected along at least one edge of the box. Clue buttons for each row and column can tell you how many boxes of each color are in that row or column, but nothing about their order. Your job is to deduce the actual colors, as quickly as possible, using as few clues as possible. The better you do, the lower your score will be. You add points by taking time, guessing wrong, asking for tips or clues, and using the automatic play features.

ColorClue runs under Microsoft Windows 95, Windows 98, Windows Me, Windows NT 4.0, and Windows 2000. It requires the use of a mouse or other pointing device. The Delphi 5 source code for ColorClue is provided with the utility for those interested in seeing how it works. Note that PC Magazine programs are copyrighted and cannot be distributed, whether modified or unmodified. Use is subject to the terms and conditions of the license agreement distributed with the programs.

Using ColorClue

To install ColorClue, run the supplied installation program, Install.exe. To uninstall the program, use the Add/Remove Programs applet in the Windows Control Panel.

The first time you launch ColorClue, it will display a four-by-four game (see Figure 1). Thereafter, it will start at whatever size you were using last time. From the Game menu, you can choose a new game at any of the three sizes: New 4x4, New 5x5, or New 6x6. These options also can be accessed by clicking the down arrow next to the New button.

At the start of a game, every box in the main window is obscured by a set of buttons, one for each color. Clue buttons reside at the end of each row and column. When you think you know the color of a particular box, click the corresponding color button. If you're right, the box color will be filled in. Play starts when you make your first move, which usually will be to click a Clue button (see Figure 2). Without clues, your guesses are random.

In general, guessing does not pay. Errors run you 200 points; clues add only 100 points. In the top-right corner of the main window, you'll find the scoreboard. Each second of play time costs one point. There are also penalties for requesting tips or taking advantage of autoplay features (more on this later). Select Scoring legend from the Tools menu to display the various point values (see Figure 3). The total running score appears at the bottom of the scoreboard.

You can pause the current game by selecting Pause from the Game menu or clicking the Pause button in the main window. When you do so, the game board will be hidden. If you leave the game idle for 60 seconds, it will pause automatically. If you've made a drastic error, you can select Restart, but please, don't try to memorize the board and then restart!

Playing Strategies

Here are some strategies to get you started with ColorClue. The program's online help contains a more extensive discussion of strategies and tips for play. To start with, keep in mind that the boxes representing each color must form a continuous shape connecting along at least one edge. The left-hand picture in Figure 4 is a valid arrangement, but the right-hand picture is not, because the red boxes are in two separate groups.

A good initial strategy is to obtain clues for a row and a column. If two clues that cross have only one color in common, you know the color of the box where they intersect. Given the underlying rules for the color arrangement, you can often guess other boxes as well. Although clues cost less than errors, they still add 100 points, so you'll want to wring every possible fact from them. When you've gotten everything you can from the available clues, click another clue button and keep going.

It's often easier to decide what color a particular box is not. For example, if the clue for a row doesn't include red, then none of the boxes in that row can be red. You can right-click a color button to register your deduction that it is not a particular color. Here again, if you're wrong, the error will give you 200 points, so don't guess.

Sometimes, you can deduce that all of the remaining boxes in a given row or column are definitely one particular color, or that none of them are a particular color. For example, if a row's clue indicates two red and two blue, and you've already found the two red, the rest must all be blue. To select or reject all remaining boxes in a column or row, right-click the corresponding clue or clue button and choose from the pop-up menu (see Figure 5). Note that these menu choices apply only to the boxes that are not yet uncovered. If a clue specifies one green and you've already found that box, you can use the pop-up menu to reject green for the rest of that row or column.

Logical Tips

If you're having trouble figuring out how to make sense of your clues, click the Tip button to ask ColorClue for a deduction. It will run you 50 points, but if you pay attention, you may not need the same tip again. When you request a tip, ColorClue first checks to see if it can provide any positive tips, telling you that a particular box is a given color. If so, it picks one such tip at random and displays it. If no positive tips are available, it checks for a negative tip, telling you that a box is not a given color. Again, it picks one at random. If ColorClue can't come up with a tip, you don't get the 50 points.

The Tip window (see Figure 6) shows the location of the affected square and its color (with an X through it for a negative tip). It spells out the row and column location and the color, and it explains why this deduction is possible. Carefully note the reasons, as the main purpose of the tip feature is to help you get better at making those deductions yourself! Note that every tip tells you about exactly one box, but the same reasoning may well apply to others nearby. It's up to you to make use of the tip and possibly extend it.

ColorClue's tip feature checks for seven types of positive tips and four types of negative tips. There are some deductions you can make that aren't reflected in tips, because ColorClue only checks for those 11 predefined situations. ColorClue starts with the simplest deductions and proceeds to the more complex, so if there's more than one reason for a given tip, it presents the simplest. The online help system describes these situations in detail.

Think you're a total whiz at logic? You can play tip roulette. When you think you've made every possible deduction, click the Tip button. If you're right, ColorClue will draw a blank, and you won't be given any points. But if you're wrong, you'll gain 50 points.

ColorClue Options

ColorClue has some autoplay options that can save you time, but they also add to your points. To access ColorClue's options, select Options from the Tools menu (see Figure 7). While you're setting options, the game board is hidden and the clock stops ticking, just as it is when the game is paused.

You can choose from two automatic play options. When Auto-select last remaining is checked, ColorClue will select the color of a box for you once you've eliminated the remaining possibilities. If you check Auto-reject completed colors, then when you select the last box of a given color, all buttons of that color will be automatically disabled. You can't choose both at once; that would be too easy! Each time ColorClue makes a play for you based on either option, you're handed 50 points. You'll have to weigh the speed you gain by using these options against the point cost.

You can also choose from two dozen symbols for ColorClue's buttons. Note that you're not selecting a color; the colors in the symbol panel are just for show. These symbols are drawn from the standard Wingdings font supplied with Windows. If by some mischance you have deleted the Wingdings font, ColorClue will not display properly.

By default, ColorClue provides audible feedback. For a correct selection, it makes a whack noise, and for a correct rejection, it makes a whoosh. An incorrect deduction gets a squeak. You can uncheck Game sounds to eliminate the audible cues. You also can uncheck "Solved!" sound to eliminate the musical celebration when you solve a puzzle.

Scoring and Winning

When you solve the puzzle, the Score window will appear, with your score in its caption (see Figure 8). The lower the score, the better. If the score is among the best ten for this puzzle size, you'll have the chance to enter your name in the Best scores list. If you'd prefer not to add your name, simply leave the name box blank.

You then have three choices. Click New game to start another game immediately. Click Scores to view the Best scores window. (If your score was just added to the best ten list, it will be highlighted.) Or click OK to close the score window and admire your just-completed game. You can review the elements that contributed to your score by pointing with the mouse at each item in the scoring panel.

The Best scores window (see Figure 9) lists the best ten scores for each of the three puzzle sizes. Click on the tabs at the top to select a particular size. Initially, the tab for the size of the current game will be selected. Note that if two best score entries have the same value, the newer one will take precedence. So if you get the same score as the current number 10, you'll push the existing number 10 off the list.

You can click Reset scores to wipe out all the information and start fresh. This is a radical step, however, so ColorClue will ask for confirmation. The scores are stored in the file Colorclue.cc, in encrypted form. If this file is damaged or corrupted, ColorClue will automatically reset the list of best scores.

Inside ColorClue

When a six-by-six game is selected, ColorClue's main window has a whopping 216 color-selection buttons: six rows, six columns, and six buttons apiece. ColorClue fixes a display glitch in Delphi's TSpeedButton control that becomes especially evident when there are so many of them on a form. Where do the puzzles come from? ColorClue creates them by trial and error, just as you might do with pencil and paper. And just in case anyone is tempted to adjust the high scores, ColorClue protects them with a mild sort of encryption.

Flattening Buttons

Delphi's TButton component is a wrapper for the standard Windows pushbutton control, but the TSpeedButton is what's called in Delphi a graphical component. A Speedbutton doesn't correspond to a Windows control, and doesn't have a window handle of its own. Speedbuttons don't appear in the tab order either, which is a good thing on a form that has dozens or hundreds of buttons. To reduce the visual clutter of such a form, you can set the Flat property of each Speedbutton to True. This makes each button act like the toolbar buttons in Internet Explorer and other modern programs. When the mouse is not over it, the button just displays its bitmap, or caption. Only when the mouse passes over it do the button edges become visible. Occasionally, though, a Delphi Speedbutton gets stuck in the non-flat display mode. Moving the mouse over it usually flattens it out again, but when a form has 216 of them and several are stuck, it looks pretty bad.

This problem occurs when the speedbutton doesn't receive the Delphi internal message CM_MOUSELEAVE, which indicates the mouse has left its position. Normally, a Speedbutton responds to this message by setting its own MouseInControl property to False and refreshing its display. When the Flat property is True and MouseInControl is False, the TSpeedButton.Paint() method draws a flat button.

If MouseInControl remains True when the mouse cursor is not actually over the Speedbutton, it's stuck in the non-flat display mode until it receives a CM_MOUSELEAVE message. Passing the mouse over the button is one way to get that message across, but ColorClue needs to take care of the problem using program code. The problem is very slightly complicated by the fact that MouseInControl is a protected property, not accessible from outside the TSpeedButton component. Fortunately, protected properties can be accessed from within a descendant object, so ColorClue defines a very simple TSpeedButton descendant named TSpeedButtonF (found in the module Cframeu.pas). This class adds a single method named Flatten(), shown here:

procedure TSpeedButtonF.Flatten(P: TPoint); begin IF Flat AND Visible AND (NOT PtInRect(BoundsRect, P)) AND MouseInControl THEN Perform(CM_MOUSELEAVE, 0, 0); end;

ColorClue calls this method for each Speedbutton from within the OnIdle event handler of a TApplicationEvents object. This event handler is triggered once each time the program finishes processing all pending messages-a perfect time to flatten any stuck buttons. ColorClue calls the API function GetCursorPos() to get the cursor position, and the Delphi function ScreenToClient() to convert the returned point to client coordinates. Then it processes the SpeedButtons, typecasting each to TSpeedButtonF and passing the cursor position to its Flatten() method. If the speedbutton is indeed stuck, the Flatten() method forces it to process a CM_MOUSELEAVE message. Result? No more stuck buttons.

Creating Puzzles

Each time you start a new game, ColorClue creates a puzzle on the spot. It does so in much the same way you'd do so yourself with pencil and paper. Taking the available colors in random order, it places one at random in an available box. Then it places another box of that color in a box chosen at random from those adjacent to existing squares. When it finishes one color, it starts the next. And if it gets into an impossible situation, it starts over. This process is implemented as the PlaceAllColors() method of the TGame object, defined in the module Ccobju.pas.

To start, PlaceAllColors() shuffles the colors by placing them in order into the array shuff and performing a random exchange. For each color in shuffled order, it calls the recursive function PlaceAColor(), which takes two arguments. The first is the color to be placed, and the second is the number of boxes of this color that have been placed already. Initially, the second argument is 0.

As with all recursive functions, PlaceAColor() has a terminating condition to end the recursion. Specifically, if the second argument is equal to the current game's dimension, then all boxes of this color have been placed, and the function returns True. If no boxes of this color have been placed, it makes a list of all unused boxes. If one or more have already been placed, it makes a list of unused boxes that are adjacent to these. Naturally, if this list comes up empty, the function returns False immediately.

Assuming there are some possible locations, PlaceAColor() shuffles the list into random order. For each location in the list, it sets the corresponding box to the specified color and then calls itself recursively to place the next box. If this attempt succeeds, PlaceAColor() immediately returns True. Otherwise, it clears the box that was just tried and moves on to the next item in the list of possible locations.

If PlaceAllColors() fails to place all of the color boxes, it clears the game and tries again. The return value from PlaceAllColors() is the number of tries that were needed. This value is not used in ColorClue, but during the program's development I captured data for 100 games at each size. In all three cases, the program sometimes came up with a workable layout in a single try. The greatest number of attempts required was 20 for a four-by-four game, 65 for a five-by-five, and 161 for a 6-by-6 - the median values were 3, 7, and 38. You might be inclined to quit if you made 161 attempts with pencil and paper, but ColorClue is patient and fast.

Encrypted Scores

Initially, I designed ColorClue to store its best-score data in the program's INI file, but then I changed my mind. Part of the fun of playing ColorClue lies in trying to beat your best scores or the best scores earned by other players. That feeling of achievement might be tarnished by the knowledge that anybody could load the best scores into Notepad and change them. To head off any temptation to adjust the scores, I rewrote the program to store the best scores in encrypted form. The source code is available, of course, so anyone with a modicum of programming skill can still modify the best scores, but doing so will require quite a bit more effort than editing a simple text file.

Each score is represented by the simple structure TOneScore, defined in the module Scoreu.pas. A TOneScore holds a score value (zero indicates a blank slot in the list) and a name of up to 32 characters. TDimScore, an array of ten TOneScore elements, holds the best scores for all games of a particular dimension. Finally, the entire set of best scores information is represented by TAllScore, defined as ARRAY[4..6] OF TDimScore. The file Colorclue.cc is always 1,206 bytes in size-a 6-byte signature followed by the 1,200-byte TAllScore structure.


Continued from page 2.

The module Scoreu.pas defines a number of functions related to scores. IsInBest() returns True if a score is among the best ten for the specified game size, and PlaceInBest() inserts new score data in the list. EnumScores() takes as its argument a call-back function to which it passes the score data. As expected, ResetScores() resets all the score data to blank. Rather than zeroing out the data structure completely, however, it sets each score to zero and fills the name field with random characters. Why? Because ColorClue encrypts the score data on a byte-by-byte basis. Encrypting a block of all zeroes would yield visible patterns that could conceivably be used to crack the encryption.

Internally, all of these functions rely on two others that aren't called from outside the module: WriteScores() and ReadScores(). WriteScores() creates a Delphi TFileStream object that in turn creates the Colorclue.cc file, overwriting it if it already exists. It starts by writing the 6-byte signature string CoClue. Then it copies its TAllScore argument to an array of bytes of the same size. It encrypts each byte of the array by XORing it with two values: the byte's index within the array, and a character from the password PC Magazine. XORing with two values is another minor precaution against cracking. It breaks up patterns that could become visible if, for example, every one of the best-score names were set to a string of 32 A's. After encrypting the data, WriteScores() writes it to the TFileStream and closes the file.

ReadScores() performs the same operation in reverse, with error-checking. It creates a TFileStream object that opens the file Colorclue.cc. ReadScores() checks that the file size is correct, and that the first 6 bytes match the signature. Then it reads the remainder of the stream into an array of bytes whose size is the same as that of the TAllScore structure. To decrypt the array, it applies exactly the same XOR operations that were used to encrypt the data. That's the simplicity of XOR-based encryption; if you XOR a value twice with the same number, you get the original value back. ReadScores()copies the decrypted data into its TAllScore argument, and checks the data for validity. Specifically, in each TDimScores array, ReadScores() checks that all non-zero scores are strictly non-decreasing, that any zero scores are at the end of the array, and that every non-zero score is associated with a non-blank name. If any error occurs, or if the decrypted array is invalid, ReadScores() resets the score array. ColorClue's score encryption is far from crack-proof, but it will stymie most attempts to change the score data.

Next time you're waiting for a big download to complete or stuck listening to music on hold, don't reach for Solitaire. Instead, launch ColorClue and give yourself a mental workout.

Neil J. Rubenking, the author of ColorClue, is the Contributing Technical Editor to PC Magazine. Sheryl Canter is the editor of the Utilities column and a Contributing Editor of PC Magazine.

Copyright © 2004 Ziff Davis Media Inc. All Rights Reserved. Originally appearing in ExtremeTech.

Copyright©2005 All rights reserved.
Topcasinolist.net is top online casino portal that provides you with the best casino bonus and no deposit casino. You can find Casino bonus reviews,monthly bonus casinos, High Roller Casinos payment methods and promotions, and much more. We also offer reviews for bingo halls, online poker rooms and sports books.