Reducing King Moves?

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

Reducing King Moves?

Postby mjlef » 03 Jan 2007, 20:27

I have been gathering stats on what moves are found to be best at different game stages. In the openeing and middle games, king moves have an amazingly low percentage for being selected as best (except for castling or if in check). So I have been testing this condition:

if mover=king and not InCheck and not castle_move and not mate_threat and stage<=middlegame then depth-=Ply;

stage increases with game stage, of course.

Although king moves are a small part of the search, it does add up and this saves a measurable amount in both game matches and problem sets. I have epxerimented a bit with other conditions, but these seem to be enough for this to work for me at least.

Note all reductions ar eon top of whatever other reductions I have (like LMR).

If you try this, let me know what you find. I am sure it can be better tuned.

Mark
mjlef
 
Posts: 64
Joined: 29 Mar 2006, 22:04

Re: Reducing King Moves?

Postby Ron Murawski » 03 Jan 2007, 20:52

mjlef wrote:I have been gathering stats on what moves are found to be best at different game stages. In the openeing and middle games, king moves have an amazingly low percentage for being selected as best (except for castling or if in check). So I have been testing this condition:

if mover=king and not InCheck and not castle_move and not mate_threat and stage<=middlegame then depth-=Ply;

stage increases with game stage, of course.

Although king moves are a small part of the search, it does add up and this saves a measurable amount in both game matches and problem sets. I have epxerimented a bit with other conditions, but these seem to be enough for this to work for me at least.

Note all reductions ar eon top of whatever other reductions I have (like LMR).

If you try this, let me know what you find. I am sure it can be better tuned.

Mark


Some early king moves unpin pieces. I would think your reduction would be much safer if you included this consideration.

Ron
User avatar
Ron Murawski
 
Posts: 352
Joined: 26 Sep 2004, 21:50
Location: Schenectady, NY, USA

Re: Reducing King Moves?

Postby Ferdinand » 07 Jan 2007, 15:50

mjlef wrote:I have been gathering stats on what moves are found to be best at different game stages. In the openeing and middle games, king moves have an amazingly low percentage for being selected as best (except for castling or if in check). So I have been testing this condition:

if mover=king and not InCheck and not castle_move and not mate_threat and stage<=middlegame then depth-=Ply;

stage increases with game stage, of course.

Although king moves are a small part of the search, it does add up and this saves a measurable amount in both game matches and problem sets. I have epxerimented a bit with other conditions, but these seem to be enough for this to work for me at least.

Note all reductions ar eon top of whatever other reductions I have (like LMR).

If you try this, let me know what you find. I am sure it can be better tuned.

Mark


Hi Mark,

Did you try to reduce also for king moves that are not captures? BTW what do you mean by mate_threat in one of the conditions you have mentioned? Regards.
User avatar
Ferdinand
 
Posts: 32
Joined: 17 Mar 2006, 06:12
Location: Philippines

Re: Reducing King Moves?

Postby mjlef » 09 Jan 2007, 22:13

Ferdinand wrote:
mjlef wrote:I have been gathering stats on what moves are found to be best at different game stages. In the openeing and middle games, king moves have an amazingly low percentage for being selected as best (except for castling or if in check). So I have been testing this condition:

if mover=king and not InCheck and not castle_move and not mate_threat and stage<=middlegame then depth-=Ply;

stage increases with game stage, of course.

Although king moves are a small part of the search, it does add up and this saves a measurable amount in both game matches and problem sets. I have epxerimented a bit with other conditions, but these seem to be enough for this to work for me at least.

Note all reductions ar eon top of whatever other reductions I have (like LMR).

If you try this, let me know what you find. I am sure it can be better tuned.

Mark


Hi Mark,

Did you try to reduce also for king moves that are not captures? BTW what do you mean by mate_threat in one of the conditions you have mentioned? Regards.


I do reduce king moves that are captures, but not if the king is in check (but I should test this to see if leaving capture full depth is better, like in LMR). I do not reduce castling moves. And of course, all the king move reductions are very early in the game, since later in the game the percentage of best moves which are king moves increases a lot. By mate_threat, I mean using the NULL search to determine if a mating move is threatened. If so, I do not reduce any king moves.
mjlef
 
Posts: 64
Joined: 29 Mar 2006, 22:04

Re: Reducing King Moves?

Postby Ron Murawski » 22 Jan 2007, 16:44

I tried a conservative implementation of your idea and it seems to work.

