Monday, April 30, 2007

Chess -- positional analysis of a blitz

Today a quick analysis (not analysis as in 'calculation') of a recent blitz (3 10) at FICS. Not that it's a particularly profound or interesting game (and I have barely looked for missed tactics with a chess computer, but in this analysis I'm more interested in ideas and position than exact lines anyway), I just feel that I have something to say about it. It's a Caro-Kann, which is my preferred opening as black in response to 1.e4.

First some opening moves, then this position:

In my mind, the next positional goal for each side is pretty clear: White wants to play f5 and go for an attack on the black king. Black wants to play c5 and take on d4 (opening the line, and also making the pawn on e5 pretty weak in case white plays f5.)

In these positions with each one playing on each side of the board, speed is important. The one breaking through first can hope to force the other one to defend, getting the initiative. (As long as no one is forcing the other to defend, no one has the initiative the way I see it, but I've seen this view disputed.) So, with that in mind my next move in the position above was a6. The idea was to prevent Nb5 and Nd6. I didn't have time to calculate whether that manoeuvre is actually playable or meaningful. However, I think a6 is bad and that it's better to just capture the knight (Bxc3) and then play c5 (or c5 directly if I deem Nb5-Nd6 to be of no threat).

Then white played a3, I responded with Bxc3 and white played Pxc3.

Then I made another, much graver, mistake. Kind of a positional suicide. Here is the position before the mistake. See a good way to play positionally badly?

I should have played c5 here. In case of dxc I can't retake the pawn immediately, but it's undefendable, so I can then play Rc8 and hopefully start getting some play on the c-file.

I played Nb6. The idea being, of course, to play it to c4. Which makes a nice outpost, however it's bad because now c5 isn't playable anymore, and without that the Knight on c4 is pretty much all I get on the queen side, and I will have to start to seriously worry about the safety of my king, because now white played f5, at last. And it's a killer. Pawn takes, knight takes, knight takes, rook takes. Then we have the following position. Black's king is starting to get really scared:

Black to play. How to get out of this mess? The Bishop will take on h6 at any moment. Looks lost. The only move I can think of is Qh4, getting some extra defence against the attack (white won the race and has the initiative), hoping to exchange queens.

I did play Qh4, and white played the natural Raf1. Black then played the also natural Nc4, finishing that manoeuvre. White played Bf2 threatening black's Queen. Positional mistake though, allows for Qe4 (which I played) almost forcing an exchange of queens. And he did play Qxe4, I took with the pawn and he played Re1 (going to take the pawn). I can't defend it, so I take the pawn on a3, Nxa3, and white played Rxe4. The attack on black's king failed (or is it any life left in it?) and now the game takes on a different character once again, so it's time for a diagram (black to play).

I can't say who has the best position at this point (GNU chess prefers white despite the hanging pawn on c2), but I do know that I by far prefer black's position. Why? Because it's easy to play. The positional goal is clear: running with the a-pawn to promote it, while fending off whatever white is going to try to do. What should white try to achieve positionally? I'm not sure but maybe marching onwards with the center pawns (which is what happens), maybe even going for an attack on black's king.

Btw, black shouldn't waste any move on capturing the pawn on c2. I played a5.

Some more moves where made. White played rather aimlessly (as I too would have as white in that position, I think) and managed to lose both center pawns in a desperate attempt to create some threats. Eventually this position came up (white to move):

White is lost, of course. I managed to get my rook now on d7 to b1, and won.

Here's the complete game. (Is it possible to switch side on these boards, to see it from black's perspective?)

The End.

Friday, April 27, 2007

Chess Computer 2

I've fixed the memory leak. Turns out that it was caused by not overriding the destructor (not something needed to do in other languages I've used, that I recall). Some of my objects have their own internal objects, and they are de-allocated in the destructor, so when it wasn't called they weren't, and they quickly became numerous since it's a type of object that I create and destroy a lot when the ai is thinking (hundreds of MBs became allocated if I left the Ai thinking for a shore while...) I spent hours trying to find that leak. No warning from the compiler or anything (it warns about all sorts of things, like declaring a small variable and then not using it, but if you write the worlds longest and coolest destructor without overriding it, it won't say a peep. Boo, etc. But still, Delphi's great.) Anyway, now that's fixed, although I still have a minor memory leak yet unfound.

