Anti Coward Mode

Code, algorithms, languages, construction...
Post Reply
User avatar
Rebel
Posts: 515
Joined: Wed Jun 09, 2010 7:45 pm
Real Name: Ed Schroder

Re: Anti Coward Mode

Post by Rebel » Sun Dec 22, 2013 8:43 am

A couple tricks that helped me while playing GM's in the late 90's and early 2000's.

1. Add a small bonus (root positions only) leaving pawns hanging, double bonus for pieces hanging, double the bonus again if you have 2 pieces hanging. It will complicate the position. There hardly is any loss in playing strength.

2. More aggressive King Safety. Tricky, but it guarantees long thoughts.

3. Permanent Brain, play from it instantly (within safety bounds of course), it drives them crazy especially when they themselves have little time on the clock left. I have witnessed the annoying looks when a serie of 4-5 moves were executed on the board instantly. It worked.

lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

Re: Anti Coward Mode

Post by lucasart » Sun Dec 22, 2013 10:35 am

Interesting. Although not really what I'm looking for. 1/ and 2/ are only useful if the human takes the bate. But the problem is the opponent is a coward who will try by all means to create blocked and symmetric pawn structures, and exchange pieces as fast as possible. This is the problem. 3/ is psychological: I already do it, but not for that reason (simplicity of implementation): on ponder hit I use the normal time allocation, if consumed, I play (can be instantly or very quick depending on how long opponent took for last move).

The more I look at games like that, the more I realize the solution must be found in pawn structures. If only I could teach the engine to avoid at all cost blocked pawn chains, the rest is not a problem. If the engine manages to keep the position open and asymmetric and double edged, there is no need to add any tricks: the human will get destroyed in a few moves without any effort. The key is to prevent this cowardly play.

Reversly, if I could make my engine play anti comp strategy itself, so I can switch it on and gets lots of draws against SF and Houdini, that would be cool too ;-) Although it would not be the default mode, of course. By default it should be enterprising and aggressive, and assume the opponent is also willing to play, not to block the game.

Anyway, I'll do some experiments and post here if I have anything interesting. The real difficulty is to test such a mode. By definition I cannot test an "improvement" in the field of anti human play, unless GMs are willing to play thousands of games against DiscoCheck. What I have in mind is to make the option symmetric: with a negative value it would play coward strategy, and I would see if DC manages to score better against much stronger engines (by drawing more games blocking pawn structures).
"Talk is cheap. Show me the code." -- Linus Torvalds.

User avatar
Chris Whittington
Posts: 437
Joined: Wed Jun 09, 2010 6:25 pm

Re: Anti Coward Mode

Post by Chris Whittington » Sun Dec 22, 2013 1:28 pm

lucasart wrote:Interesting. Although not really what I'm looking for. 1/ and 2/ are only useful if the human takes the bate. But the problem is the opponent is a coward who will try by all means to create blocked and symmetric pawn structures, and exchange pieces as fast as possible. This is the problem. 3/ is psychological: I already do it, but not for that reason (simplicity of implementation): on ponder hit I use the normal time allocation, if consumed, I play (can be instantly or very quick depending on how long opponent took for last move).

The more I look at games like that, the more I realize the solution must be found in pawn structures. If only I could teach the engine to avoid at all cost blocked pawn chains, the rest is not a problem. If the engine manages to keep the position open and asymmetric and double edged, there is no need to add any tricks: the human will get destroyed in a few moves without any effort. The key is to prevent this cowardly play.

Reversly, if I could make my engine play anti comp strategy itself, so I can switch it on and gets lots of draws against SF and Houdini, that would be cool too ;-) Although it would not be the default mode, of course. By default it should be enterprising and aggressive, and assume the opponent is also willing to play, not to block the game.