Code: Select all
         if (
             piece == KING_PIECE &&
             ply > 1 &&
             !incheck &&
             Board->gamestage < MIDDLEGAME &&
             !is_threat &&
             legalmovecount > 4 &&
             !ISCAPTURE(move) &&
             !ISCASTLE(move) &&
             move != Killer[ply].killer1 &&
             move != Killer[ply].killer2
            )
         {
            depth -= HALFPLY;
         }


Thanks!

Ron
User avatar
Ron Murawski
 
Posts: 352
Joined: 26 Sep 2004, 21:50
Location: Schenectady, NY, USA

Re: Reducing King Moves?

Postby mjlef » 22 Jan 2007, 18:03

I am glad to hear it worked for you.

I have recently been doing pretty crazy reductions, and most of them seem to work. Not a huge change in score, but every little bit helps. The critical stuff seems to be to not miss moove helping passed pawns, threatening kings and the like.

I have recently started allowing reducing capture of pawns if the capture is losing (so something like qxP, and the Q gets eaten). I do not reduce checks, while in check, and some other conditions involving passed pawns and king safety, but it does seem to help a bit.

Mark
mjlef
 
Posts: 64
Joined: 29 Mar 2006, 22:04

Re: Reducing King Moves?

Postby Ron Murawski » 23 Jan 2007, 05:07

I've been working on reductions too. An idea that worked for me was to never reduce when a lesser piece attacks a more important piece. I also found that for moves that qualified for reduction, reducing extended moves was better than not reducing them. (Bob Hyatt never reduces moves that get extended.)

Keep those ideas coming, Mark! :)

Ron
User avatar
Ron Murawski
 
Posts: 352
Joined: 26 Sep 2004, 21:50
Location: Schenectady, NY, USA

Re: Reducing King Moves?

Postby mjlef » 26 Jan 2007, 15:53

Ron Murawski wrote:I've been working on reductions too. An idea that worked for me was to never reduce when a lesser piece attacks a more important piece. I also found that for moves that qualified for reduction, reducing extended moves was better than not reducing them. (Bob Hyatt never reduces moves that get extended.)

Keep those ideas coming, Mark! :)

Ron


I have not tried allowing reductions if something else says to extend for a long time, but I will try it tonight. Well, actually I did do that for capturing a dangerous passed pawn, and for the early king moves, and it seemed safe.

It would be great to have a big table showing probabilities of best move for easy to measure things (is it an up attack, a king, game stage, passed pawn, winning cpature, etc) that would give the ideal extension or reduction. Maybe Rybka is just that--a big statistical monster that just knows what works best. It has to have something in that huge EXE!

Mark
mjlef
 
Posts: 64
Joined: 29 Mar 2006, 22:04

Re: Reducing King Moves?

Postby Ron Murawski » 27 Jan 2007, 02:37

Hi Mark,