The ai examines about 2000-3000 positions per second. That's pretty bad, but I don't mind as I've not taken speed into account when writing the code. It will get better as I refactor the code. (My main consideration has been the structure of the code, at least on a higher level like what objects and what relations etc, but that too will be improved.) At first I got the result 4000-5000 positions per second, and even 10000, but then it got lowered. I'm not sure why, but I've changed the code back and forth without keeping track of anything. Anyway, I like things measurable and it will be fun to see what speed I can reach. And with a baseline like this, it can only get better.

Apart from being slow in general, the search-algorithm is also ineffective in another way. It searches all branches, even useless ones. I've implemented the minimax algorithm so far, and my next step is using alfabeta pruning. Code-wise the change is minimal, but search-wise the change is huge. The same number of positions will be examined given the same time, but irrelevant branches will be cut off. And without risk too (as compared with minimax, but of course both suffers from the horizon effect, but alphabeta normally sees further given the same time.)


Wednesday, April 25, 2007

Chess, achieving a breakthrough

Time to write more about those frustration positions when you've placed your pieces optimally but don't see a breakthrough. Getting to these positions is easier than knowing how to continue, at least for me. It seems in these positions as if every move just makes your position worse!

Anyway, I think the solution is to examine how the masters handle these positions, and then try to generalize. Why generalize? Well, it's kind of pointless just knowing what move to play in this or that position, because you will never run into exactly that position. What you need to know is what *type* of move to look for in what *type* of position. All the positions I have in mind are of a certain type (before-the-breakthrough positions), but I'm guessing a further classification can be made, into sub-types.

I already have these three general 'solutions', but I need more understanding of each (and maybe find more):

1. Tactics (non-sacrificial). Sometimes a breakthrough can be achieved by simply finding some tactics. Not necessarily tactics to get a mate or even gaining material, just getting the desired breakthrough and a nice attack of some sort.

2. A sacrifice. A *real* sacrifice where you get your breakthrough at the price of losing some material you can't forcibly get back as far as you can see (if you *can* get the material back forcibly, it falls under non-sacrifical tactics.)

3. Starting some activity at some other part of the board (like pushing a pawn with the idea of opening a new line, even though your rooks are already well-placed), knowing that you got the better mobility and that the enemy's pieces are tied up in defence. You will be able to more swiftly move some pieces over to this new target than he will be able to defend it.

Yesterday's 'today's puzzle' at was a position from a very nice game (simul!) by Capablanca, and at one point this game had one of those 'before-the-breakthrough'-positions: (Btw, this isn't the position featured in the puzzle, but it is in my opinion the most interesting position in the game.)

Capablanca - T A Carter

White to move!

Here is the complete game. The breakthrough starts at move 21.


Monday, April 23, 2007

Chess computer

I mentioned briefly that I'm working on a chess computer. I do, and I've come this far:

I've implemented most rules, so it can tell the difference between valid and invalid moves, including recognizing mate and castling (but not promotion or en passant yet). Getting all the rules right was more tricky and time-consuming than I would have thought. Some day I'll look up how others have done and compare notes.

I have a graphical interface using numbers as pieces. Same numbers the pieces are represented by internally (1 for white pawns, 2 for knights and so on, and the corresponding negative number for black's pieces.) Pieces are moved by clicking the board (not drag'n'drop yet, but clicking on the start and the end square.)

I have created a simple Ai. It can either choose randomly between the available moves (not too interesting...) or look into the future any arbitrary number of plys (half-moves) and choose move in accordance with material gain. So it should in principle be able to find any forced material gain however many moves into the future, except that the code is in such a weak state right now that anything beyond 3 (maybe 4) plys is simply too time-consuming. I also have some problem with memory leaks and my next task is to find and correct that. But still, it's really cool seeing my creation come to life like this. One day when it begins to beat me I'll pat it on the head and say "I'm proud over you" and "you've come so far".

I intend to make this a highly configurable chess program, the user will be able to in detail decide how the chess computer is going to play. Whether it should sacrifice a lot for an attack, or play quickly, or tend to do long castling and pawn storms, what opening to play, or even make it value knights more than bishops (or queens...). That way it will be a nice and adaptable chess training tool, I think. However, don't hold your breath. It may take some time to get there.


Friday, April 20, 2007

Chess -- positional play, plans and such (part 2)

So I'm a fan of simple plans and goals. But actually, I'm not sure exactly what I mean by "simple", except in some vague way that it should be easy to understand. I did refer to short plans in that post (part 1), but some of the plans I have in mind aren't that short or simple. They're simple in the sense of being easy to understand and describe, but may take more than a few moves to implement. So what's going here, what is my actual view?

There is a certain conceptual confusion going on that needs to be clarified in order to think clearly about these things. Goals can be described on different levels of abstraction that all exist at the same time. I don't mean that different positions require different goals and that some are more abstract than others; I mean that most (perhaps every) positions have goals at different levels at the same time. A few examples:

In the opening, the general goal is to develop the pieces and take control over the center. But more specific goals also exist, it may be to take control over a certain square, a certain line or diagonal etc. The more abstract goal of developing the pieces is done by means of those less abstract goals.

In the endgame, the general goal is often to promote a pawn (or prevent the enemy from doing so). That struggle may go on for more than 20 moves. But the more specific goal may be things like "put the rook behind the pawn", "create a passed pawn", "exchange knights", etc. So which goal is the player trying to achieve, promote the pawn or putting the rook behind the passed pawn? Both. It would be absurd to try to have a discussion about which of these goals to choose since it isn't an either/or choice. As in the case above, the general goal is achieved by means of achieving the less general goals (so these less general goals can also be viewed as steps in the plan to achieve the general goal. So they're both goals and part of a plan, depending on the perspective).

Stay tuned for part 3.


Wednesday, April 18, 2007

Chess and other activities

It's possible that I wouldn't spend any time at all on chess if I couldn't integrate it into my other activities as much as I have. Like this:

I'm currently working on creating a chess computer, which is pretty interesting and makes me a better programmer (though I'm not sure it will have something new to offer). I'll write more on that later.

