Blunder option

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

op12no2
Posts: 489
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Blunder option

Post by op12no2 »

I've had a few queries recently (due to Netflix?) about making the online Lozza weaker. It seems that for a beginner even a consistently 'accurate' 1 ply search is too strong - which is fair enough - people need to win to stay interested. I came up with this in the top level search just before the test for > alpha etc.

Code: Select all

if (this.mistakes) {
  if (Math.random() <= 1.0/(this.uci.spec.depth * this.uci.spec.depth)) {
    var mm = Math.random() + Math.random();
    this.uci.debug('blunder, changed score of ',board.formatMove(move,SAN_FMT),' from ',score,' to ',score*mm|0);
    score = score * mm | 0;
  }
}
this.uci.spec.depth is maximum depth to search and I enable it in Levels 1 to 4 (1 to 4 ply search) in the online user interface, although it's generic in my extended UCI command set.

It means that every move is tweaked when playing at Level 1 (I wanted to make sure that Level 1 can be beaten by literally everybody) and every 16th move at Level 4.

While this seems to work fine, I was wondering if there is a better/standard way to force blunders?

Try the new user interface here: https://op12no2.github.io/lozza-ui/play.htm

To see the effect on top levels moves you can use the console UI: https://op12no2.github.io/lozza-ui/console.htm

Type for example:-

Code: Select all

start
uci
ucinewgame
position startpos
debug on
mistakes 1
board
go depth 5
Each blunder is listed within the PV etc output.
Last edited by op12no2 on Tue Dec 29, 2020 3:01 pm, edited 1 time in total.
Sesse
Posts: 300
Joined: Mon Apr 30, 2018 11:51 pm

Re: Blunder option

Post by Sesse »

As with pretty much any other engine I've seen, the blunders are just not very believable. It's a really hard problem.

E.g., I played 1. d4 d5 2. c4 Nf6 3. Nf3 Bd7 4. e3 h5 5. Nc3 a5 6. a4 Ra6 7. cxd5

[d]1n1qkb1r/1ppbppp1/r4n2/p2P3p/P2P4/2N1PN2/1P3PPP/R1BQKB1R b KQk - 0 7

From here, the engine played Bc6??, and after dxc6 played Qxd4??. Ra6 (not seeing the discovered attack) is believable, but what kind of beginner would play Bc6?
op12no2
Posts: 489
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: Blunder option

Post by op12no2 »

Sesse wrote: Tue Dec 29, 2020 2:59 pm From here, the engine played Bc6??, and after dxc6 played Qxd4??. Ra6 (not seeing the discovered attack) is believable, but what kind of beginner would play Bc6?
Fair point; I have to confess I had not considered the concept believable, but now you've shown me that example, I definitely need to think some more :)
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Blunder option

Post by Ferdy »

Sesse wrote: Tue Dec 29, 2020 2:59 pm As with pretty much any other engine I've seen, the blunders are just not very believable. It's a really hard problem.

E.g., I played 1. d4 d5 2. c4 Nf6 3. Nf3 Bd7 4. e3 h5 5. Nc3 a5 6. a4 Ra6 7. cxd5

[d]1n1qkb1r/1ppbppp1/r4n2/p2P3p/P2P4/2N1PN2/1P3PPP/R1BQKB1R b KQk - 0 7

From here, the engine played Bc6??, and after dxc6 played Qxd4??. Ra6 (not seeing the discovered attack) is believable, but what kind of beginner would play Bc6?
If that is level 1, that is fine, the idea is to attack the pawn at the front. Beginner level is probably Baby or Idiot :)

But making mistakes is also an art. Tried it in CDrill 1200, and it is not easy at all what mistakes are you going to make. Initially you make mistake by score ranges or so by multipv, then observe the engine behaviour what mistakes it is doing (giving up a piece freely or a losing capture etc.), then make corrections, putting up some conditions, until you are satisfied of what blunder/mistake move it would make.
op12no2
Posts: 489
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: Blunder option

Post by op12no2 »

Ferdy wrote: Tue Dec 29, 2020 3:18 pm But making mistakes is also an art.
Yes, thanks. I think Bc6 looks more like 'it's deliberately trying to lose', rather than 'it made a mistake' which is not a good way to reassure beginners that they are improving perhaps.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Blunder option

Post by Ferdy »

op12no2 wrote: Tue Dec 29, 2020 3:32 pm
Ferdy wrote: Tue Dec 29, 2020 3:18 pm But making mistakes is also an art.
Yes, thanks. I think Bc6 looks more like 'it's deliberately trying to lose', rather than 'it made a mistake' which is not a good way to reassure beginners that they are improving perhaps.
Bc6 is ok, if your lowest level is 1 and that move is made by level 1.

When I was a beginner, I don't know the relative value of pieces. I don't care if I capture a pawn with my queen and my queen will be captured by opponent, what I see is I captured a pawn :) don't even care if I lose, I just want to learn the movement of pieces.
Sesse
Posts: 300
Joined: Mon Apr 30, 2018 11:51 pm

Re: Blunder option

Post by Sesse »

User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Blunder option

Post by flok »

Embla and Micah both have a blunder-option. Unfortunately it is default on and cannot be switched off.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Blunder option

Post by Ferdy »

Sesse wrote: Tue Dec 29, 2020 3:53 pm http://talkchess.com/forum3/viewtopic.php?f=7&t=21264 is a relevant thread.
Nice link.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Blunder option

Post by Ferdy »

flok wrote: Tue Dec 29, 2020 3:56 pm Embla and Micah both have a blunder-option. Unfortunately it is default on and cannot be switched off.
:D