Friday, February 20, 2009

Another Game

Here is another game, with some notes. This was a really interesting game, and I think I mostly played well.

1.e4 e6 2.d3 d5 3.Nd2 Nf6 4.Ngf3 c5 5.g3 Nc6 6.Bg2 Be7 7.O-O

This is a normal position in the King's Indian Attack against the French. Black commonly plays 7...b6 or 7...O-O here. However, my opponent played:

7...b5

Black often plays b5 at some point against the KIA; a common continuation is 7...O-O 8.Re1 b5. I'm not sure Black gains anything by playing this right away. In the game, he ends up castling soon enough, and for the next few moves there are some issues with the fact that he's opened the long diagonal.

8.exd5 exd5 9.c4 bxc4 10.dxc4 O-O

Here Black would consider 10...d4, if not for the fact that 11.Nxd4 is possible. Instead, Black takes a couple moves to clean things up, but ends up with some slightly weak queenside pawns.

During the game I thought that d4 was just impossible, but the computer doesn't think it's too bad. It gives variations like 10...d4 11.Nxd4 Nxd4 12.Bxa8 Bg4 13.Qa4+ Kf8 14.Qxa7 Ne2+ 15. Kh1 Nxc1 16.Raxc1 Qxd2. White has a rook and two pawns for a bishop and knight.

11.b3 Rb8 12.cxd5 Nxd5 13.Bb2 Bf6 14.Bxf6 Nxf6 15.Qc2

The opening is finishing up, and I think White has a good position. There is some pressure on the c5 pawn, and Black still needs to develop a bit.

15...Qa5 16.Ne4 Nxe4 17.Qxe4 Bb7

Black's king is looking a bit lonely.

18.Ng5 g6 19.Qh4 h5 20.Ne4 Nd4?!


This allows me to win the exchange, with a kind of a serial fork. Nf6 will fork the king and the d7 square, where it can fork the two rooks. 20...Ne5 instead would cover d7 and prevent this.

21.Nf6+ Kg7 22.Nd7 Bxg2 23.Kxg2 Qa6 24.Nxf8 Kxf8

White is up the exchange, but I found it quite hard to make further progress.

25.Qe4 Re8 26.Qd5 Ne6 27.Rfd1 Qc8 28.Qd7 Qa8+ 29.Qd5 Qc8 30.Rac1 a5 31.Rc4 Kg8 32.Rd3 Qa6 33.Rdc3 Rd8 34.Qe5 Qb7+ 35.Qe4 Qb6 36.Rd3 Nd4 37.Qe7 Rd5 38.Qe8+ Kg7 39.Qe4 Rf5

Fifteen moves since winning the exchange, and not a lot has changed. Maybe there is a way to continue to improve the position, but instead I played:

40.Rdxd4?!

Now I have a pawn-up rook ending. Even if this turns out to be objectively a good move, my thought process producing it was not so good. After going up the exchange, I was a bit frustrated at not being able to force more progress. Also, I've noticed in some of my games that I can be too eager for clarity in the position.

40...cxd4 41.Qxd4+ Qxd4 42.Rxd4 g5


Here is the rook ending. Another issue with my going into this is that I didn't make myself calculate it as deeply as I should have. Originally I thought I had a straightforward plan of trading the a pawns and putting my rook behind my remaining passed b-pawn. This ends up letting his king get quite active, with something like: 43.Rd2 Kf6 44.a3 Rc5 45.b4 axb4 46.axb4 Rb5 47.Rb2 Ke5 48.Kf3 Kd4. Instead, I decided to bring my king into the game.

43.Kf1 Re5 44.Rd2 g4 45.Re2 Rc5 46.Ke1 Kf6 47.Kd2 Kf5 48.Kd3 Rc1 49.Rc2!

My king is out, and will be able to get to his a-pawn. Black can win my h-pawn, and it looks like there may be some threats there to win some more pawns, or force one through, but I think that White can cover everything.

49...Rd1+ 50.Kc4 Rh1

Another approach for Black is to try to defend the a-pawn. 50...Ke6 51.Kb5 Rd5+ 52.Kb6 and Black is tied up. The rook can't leave the defense of the pawn, and White should be able to continue by trading the a-pawns and pushing the remaining passed pawn.

51.Kb5 Rxh2 52.Kxa5 h4 53.gxh4 g3