I like blogging, and chess gives me an unlimited amount of things to blog about. It seems like every written post gives me ideas to at least two new posts.

I like creating systems, especially when it's related to thinking in some rather direct way. And chess playing (and improving) provides ample opportunity for that. One gets to think about and trying out different methods, and identifying new interesting principles.

It provides many opportunities for interaction with other chess players.

Without all this extra stuff (and I'm sure there's more than the above) it just wouldn't be worth it, I think (even if playing is fun and interesting in itself, of course). But now it is, and that's great.


Monday, April 16, 2007

Chess -- The value of blitzing

The question of the value of blitz came up a while ago in a blog comment (see BDK's comment in this post). What's my take on that?

I did play a lot of blitz on the net back in the early FICS days, and my total improvement was only something like 100-150 points (which isn't much given that I played a lot, also as I recall I made most of the improvement rather early and then stagnated).

However, I didn't aim to improve. I played mainly to keep my mind off other things for a little while. I was basically just applying what I knew without expanding it.

Knowledge and skill don't just enter your mind just because you look at reality or just because you're doing a certain activity. Not even when the effects (good or bad) are obvious. Some people keep doing obviously destructive stuff over and over again, not learning anything. Something more is required: a commitment to improve, and certain mental actions (and practices) appropriate to whatever it is you're trying to learn. Often it's a question of deliberately establishing the right mental habits.

So, regarding blitz. I do think blitzing used a certain way can be very helpful in improving. For example, now when I'm playing I try to always be on the lookout for positions that I can't handle, and if I identify such an area I try to spend time (not while blitzing) improving that area specifically. (One example of that is positions where I've reached maximum pressure on some point but can't break through. It is easy enough to have a general idea of what to do as long as some piece can be better placed, but when they've all been coordinated and that isn't enough I'm just lost. I'm currently looking for general answers what to do in these cases.)

But notice that you don't automatically make these identifications just because you're playing blitz. If you do have given yourself the mental order to be on the lookout for things like that, you have a good chance of noticing them, otherwise you won't (or sometimes you will, but you leave it up to chance, and it will in any event be a slower progress.)

That's just a simple example (and an example within an example), but my point is that it all depends on how you use it. You can neither say "blitz will help you improve" nor "blitz won't help you improve". Rather, blitz has a good chance of helping you improve, if you use it in a good way.

Okay, enough for now, but I think I'll write more on this topic later.


Friday, April 13, 2007

Chess -- exhaustive list, mate threat

I like exhaustive lists (on an abstract level) for all kinds of situations in chess (and life). A simple one that most learn early on is how to deal with a check. The three ways: take the checking piece, block it, or move the king (in double check only the third option applies, and blocking isn't possible when a knight checks).

What would be an exhaustive list of possibilities prevent a threatening mate? I think it would be:

1. Take any of the pieces that threatens mate.
2. Block any of the mating pieces.
3. Arrange so that a piece will be able to block the mating piece (if it's not a knight).
4. Set a piece to guard the square that the mating piece is going to move to.
5. Prepare an escape route for the king (i.e. move a piece, for example the rook on f8 if the mate threat is Qh7+)
6. Make a check yourself (can be very disrupting in many positions).
7. Move the king

Does this cover it all? (Btw, I put no thought into the order, but I guess they should be arranged in order by some criteria.)

(Btw again, "the mating pieces" refer to all pieces that cooperate in the mate, and "the mating piece" refers to the one of those, if several, that does the actual mating, the check.)

I wrote the above from the perspective of the defender, but it is as useful for the attacker. When you consider making a move that threatens mate (or a move that threatens a move that threatens mate...), you need to be able to go through every possible way that mate can be diverted. And the further into the future the mate threat is, the more difficult it is to make sure you've gone through every relevant counter move, and having a series of steps like this does help.


Thursday, April 12, 2007

Chess -- Vasily Smyslov and positional preferences

Most chess players have a favorite among the grandmasters (dead or living). I used to (years ago) like Fischer, but that was more his achievement than his actual games (he did a lot on his own, whereas Kasparov and many others had access to good chess teachers, even went to chess school).

I've never really had a favorite based on playing style. But I've recently been going through some of the games of Vasily Smyslov, and I like them. So if someone held a gun to my head and forced me to pick a favorite, it would be Smyslov. But I've only seen a small sample, and to be honest I base that opinion also on the fact that the great grandmasters describe his play as harmonious. I like harmonious play (assuming they mean what I mean) and I dislike chaotic positions (though not necessarily sharp ones -- a position can be both sharp and harmonious, as for example in some variations of Kings Indian with mutual attacks on each side of the board. Very sharp but not chaotic.)

Also, as an amateur musician I like the fact that Smyslov is a singer (opera). Listen to a short clip here.


Monday, April 09, 2007

Chess -- some games of mine

I've decided to not post my rating or online nick (it's not XY) on this blog, in order to avoid feeling any pressure to improve. However, I will post games.

Some games:

Game 1

A win, I'm white. I played this game about 10 years ago, one of the last games I played before I stopped playing chess (until recently).

For fun you can do the following: play to (and including) the 12:th move, and then stop and try to decide what to do as white. Both generally and the specific next move (the 13:th).

After that, play to (and including) the 15:th move, and do the same thing again. How should white continue?

(I could have started the sequence now starting at move 16 one move earlier, I just missed it.)

Game 2

Another sweet win, but this a closer call.

Game 3

Another win as white. Look at those knights. Don't play out whites 37:th move immediately. What would you play?

(btw, 34. Nxe6 was a mistake. 34...Qxe6 would have given black counter play.)


Friday, April 06, 2007

Chess -- a couple of quotes

Today some true words by Ward Farnsworth, from this site:

The quality of your chess is determined by the quality of your train of thought when deciding what move to make. The train of thought may be partly verbal, partly visual, or partly intuitive, but in any case it will involve a sequence in which you consider candidate moves and their pros and cons. The climb from novice to something better largely is a move from meandering, unsystematic trains of thought to more methodical and fruitful ones.


The trains of thought offered in the commentaries emphasize the use of clues: signs to search for during your games that indicate a tactic might be available. The explanations show how the same sets of questions, some of them simple, can generate impressive tactical ideas when they are asked and answered methodically.


Wednesday, April 04, 2007

Chess -- calculation

Another post on chess, much to the dismay of my non-chess playing readers. : )

I found this interesting blog (by Blue Devil Knight) and this post on analysis inspired me to write about analysis.

First a note on language. The general meaning of 'analysis' is to pick apart and examine the parts. For some reason the term has in chess come to mean primarily (or only) examining specific variations. But strictly speaking (assuming the ordinary meaning of the term) it would be analysis even if you analyzed only positional elements ('there's a weak square, there's an inactive piece' etc) and not a single variation. And I like to keep my terminology as close to the ordinary meaning as possible, so I will use the term 'calculation' instead. That may not be the best term either, but it's closer. The relation to analysis is that calculating is a specific form of analysis (the latter being the broader term, then.)

So what's my take on improving the ability to calculate? It's basically that I don't consider it worth doing as a specific activity. One reason is simply that it's boring. I mean, boring to train, not boring to actually do in a game. And that's always a factor. I'm not a chess professional, I'm playing because it's fun and interesting. I do want to improve (of course) and if training calculation (specifically) would be the only way, then I would either do that or quit playing chess. However, it isn't the only way, not even the best one for a player of my strength, I think.

I keep talking about training calculation "specifically". With that I mean that I do actually train my ability to calculate, except that it is an indirect effect of training tactics, which I do. I'm referring mostly to my adventures on CTS. Granted, these are short variations, and the main purpose is not to train calculation, but with most tactical problems there is some calculation going on (if the problems start becoming so easy you 'see' solution almost without any calculation, your rating will go up and you will get more difficult problems which requires more calculation... so there will always be some calculation going on.)

I don't have that much time to devote to chess (I almost spend more time writing these blog posts than actually doing chess... but that's okay, because I like thinking about how to do stuff), so to begin training calculation would mean spending less time on other chess-related activities (tactics, blitz, trying to expand upon my system of though) and I'm pretty sure that wouldn't be a good trade.

Actually, there is another way in which I train calculation, also indirect. The CCT-rule gives guidance as to in which order you should check variations (especially in its expanded version, which I'm working on), which is closely related to calculation.

BKD mentions chess visualization. Now that's something I'd like to learn some time. I would really like to be able to play a game of blindfold chess. Stay tuned for a post on that.


Monday, April 02, 2007

Chess -- positional play, plans and such

Okay, enough about tactic, and more about strategy and position. Some positions contain no tactics; there's no attack going on, and no one might even have the initiative. No good checks, captures or threats are worth considering, so the CCT-rule isn't of any help at all. What do you do here? You can't just move your king back and forth waiting for tactics to consider. What you need to do is to find moves that make you position better. If you are more successful at this than your opponent, soon enough there will be tactics available. The better a players position is, the better the chances of having decisive tactics at his disposal.

How do you achieve this, getting a better position? How do you find the right moves? You need to know what you want to get done. You need purpose and a plan. The purpose being what you want to achieve and the plan how to get there. (Funnily enough, some, even many, chess players speak only of plan and mean both 'purpose' and 'plan'. However, that's misuse of language, no?)

And when it comes to these, I share the views of Michael de la Maza, quoting from his "400 Points in 400 days" article:

I implement very simple plans (as opposed to Silman, Kotov, and Pachman-like plans) that improve the probability that there will be a tactical shot. These plans include:

1. Improve the mobility of the pieces.
2. Prevent the opponent from castling.
3. Trade of pawns.
4. Keep the queen on the board.

Indeed, I certainly agree with the idea of simple plans. This is especially true for a player below the strength of an expert, since the situation on the board quickly changes -- mistakes (both positional and tactical), often serious ones, are made in every game, and when this happens you often have to abandon whatever plan and take advantage of the mistake. Also, at a non-expert level, you just can't judge the position well enough to come up with a good complex, long plan. (Even if the opponent makes no mistakes, you don't know what he is going to do and how it affects your long plan.) It's just pretentious trying. And you can get very far with simple plans. Read what Kramnik has to say about Karpov:

Probably, he did not have a sufficiently deep stratetic thread of his play. Karpov is a chess player of a great number of short, two to three move combinations: he transferred his knight, seized the space, weakened a pawn. In my view, he was not a strategic player by nature.

(From here)

And btw, Kramnik has many good things to say about Karpov, so it's not that he has anything against him. For example the following (from the same article): "He is a versatile chess player, a good tactician who brilliantly calculates lines and positionally very strong." and "Yes, he is definitely a great player."

If short plans are good enough for Karpov, they're good enough for me.

Anyway, the big question is of course: how do you know what plan to make? It annoys me to no end that I don't have a systematic way to decide that, and that's something I have to come up with. Btw, remember that I only play blitz, so everything I say is in that context... and systematic way of thinking that I come up with has to be really quick and efficient -- I have only seconds, but it is remarkable how much you can 'see' quickly in a position if you just ask yourself the right questions (and how many obvious things you don't see without those questions), and it's finding these questions (and integrate them into my thinking so they occur automatically) and their order that is my task.

Locations of visitors to this page