Strategies for weaker play levels

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 4:02 pm

Re: Strategies for weaker play levels

Post by brtzsnr »

Evert wrote:
Ferdy wrote:Have you tried weakening by multipv?
Not yet. At the moment I don't actually store the moves and scores in multi-pv mode, I just print them (and it only works in analysis mode at the moment).

I'll give it a go, but I suspect it still leads to play that isn't very balanced for very weak players/beginners...
I had started a similar thread a while ago. Implementing logic to weaken the play in specif areas (e.g. lmr, check extensions, crippled eval) leads poorer play, but not enough. I got at most 300 Elo, which is not enough. It also leads to a lot of complexity to decide which combinations work best at each level. I decided to go the multipv route which seems simpler overall.
Vinvin
Posts: 5223
Joined: Thu Mar 09, 2006 9:40 am
Full name: Vincent Lejeune

Re: Strategies for weaker play levels

Post by Vinvin »

Evert wrote:
Vinvin wrote:
Vinvin wrote:
Evert wrote:I've been looking a bit at implementing strength levels in SjaakII.
Set a bonus/malus random values for each move at the root.

How ?
At the beginning of the game, set the range (example from -2 to +2).
Before each search (each move) set a random number for each root move : e4-> random[-2, 2], d4->random[-2, 2], ...
The evaluation will add this value for the corresponding move.
The search could last 0.1 sec.
The advantage : to not blunder too much.
The disadvantage : it will never blunder a mate.
Note : to decrease the number of bigger mistakes, you can use : Factor*Square(random[0, 1]).
And the opposite, to rise the number of bigger mistakes : Factor*SquareRoot(random[0, 1]).
Does it lead to natural play?
A human who plays at 1000 Elo is mostly clueless. A computer can play at 1000 Elo by playing at 2500+ Elo most of the time and bungling a piece now and then. This isn't so great because it's obvious that the computer is letting you win.

My concern with tweaking the search or the evaluation is that it mainly makes the computer beatable for those who know how to play, not for those who are learning...
I'd say yes if the random value is not too big [-100 , +100].
With higher values, it can play strange moves (1.h4 ?). But we have to play strange moves to be weak ...
If the beginner wins, reduce the random value by 20% .
Vinvin
Posts: 5223
Joined: Thu Mar 09, 2006 9:40 am
Full name: Vincent Lejeune

Re: Strategies for weaker play levels

Post by Vinvin »

Vinvin wrote:
Evert wrote:
Vinvin wrote:
Vinvin wrote:
Evert wrote:I've been looking a bit at implementing strength levels in SjaakII.
Set a bonus/malus random values for each move at the root.

How ?
At the beginning of the game, set the range (example from -2 to +2).
Before each search (each move) set a random number for each root move : e4-> random[-2, 2], d4->random[-2, 2], ...
The evaluation will add this value for the corresponding move.
The search could last 0.1 sec.
The advantage : to not blunder too much.
The disadvantage : it will never blunder a mate.
Note : to decrease the number of bigger mistakes, you can use : Factor*Square(random[0, 1]).
And the opposite, to rise the number of bigger mistakes : Factor*SquareRoot(random[0, 1]).
Does it lead to natural play?
A human who plays at 1000 Elo is mostly clueless. A computer can play at 1000 Elo by playing at 2500+ Elo most of the time and bungling a piece now and then. This isn't so great because it's obvious that the computer is letting you win.

My concern with tweaking the search or the evaluation is that it mainly makes the computer beatable for those who know how to play, not for those who are learning...
I'd say yes if the random value is not too big [-100 , +100].
With higher values, it can play strange moves (1.h4 ?). But we have to play strange moves to be weak ...
If the beginner wins, reduce the random value by 20% .
BTW , I would like to know how weaker is an engine with some random values :
1) [-20 , +20]
2) [-50 , +50]
3)[-100 , +100]
User avatar
Ajedrecista
Posts: 1952
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: Strategies for weaker play levels.

Post by Ajedrecista »

Hello:

May I insist on my idea again? It involves random numbers, like Vincent's idea, but the approach is quite different. If I had understood well:

a) Vincent suggests to do a normal PV search, then obtain normal evals, then randomize these evals via adding numbers in the interval [min., max.] and choose the best move after this randomize.

b) What I propose is do a normal PV search, then obtain normal evals (the same than Vicent up to this point), then giving a probability to each move in basis of its eval and the random number chooses a move from the list.

In other words:

Code: Select all

Vincent's method:

N possible moves in a given position

eval_1, eval_2, ..., eval_N

1 =< i =< N

&#40;eval_i&#41;* = eval_i + &#91;random&#40;&#91;min., max.&#93;)&#93;_i

Pick up max.&#91;&#40;eval_i&#41;*&#93; &#40;evals are from the side to move&#41;
Vincent wrote about the disadvantage of not missing checkmates. My method overcomes this issue, as everybody can read in the post I linked above.

In my method, I would suggest turning SMP off (is it deterministic?) in a try to weaken a little more the search and the evals. Taking in mind that different computers have different speed searches and that would be nice to level strength in different PCs, a fixed node search or a fixed depth search could be given a go. In this case, the engine would surely spend few time per move, unless a normal search is done... but then the engine will be more realistic in time management but there would be speed differences between different PCs, implying different levels of play inside the same supposed level.

Other issue is that engines usually improve: more accurate evals, faster search, etc. In my method, those changes lead to an improvement of all the playing levels except the random mover level, of course (probably nothing happens with Vincent's method here, it depends on the width max. - min.). One can consider doing a special version of weak levels, tune it well and move on. What do you think? Could it have a chance?

Regards from Spain.

Ajedrecista.