Tuesday, September 29, 2009

The Tommyknocker

Before it was an atrocious novel by Stephen King, Tommyknockers were the spirits of miners that had died in a collapsed mine, scratching at the dirt walls of their prison, trying to escape even after death. I don't know about you, but this sort of history makes me quite thirsty.

The Tommyknocker is much more pleasant than being buried alive, but gains its name from the manner in which it is served. Mixing the drink ingredients together as described creates a creamy, almost muddy substance, which is poured over ice cubes, "burying" them in the drink.

The Tommyknocker

1 ounce Créme de Menthe (Green)
1 ounce Amaretto
1 ounce Coffee Liqueur
1 ounce Dark Rum
1 scoop Vanilla Ice Cream

Combine ingredients in shaker and shake until ice cream is melted and all contents are well mixed. Pour over large ice cubes.

Until we meet again, live well and long.

Bruce Kingsford is a regular contributor to this publication, and as such can be forgiven some of his more annoying proclivities, such as reading Stephen King books and naming drinks after them. This column appears every Thursday (except for this one, of course).

Sunday, September 27, 2009

Chess Against the Thinking Machine

When playing against a computer rather than a human being, the important thing to remember is that they are not really thinking machines as much as they are priority decision makers. Chess is a perfect game for computers because it is based on a limited number of available decisions at any given time. In order to defeat it, you must understand the programming "mentality" the computer uses. In order to beat the machine, you must play a human game. Play the opponent, not the game, and you will be far more successful. Below are some strategies to help improve your game.

A Chess computer assesses who is ahead differently than many human players would. The piece values are the same but not all humans would consider some of the other factors that a computer does. A computer uses the following sort of scoring algorithm (although these figures can vary from computer to computer)

Queen = 9 points
Rook = 5 points
Bishop = 3 points
Knight = 3 points
Pawn = 1 point
King = Between 41 and 200 points - this varies from computer to computer, but it needs to be large enough so that it isn't exchanged off by mistake.

Doubled Pawns = -0.5 points
Isolated Pawn = -0.5 points
Backward Pawn = -0.5 points

Any available move = 0.1 points as it is better to have more available moves than your opponent.

Factors such as weak pawns near the king should be penalized.

Well placed pieces, passed pawns, certain attacks, and pins should be added to the score.

In order to determine who is winning, the computer subtracts your score from its own score. A positive score means the computer is ahead and a negative score means that the human is ahead.

OPENINGS

A good Chess computer will have a large openings database. For more common openings such as the Ruy Lopez, Giuoco Piano, Queen's Gambit and the Sicilian Defence a computer will have a database containing up to about white and black's first 20 moves of many variations of these openings.

Because of this, a computer will not need to use up any time at all if the human opponent sticks to the moves in the computer's database. This will give the computer much more time in the middle and endgames to do larger and deeper searches.

One possible tip is to play an unusual opening that will not be in the computer's database. This makes the computer start using up its time right from the start of the game, which will mean it can't search to as large a depth as it could if it knew the opening later on in the game. So if you happen to be an expert on the Hippopotamus Defence or some other unusual opening then you will probably know that opening better than the computer does, which could give you a bit of an advantage when the computer is doing large searches which is using up its time early on. It only takes one move not in its database and the computer will need to start doing large searches early in the game.

For example, supposing the time limit of a game is 40 moves in 2 hours before the time control. If the computer can play the first 20 moves directly from its database, it will then only have to start doing searches for move 21 onwards. Therefore it will only have to make 20 moves in the 2 hours which is about 6 minutes a move on average. But if the computer only had about 5 moves of a particular opening in its database then it will have to make 35 moves in 2 hours which is about 3 and a half minutes a move on average. This greatly reduces the search depths that the computer is able to do which will obviously reduce the standard of play that the computer is playing of the rest of the game quite considerably.

MIDDLE GAME

For a Chess computer the middle game begins as soon its opening database can no longer be used. In the middle game there are usually about 30 to 40 moves possible on each move. This is known as the branching factor and the larger this is then the larger a search is needed.

Therefore, when the computer is searching for moves it will need to search about 1000 positions for one move from each player, 1000000 positions for two moves from each player, 1000000000 for three moves from each player and so on. The depth of the search really depends on the speed of the computer and on the amount of time it has available to move. If you have exploited your opening strategies correctly you in effect have hurried the computer, preventing it from making deeper searches the longer the game goes.

The search algorithm that most of the more modern Chess computers use is called the Selective Iterative-Deepening Search. This algorithm searches all possible moves to a depth of one first, then to a depth of two, then to a depth of three and so on.

For example, if the computer calculates that there is a Checkmate or a loss of its queen, then it terminates that branch of the search. This means that the computer doesn't have to continue searching a large number of moves from that branch, so it can use its memory to search to a greater depth on other branches of the search tree. Knowing this makes it possible to rush the computer into a bad decision, if you play cunningly.

For example, if you sacrificed your queen knowing that in three moves time you could get checkmate using other pieces then that branch of the tree might get terminated by the computer before it realises that its just fell for a mate in 3 which it now can't avoid. Be advised, however, that some computers might not fall for this as the very best computers would still have continued searching that branch of the search - so this is a risky plan against more advanced programs, but is safer against home computer programs.

As with all things, it comes back to time. The depth that the computer searches to depends on how much time it has left. Looking at the example from the openings above about the computer having less time if it doesn't know the opening, this might reduce a search from about 12 plies to 10 plies (where 1 ply is a move from one player, 2 plies is one move from each player) on each move. This can help reduce the standard of play of the computer.

One thing that better computers do is think during your time. If you take about 15 minutes on one move you may find that the computer has already searched that move to a depth of about 13 plies. Try and avoid taking this long over a move unless it really is necessary to take this long.

TRANSITION TABLES

Some of the better Chess computers use transition tables. They are used to remember some of the best lines from its previous searches and recent positions. So if you had a position and then two moves later that exact position was repeated then the computer would still have the best moves still stored in memory in a transposition table.

Try to avoid repetition (unless you are playing for 3 move repetition to get a draw) as the computer will probably have a recent position stored in memory and will be able to move instantly, which gives it more time to search on other moves.

END GAMES

Chess computers have databases of all 3, 4 and 5 piece endgames so they often don't need to use up as much time as you might expect them to in the endgame. An endgame like this favors the computer because of its database, and the branching factor on each move is reduced once pieces like the queens are exchanged off, so the computer can search to a greater depth than in the middle game while still using the same amount of time as it would in the middle game.

Try to avoid exchanging off pieces unless it really does help out your position. The branching factor on each move should be kept higher to force the computer into doing shorter searches on each move.

Bruce Kingsford's contributions to Liquid Ether are less sporadic than some, and are therefore much appreciated by the Editor of this publication.