After further testing of early king move reductions (let's call it EKR) I'm seeing no benefit. My problem with EKR is encountered where the best move sequence might *start* with a king move from e1 to f2. Or positions where guard pawns and king must both advance to defuse a pawn and piece attack. Try playing Now vs Phalanx XXII and you'll start to experience the problem yourself. ;)

I believe that the king must be "castled and unthreatened" for EKR to work, but I'm having difficulty coding that concept into C. Tying EKR to a king safety threshold value would probably work, but may be too expensive to compute. ...but if the logic is perfectly sound, there's no reason to reduce by only one ply, you could reduce by two or more, or perhaps eliminate the move from consideration entirely (forward-prune). I haven't explored this idea yet.

Ron
User avatar
Ron Murawski
 
Posts: 352
Joined: 26 Sep 2004, 21:50
Location: Schenectady, NY, USA

Re: Reducing King Moves?

Postby mjlef » 02 Feb 2007, 15:03

I never had a lot of success totally pruning moves out. What conditions for being in the opening/mid game are you using? I cannot claim a huge gain, but it did not seem to hurt NOW>
mjlef
 
Posts: 64
Joined: 29 Mar 2006, 22:04

Re: Reducing King Moves?

Postby Ron Murawski » 02 Feb 2007, 17:50

mjlef wrote:I never had a lot of success totally pruning moves out. What conditions for being in the opening/mid game are you using? I cannot claim a huge gain, but it did not seem to hurt NOW>


The code I posted was the code that failed. It was working quite well against several engines but when I used it vs Phalanx the roof fell in.

I've been thinking about king reductions and I *may* have a solution, but I need to get the full-depth king safety to perculate back to the root. It might be too expensive to carry this information back. If I find anything that works I'll let you know...

Ron
User avatar
Ron Murawski
 
Posts: 352
Joined: 26 Sep 2004, 21:50
Location: Schenectady, NY, USA

Re: Reducing King Moves?

Postby milix » 06 Feb 2007, 08:42

I don't like the idea of reducing moves that they are not likely the best in a position. These moves may need to be searched in full depth to actually find that they are not so good. Your idea is for sure qood for move ordering and then, null window alpha beta may handle the situation very well. Reducing king moves may have a very negative impact in king safety. Do you have numbers in test positions, eg WAC?
Anastasios Milikas
milix
 
Posts: 54
Joined: 04 Nov 2004, 19:36
Location: Greece

Re: Reducing King Moves?

Postby Uri Blass » 06 Feb 2007, 09:49

milix wrote:I don't like the idea of reducing moves that they are not likely the best in a position. These moves may need to be searched in full depth to actually find that they are not so good. Your idea is for sure qood for move ordering and then, null window alpha beta may handle the situation very well. Reducing king moves may have a very negative impact in king safety. Do you have numbers in test positions, eg WAC?


This is the reason that programs usually do research in case that they get unexpected fail high.

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: Reducing King Moves?

Postby mjlef » 06 Feb 2007, 15:42

I could not find a single test position where reducing the king moves hurts the solution time (with my criteria, restricting the moves I allow to be reduced to early in the game, no in check, not a castling move...). It generally helped find things faster. Of course, I do not think problems are all that helpful in improving playing strength in real games. Many problems are like this "Lets place the queen where it can be captured...because after a bunch of other contorted moves, it will lead to a mate or winning material".

When I do any reductions, I always do a null window search around alpha. If it fails high then I always do a research at full depth with whatever the window would have been. So the risk here is taking an extra ply to find out that moving the king was really the best move.

I do think looking at king safety and maybe disabling early game king move reductions might help. But so far, it seems to work pretty well without this condition. Probably I would have to play several hundred more games to determine if this would help or not. I wish I had more computers! I will try to do some very fast matches over the next few days and see if I can refine the idea.

I am also reducing pawn promotions and passed pawn captures. Does this help for others? I am not sure this helps, but so far it has not seemed to hurt much.

Mark
mjlef
 
Posts: 64
Joined: 29 Mar 2006, 22:04

Re: Reducing King Moves?

Postby Ron Murawski » 06 Feb 2007, 23:11

mjlef wrote:I could not find a single test position where reducing the king moves hurts the solution time (with my criteria, restricting the moves I allow to be reduced to early in the game, no in check, not a castling move...). It generally helped find things faster. Of course, I do not think problems are all that helpful in improving playing strength in real games. Many problems are like this "Lets place the queen where it can be captured...because after a bunch of other contorted moves, it will lead to a mate or winning material".

When I do any reductions, I always do a null window search around alpha. If it fails high then I always do a research at full depth with whatever the window would have been. So the risk here is taking an extra ply to find out that moving the king was really the best move.

I do think looking at king safety and maybe disabling early game king move reductions might help. But so far, it seems to work pretty well without this condition. Probably I would have to play several hundred more games to determine if this would help or not. I wish I had more computers! I will try to do some very fast matches over the next few days and see if I can refine the idea.

I am also reducing pawn promotions and passed pawn captures. Does this help for others? I am not sure this helps, but so far it has not seemed to hurt much.

Mark


At the moment my testing machine is busy testing. (I may have discovered and fixed a bug). Testing lasts two to three full days if preliminary results show forward progress. But I need to travel for a couple of days this week too. So it will be the weekend at the earliest that I can do anything. I think my idea is sound, but I'm worried about the overhead of carrying the deepest pv king safety scores throughout the search. I'm hoping the overhead won't be too bad. I've never done statistics on how often the pv sequence changes.

Reducing king moves for test positions should *always* help. Test positions are tactical and shuffling a king about is not usually a very tactical move. What I'm really saying is that you can't test this idea using test positions. You need test games so you can evaluate how it does in the real world. But you need a tactical opponent to keep you honest. I suggest you test against Phalanx. If you reduce a king move when you shouldn't you can count on Phalanx to pounce.

I never reduce pawn promotions or any type of capture. I've tried reducing very losing captures (loss of rook or queen) and it hurt game play. I don't remember doing any testing on pawn promotion reductions. But I might have done tests on *not* doing it.

Ron
User avatar
Ron Murawski
 
Posts: 352
Joined: 26 Sep 2004, 21:50
Location: Schenectady, NY, USA


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 9 guests