Is LMR Sound.

Discussion of chess software programming and technical issues.

Moderator: Ras

asanjuan
Posts: 214
Joined: Thu Sep 01, 2011 5:38 pm
Location: Seville, Spain

Re: Is LMR Sound.

Post by asanjuan »

Henk wrote:Tried LMR for the tenth time. Used a simple implementation: apply LMR when move is not a capturing move. Did not notice much improvement.
Maybe the program is more tactical, but I also saw very bad strategical lines.For instance bishop got locked in totally by its own pawns.

I cannot measure ELO. But if there is any improvement it certainly is not spectacular. I remove the LMR from the program. I don't want extra code in my program if it doesn't help much.
Remove code that doesn't work is a good practice, BUT, it is also a good practice to test each part of your engine to ensure that you can go one step further.
Don't try to apply LMR if your eval isn't working with a minimum of quality. Also if your move generation does not produce the exact moves for every position. Try to do a perft function before.
Don't try LMR if your qsearch is not working well, or your move ordering functions are bad, etc, etc.
We don't know if your qsearch doesn't stand pat correctly, or whatever.

Now, replace the word "LMR" in the text above with the name of any heuristic, and you'll get a good answer to any of your questions.

You'll have to be more patient.

Regards.
Still learning how to play chess...
knigths move in "L" shape ¿right?
asanjuan
Posts: 214
Joined: Thu Sep 01, 2011 5:38 pm
Location: Seville, Spain

Re: Is LMR Sound.

Post by asanjuan »

Henk wrote:If you apply LMR after only move 25 then it probably will be safe but you won't gain much CPU time. If you apply LMR earlier say after move 10 or some say 4, the chances of missing best moves are much bigger.

But also if in one turn you have chance of missing the best move is 5%, then in 20 turns you get a chance of 1 - power(0.95, 20) of missing a best move. But now I miss my calculator.


Things gets worse when LMR misses the best move and there was only one good move. So it plays a bad move, or even a move which loses the game.
I understand that you haven't understood how the alpha-beta algorithm works, and how a perfect move ordering leads to the theoretical minimum tree.
I recomend you to look at the CPW and search for the basics: understand alpha-beta, the minimum tree... etc. then you'll be ready to understand PVS, LMR, or whatever.
Take care that to write the alpha beta search (which is very easy even for beginners) is very different than to understand how it doesn't loose any information in the search.
Still learning how to play chess...
knigths move in "L" shape ¿right?
User avatar
Steve Maughan
Posts: 1315
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Is LMR Sound.

Post by Steve Maughan »

asanjuan wrote:(...)I understand that you haven't understood how the alpha-beta algorithm works, and how a perfect move ordering leads to the theoretical minimum tree.
I recomend you to look at the CPW and search for the basics: understand alpha-beta,(...)
I agree! If you're a beginner you need to know exactly why alpha-beta works if you are to write a modestly strong engine. For example you should know:
  • >Which value is the highest - alpha or beta?
    >What does a fail high mean?
    >How many nodes are searched on a fail low?
    >Is move ordering more important when the node fails high or fails low?
If you've hung out here for a while (or if you've written your own engine from scratch) you will find these questions easy, almost obvious, but (IMO) if you're a beginner don't click on an IDE before you're 100% certain you know the answers!

Steve
Henk
Posts: 7251
Joined: Mon May 27, 2013 10:31 am

Re: Is LMR Sound.

Post by Henk »

Steve Maughan wrote:
asanjuan wrote:(...)I understand that you haven't understood how the alpha-beta algorithm works, and how a perfect move ordering leads to the theoretical minimum tree.
I recomend you to look at the CPW and search for the basics: understand alpha-beta,(...)
I agree! If you're a beginner you need to know exactly why alpha-beta works if you are to write a modestly strong engine. For example you should know:
  • >Which value is the highest - alpha or beta?
    >What does a fail high mean?
    >How many nodes are searched on a fail low?
    >Is move ordering more important when the node fails high or fails low?
If you've hung out here for a while (or if you've written your own engine from scratch) you will find these questions easy, almost obvious, but (IMO) if you're a beginner don't click on an IDE before you're 100% certain you know the answers!

Steve
Maybe I do not use alfa beta, or I created a dialect.

When I do a search I try to find a move with a value in
[lowerbound .. upperbound] so the value of upperbound is included not excluded. So Select (upperbound, upperbound) may give a result. A result where the move selected has a value of upperbound.
User avatar
Steve Maughan
Posts: 1315
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Is LMR Sound.

Post by Steve Maughan »

Henk,
Henk wrote:Maybe I do not use alfa beta, or I created a dialect
This shows you don't (yet) have sufficient understanding to start writing a chess program. Any competent engine author knows exactly what and how they are using.

I'd suggest studying much more basic topics before you proceed.

Steve
Henk
Posts: 7251
Joined: Mon May 27, 2013 10:31 am

Re: Is LMR Sound.

Post by Henk »

The dialect is simple this time:

I introduced

lowerbound = alfa
upperbound = beta-1

Of course I'm talking double dutch.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Is LMR Sound.

Post by michiguel »

Henk wrote:The dialect is simple this time:

I introduced

lowerbound = alfa
upperbound = beta-1

Of course I'm talking double dutch.
That is not a good idea at all. When you negate the bounds in the child node, everything will break. I am sure that if you post pseudo code about you alpha/beta framework, people will be able to help you to get it correct. In the meantime, you should only focus on it. Otherwise, everything will be a waste of time.

Miguel
User avatar
hgm
Posts: 28464
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Is LMR Sound.

Post by hgm »

Henk wrote:The dialect is simple this time:

I introduced

lowerbound = alfa
upperbound = beta-1

Of course I'm talking double dutch.
I am not saying your code is incorrect (you haven't posted any), but it is in any case a very bad idea to try to communicate with people here in the forum in a dialect that is only understood by yourself. You cannot expect useful exchange of information then.

And as Miguel remarks, if you really would use that lowerbound and upperbound you define as parameters to your 'select' (which is your dialect for what the rest of the World calls 'search'), you would have to do very cumbersome bound adjustments all the time. E.g. you would have to call

select(-upperbound-1, -lowerbound-1)

or you would be doing something wrong.
Henk
Posts: 7251
Joined: Mon May 27, 2013 10:31 am

Re: Is LMR Sound.

Post by Henk »

hgm wrote:
Henk wrote:The dialect is simple this time:

I introduced

lowerbound = alfa
upperbound = beta-1

Of course I'm talking double dutch.
I am not saying your code is incorrect (you haven't posted any), but it is in any case a very bad idea to try to communicate with people here in the forum in a dialect that is only understood by yourself. You cannot expect useful exchange of information then.

And as Miguel remarks, if you really would use that lowerbound and upperbound you define as parameters to your 'select' (which is your dialect for what the rest of the World calls 'search'), you would have to do very cumbersome bound adjustments all the time. E.g. you would have to call

select(-upperbound-1, -lowerbound-1)

or you would be doing something wrong.
I made a mistake:

lowerbound = alfa;
upperbound = beta;

My fail high condition is

if (score > upperbound)

Is that last condition ok?
User avatar
Steve Maughan
Posts: 1315
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Is LMR Sound.

Post by Steve Maughan »

Henk wrote:(...)
My fail high condition is

if (score > upperbound)

Is that last condition ok?(...)
No the condition should be:

Code: Select all

if (score >= upperbound)
It does make a difference.

As I said you need a better understanding of the basics.

Steve