This would be very strong, due to the unprotected white rook, if not for the check White has available. As it is, White is winning, though not with too much room to spare.

54.Rc5+ Kg4 55.Rc4+ Kf3 56.fxg3 Rxa2+ 57.Ra4 Rh2 58.b4

58.Rf4+! is given by the computer, when 58...Kxg3 59.Rxf7 is a tablebase win.

58...Kxg3 59.b5 f5 60.b6 Rb2 61.Rb4 Ra2+ 62.Kb5 Ra8 63.b7 Rb8 64.Ka6 f4 65.Ka7 1-0

Black resigned, although even here, a little care is still required. After 65...Rxb7 White has to capture with the king, as 66.Rxb7? Kxh4 is a draw.

Wednesday, February 11, 2009

Keeping You Secure

VeriSign is a company which provides, among other things, digital signing certificates. These certificates provide a mechanism for website users to authenticate that the data they're receiving is legitimate. Of course, in order for this system to work, when you buy one of these certificates from them, VeriSign must confirm that you really are who you say you are. They can't very well issue you a signing certificate for XYZ Inc. if they can't prove you're from that company.

VeriSign has an information page which includes a listing of some of the items they will accept for authenticating your organization. One such item is:

Fictitious Name Statement

Calvin and Hobbes vs. the Bailout

Bill Watterson is a smart guy, I think.


From Greg Mankiw's Blog.

Monday, February 9, 2009

30% of all numbers start with 1

Well, not exactly. However, it is true that in certain common types of data, numbers beginning with 1 appear the most frequently, making up about 30% of the values. Numbers beginning with 2 appear slightly less frequently, about 18% of the time. Each successive digit appears with a lower frequency, until 9 shows up as the leading digit in less than 5% of the values. This property is called Benford's Law, after physicist Frank Benford.

This is quite a counter-intuitive thing. Why should there be more bank balances starting with a 1 than with a 9? Six times more of them, in fact. Why should this be true for the lengths of all the rivers in the world? The technical explanation for this is that these types of real world values are distributed logarithmically. For a more intuitive explanation, an example is probably more helpful.

Let's say you invest $100 in an account that pays 10% annually. This means that your investment will double every 7.3 years. The investment will reach $200 after 7.3 years, so for that entire first 7.3 years the investment's value began with a 1. Now, it will take another 7.3 years to double again. However, this time it's doubling to $400, not $300. The investment was valued in the $100s for the same amount of time it was valued in the $200s and $300s. The point is that the investment is growing at a rate proportional to its own size. It's compounding. The investment only spends 4 years or so in the $200s, 3 years in the $300s, and so on, finally breezing through the $900s in just over a year. Then this repeats for all the 4-digit values: 7.3 years in the $1000s, 4 in the $2000s, etc.

The reason I've been thinking about this topic recently is that it's been mentioned in relation to Bernie Madoff's ponzi scheme. Benford's Law is a good tool for detecting fraudulent data, because people faking such data often don't take it into account. Apparently, Madoff was sophisticated enough to generate numbers that met Benford's Law reasonably well.

As a quick real-world test of this, I thought I'd check the sizes of all the files on my computer's hard drive. The results seem to fit the Law's prediction quite well:











Digit# Files% FilesBenford
148,29528.6%30.1%
232,89319.5%17.6%
323,29713.8%12.5%
415,9259.4%9.7%
512,6127.5%7.9%
610,6656.3%6.7%
78,4385.0%5.8%
89,9725.9%5.1%
96,4983.9%4.6%


Wikipedia Link: Benford's Law

New Car


2009 Rogue!

Friday, February 6, 2009

Tactic #2

Here's a fairly complicated tactic, from computer analysis of a recent game of mine. Black to move.


Solution in the comments.

Monday, February 2, 2009

Most Obscure Function

I was looking back at some old Visual FoxPro code from a few years ago, and came across this line:

THIS.nShipAngle = RTOD(ATN2( .nShipY-tY, tX-.nShipX )) % 360

I figure that this ATN2 is the most obscure VFP function I've found a use for. It returns the arc tangent for a coordinate location, which is probably not a requirement that comes up too often in database application development :). However, when I needed it, there it was.

For interest's sake, the context of this is a clone of the video game Asteroids that I wrote. This is part of the code that aims the player's ship at the mouse pointer.