Anyway, I'll do some experiments and post here if I have anything interesting. The real difficulty is to test such a mode. By definition I cannot test an "improvement" in the field of anti human play, unless GMs are willing to play thousands of games against DiscoCheck. What I have in mind is to make the option symmetric: with a negative value it would play coward strategy, and I would see if DC manages to score better against much stronger engines (by drawing more games blocking pawn structures).
you should identify the pawn structures and then use the appropriate evaluation (yes, i know this is obvious). have you tried gettign a mass of games, or leaving your engine running for zillions of games, and identifying the number of different pawn structures that actually arise - it's a lot less than max possible, which is also less than max by random placement. which end up winning and which don't? what difference do piece combinations make? should you like knights over bishops, blah blah, I'm sure you can intuit the possibilities. The possibles might be hashable into some sort of magic table, you never know, or the frequent possibles, infrequent could be calculated somehow, or ANN-ed if they don't happen often. I would guess that some of this might be being done (secretly) by one or two of the very strong programs.

lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

Re: Anti Coward Mode

Post by lucasart » Mon Dec 23, 2013 5:16 am

Chris Whittington wrote: you should identify the pawn structures and then use the appropriate evaluation (yes, i know this is obvious). have you tried gettign a mass of games, or leaving your engine running for zillions of games, and identifying the number of different pawn structures that actually arise - it's a lot less than max possible, which is also less than max by random placement. which end up winning and which don't? what difference do piece combinations make? should you like knights over bishops, blah blah, I'm sure you can intuit the possibilities. The possibles might be hashable into some sort of magic table, you never know, or the frequent possibles, infrequent could be calculated somehow, or ANN-ed if they don't happen often. I would guess that some of this might be being done (secretly) by one or two of the very strong programs.
What you are describing here is basically a pawn hash table. And you are suggesting that I hardcode it inside my program ? That's beyond ugly, and cheating, really. I will never do that in my program. Of course, I have a pawn hash table, but its content is filled dynamically, not statically loaded.

Anyway, this has nothing to do with the problem at hand. It's merely a speed optimization. In an anti human mode, I don't care about speed. Even if my NPS is halved, so long as I prevent cowardly strategies from the opponent to block the pawn structures, it's a net gain against humans. Whether the comp is 100x or 200x stronger than humans at pure tactics is not important, that's not where the games (ones that human draw or win) are decided.
"Talk is cheap. Show me the code." -- Linus Torvalds.

User avatar
Rebel
Posts: 515
Joined: Wed Jun 09, 2010 7:45 pm
Real Name: Ed Schroder

Re: Anti Coward Mode

Post by Rebel » Mon Dec 23, 2013 6:31 pm

lucasart wrote:PS: I would like to prove to Lyudmil Tsvetkov that, even a "weak" engine like DiscoCheck, can demolish him in every single game if I can teach it to not fall for these cowardly human plans to draw by exchanging all pieces or by blocking all the pawns.
Aha, when it's about this guy then Chris' suggestion is not so bad. With an util create a special pawn hash table that creates the most important pawn chains, then asymmetrically penalize them. Another suggestion is to asymmetrically bonus the number of (semi) open files.

hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: Anti Coward Mode

Post by hyatt » Mon Dec 23, 2013 7:00 pm

There are several things I do, although what I do is far, far from optimal.

1. Pawn levers. Sometimes called "potential pawn breaks". If you have none available, you have to live with the existing pawn structure. If you don't have any entry to the opponent side, you draw unless your opponent does something.

2. There are other special cases of the above. "pawn rams" are well known but are really the absence of levers, so that covers both.

3. There are versions of Crafty that go farther, but there is cost. For example, detecting the a2-b3-c4-d5-e4-f3-g2 type of blocked position (opponent pawns ram every one of those, a classic anti-computer position). But how often do you see that? And rather than going for outright recognition of something you can't break through, the pawn lever comes to your aid again. Use an exponential score. No levers... really bad penalty. one lever, only 1/2 the penalty, etc.

