Castling: A counter-intuitive result

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Castling: A counter-intuitive result

Post by sje »

Castling: A counter-intuitive result

Player Zero will play a randomly selected castling move if one is available; otherwise, it will play a randomly selected move.

Player One will play a randomly selected move.

What happens in a ten million game match between these players? With alternating colors and from the viewpoint of Player Zero, the win/lose/draw/total counts are:

Code: Select all

W/L/D/T: [762,458/782,299/8,455,243/10,000,000]
Although the effect is slight, why does castling decrease winning chances?
Aleks Peshkov
Posts: 984
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia
Full name: Aleks Peshkov

Re: Castling: A counter-intuitive result

Post by Aleks Peshkov »

Randomly selected move have chance to be a capture move.
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Castling: A counter-intuitive result

Post by zullil »

Aleks Peshkov wrote:Randomly selected move have chance to be a capture move.
Good point.

Perhaps also that, in games that consist of random play, kings that remain in the center are simply more valuable than kings near the corners. They have more mobility, and thus more opportunity to make random captures of unprotected pieces.

Castling is a good idea---if you have an opponent whose goal is to checkmate you!
Uri Blass
Posts: 11162
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Castling: A counter-intuitive result

Post by Uri Blass »

sje wrote:Castling: A counter-intuitive result

Player Zero will play a randomly selected castling move if one is available; otherwise, it will play a randomly selected move.

Player One will play a randomly selected move.

What happens in a ten million game match between these players? With alternating colors and from the viewpoint of Player Zero, the win/lose/draw/total counts are:

Code: Select all

W/L/D/T: [762,458/782,299/8,455,243/10,000,000]
Although the effect is slight, why does castling decrease winning chances?
Maybe you should try to do the following for player 0.

1)Choose a randomely selected move without playing it.
2)If the random move is a capture or promotion play it otherwise go to 3.
3)Play a randomly selected castling move if one is available otherwise play the move that you chose in step 1.

Note that I am not sure if even this is going to give player 0 more than 50% and my intuition is that castling does not help if the opponents play random moves and maybe it may even increase the probability of the side who castled to get back rank mate.
User avatar
hgm
Posts: 28468
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Castling: A counter-intuitive result

Post by hgm »

Indeed. And if you know you'd better not advance the Pawns in front of your King. Castling 'into the open' is hardly an advantage.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

The spirits are about to speak!

Post by sje »

Player Zero will play a randomly selected checking move if one is available; otherwise, it will play a randomly selected move.

Player One will play a randomly selected move.

What happens in a million game match between these players? With alternating colors and from the viewpoint of Player Zero, the win/lose/draw/total counts are:

Code: Select all

W/L/D/T: [161,172/54,101/784,727/1,000,000]
jdart
Posts: 4428
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Castling: A counter-intuitive result

Post by jdart »

A suggestion: maybe it is more reasonable to implement a program with a material-only eval, and then selectively add "smarts" to it. So program A has only material eval, program B has material eval + castling bonus.

The resulting games will be much closer to "real chess" and will give you an idea of what castling is really worth.

Of course with a real eval function you need to do at least a minimal search and that will cost more CPU than the tests you are running now.

--Jon
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Watch me pull a rabbit out of my hat

Post by sje »

Player Zero will play a randomly selected en passant move if one is available; otherwise, it will play a randomly selected move.

Player One will play a randomly selected move.

What happens in a million game match between these players? With alternating colors and from the viewpoint of Player Zero, the win/lose/draw/total counts are:

Code: Select all

W/L/D/T: [78,373/74,801/846,826/1,000,000]
Daniel Shawul
Posts: 4186
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Castling: A counter-intuitive result

Post by Daniel Shawul »

The reason why monte-carlo simulation does not work well in chess is because captures are optional. So step (2) does not work well, since the capture could a loosing one. SEE does not help much either. But for games like checkers you can get a very strong engine even without building a UCT tree, i.e. random palyout right from the root. Biasing selection of other good moves can help but may not be worth it since it slows down rate of random play outs.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

And now for something you'll really like

Post by sje »

Player Zero will play a randomly selected non-drawing move if one is available; otherwise, it will play a randomly selected move (which will draw the game).

Player One will play a randomly selected move.

What happens in a ten thousand game match between these players? With alternating colors and from the viewpoint of Player Zero, the win/lose/draw/total counts are:

Code: Select all

W/L/D/T: [817/786/8,397/10,000]
These games take a long time to play.