The thing I don't do is to make this asymmetric. For example, if I am down in material, blocking the pawns can "sometimes" be good (the usual rule is if behind in material, trade pawns but not pieces). That means that the "lever bonus/penalty" has to take into account whether that side is better or worse overall. For example, in the above pawn chain, adding in h pawns to "seal things up" if the white pawn on d5 is passed (and also protected) white might be happy. Too happy. Because it is hard to advance that passed pawn if you can't get to the black side of the board. If you are on the white side, you want one or more levers to give you a way to break in. If you are on the black side, you'd probably be happy to lock the pawns and force the draw. I've not gotten around to that, as of yet, but it is on my list. The real problem is that locked pawns can be good OR bad, depending on the underlying position.

I've not had problems with locked pawns in many years playing on ICC. Yes you will occasionally get into one, but if you do this carefully, most of the time you stop it before it gets started, needing only to be just a bit careful with pawn structure in specific openings where locking things up is more common.

lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

Re: Anti Coward Mode

Post by lucasart » Tue Dec 24, 2013 5:35 am

Rebel wrote:
lucasart wrote:Another suggestion is to asymmetrically bonus the number of (semi) open files.
Interesting, I'll give it a try. I'm actually wondering whether half open files are not better (to create asymmetry) than open files. The typical human coward would use open files to exchange both rooks ASAP.
"Talk is cheap. Show me the code." -- Linus Torvalds.

lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

Re: Anti Coward Mode

Post by lucasart » Tue Dec 24, 2013 5:38 am

hyatt wrote:There are several things I do, although what I do is far, far from optimal.

1. Pawn levers. Sometimes called "potential pawn breaks". If you have none available, you have to live with the existing pawn structure. If you don't have any entry to the opponent side, you draw unless your opponent does something.

2. There are other special cases of the above. "pawn rams" are well known but are really the absence of levers, so that covers both.

3. There are versions of Crafty that go farther, but there is cost. For example, detecting the a2-b3-c4-d5-e4-f3-g2 type of blocked position (opponent pawns ram every one of those, a classic anti-computer position). But how often do you see that? And rather than going for outright recognition of something you can't break through, the pawn lever comes to your aid again. Use an exponential score. No levers... really bad penalty. one lever, only 1/2 the penalty, etc.

The thing I don't do is to make this asymmetric. For example, if I am down in material, blocking the pawns can "sometimes" be good (the usual rule is if behind in material, trade pawns but not pieces). That means that the "lever bonus/penalty" has to take into account whether that side is better or worse overall. For example, in the above pawn chain, adding in h pawns to "seal things up" if the white pawn on d5 is passed (and also protected) white might be happy. Too happy. Because it is hard to advance that passed pawn if you can't get to the black side of the board. If you are on the white side, you want one or more levers to give you a way to break in. If you are on the black side, you'd probably be happy to lock the pawns and force the draw. I've not gotten around to that, as of yet, but it is on my list. The real problem is that locked pawns can be good OR bad, depending on the underlying position.

I've not had problems with locked pawns in many years playing on ICC. Yes you will occasionally get into one, but if you do this carefully, most of the time you stop it before it gets started, needing only to be just a bit careful with pawn structure in specific openings where locking things up is more common.
Very interesting. I'll have to educate myself on what pawn levers and pawn rams are exactly, and experiment with that. But yes, that's the idea. Actively prevent sterile pawn structures.
"Talk is cheap. Show me the code." -- Linus Torvalds.

hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: Anti Coward Mode

Post by hyatt » Tue Dec 24, 2013 8:50 pm

lucasart wrote:
Rebel wrote:
lucasart wrote:Another suggestion is to asymmetrically bonus the number of (semi) open files.
Interesting, I'll give it a try. I'm actually wondering whether half open files are not better (to create asymmetry) than open files. The typical human coward would use open files to exchange both rooks ASAP.

From a pure chess player point of view, I don't like the idea. The general idea in pawn structure is to have as FEW pawn islands as possible, not as many as you can create. half-open files simply mark the boundary between two pawn islands. Which would you generally prefer? (a) three pawns on one side, two on the other; (b) 3 tripled isolated pawns and 1 pair? Blindly counting files with no friendly pawns doesn't seem productive to a chess player.

Post Reply