LMR

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Bas Hamstra

Re: Hi Dann

Post by Bas Hamstra »

I must admit that you make me curious, but I am highly skeptical. I am talking about 1 table lookup returning the SEE value, taking batteries into account. Without destroying performance by building the AttackTo table.
Could you describe the general idea for BB? I know howto for bb, but certainly not without destroying performance.

Bas









> Easy as falling off of a log.
> Send me an email and I will tell you how to do it.
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: LMR

Post by JVMerlino »

bob wrote:
Bas Hamstra wrote: Naive version: reduce everything after the 4th move, provided the move is no capture and there was no extension triggered. It sucks :-)
Bas
I'd never do that. I don't reduce the hash move, nor captures, nor killer moves, moves that give check, etc. Anything else is fair game, if I can't see any tactical potential for the move.
Ditto here. Here are the moves/situations that I won't reduce:

-- First four moves in move ordering (includes the hash move)
-- remaining depth > 3
-- not a promotion, capturing or checking move
-- not a pawn move
-- not while in check
-- not in a mate threat situation as reported by the hash move

Perhaps the above are too conservative, but that's fine by me. :)

jm
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Hi Dann

Post by Dann Corbit »

Bas Hamstra wrote:I must admit that you make me curious, but I am highly skeptical. I am talking about 1 table lookup returning the SEE value, taking batteries into account. Without destroying performance by building the AttackTo table.
Could you describe the general idea for BB? I know howto for bb, but certainly not without destroying performance.

Bas
The idea is like this:
For all sliding pieces, precalculate the 8 bit (or less) bitmaps for all 127 bit patterns on each ray. The bitmaps contain not only attacked chessmen, but also x-ray (as a separate bitmap) and half-pins if you like.
[d]4k3/6q1/8/8/3n4/8/1B6/Q3K3 w - -
White bishop attack mask is 10110000 (white queen's attack is really a 'defend' because colors are the same)
White bishop's x-ray mask is 00001110 to indicate the two 'shadow' squares behind the knight and the queen.
You can even carry another level if you like (I call it half pins).

Once you have precalculated every possible attack pattern, have a program that writes functions that deal with each possible mask. These are used for incremental evaluation, makemove, update of SEE data, etc.

For every square that is attacked, the generated MAKE program is going to increment your 8x8x(12+12+1) {row/col/(chessman_of_color_count+xrays_of_color_count + computed_safeness)} board control array with attacks by piece type and color. The generated UNMAKE program is going to decrement the same values. You can think of it as the operation of picking a piece up for UNMAKE and putting it down for MAKE.

For every square on the board (not just those occupied with chessmen!), you will know how many attackers and what kind and what color they are. This will give you board control information (IOW, is square H4 safe to put a white knight on? How about a white pawn?")

Besides traditional SEE information you will also know whether you should put a chessman of a particular type on an empty square. You also have a big boost for performing an incremental evaluation. For these reasons, I think it is not too expensive to perform the calculations.
It will also help with move generation. You can generate the moves according to the entire board SEE (not just squares with men on them) so that you would choose to put your queen on a square that is not x-rayed by the opponent preferred to one that is, etc.

Just another way of doing things. The downside is that the generated code is really huge. Especially if you use the opponent bitmap to generate a different move set for each of the 127 {or less} possible positions on each ray for sliders (while using your own color bitmap to mark dead ends).

So you end up with a jillion routines for each piece type both for SEE calculation and make/unmake move calculation. Someone once suggested to me the idea of having a distinct routine for each *combination* of SEE and MOVE but the code becomes too large that way (and also too hard to name sensibly so that it is clear exactly what the routine is doing by the name of it).

Have your function generator name the methods so it is clear what they mean. Otherwise, it's too hard to debug.

You can also come up with special bonus rules for multiple sliders of the same type and color on a ray (obviously, an important situation for battery, x-ray, etc.).

I think that the idea is obvious enough, but the only way to implement it is with a program that writes functions. It would be far too tedious to implement it by hand.
Tord Romstad
Posts: 1808
Joined: Wed Mar 08, 2006 9:19 pm
Location: Oslo, Norway

Re: Hi Dann

Post by Tord Romstad »

Uri Blass wrote:1)Computer chess is not about beating humans but about beating other programs so I think that 64 bit hardware is clearly relevant for computer chess.
This is only the case for an extremely tiny minority of all computer chess users. Most users have never played a single game between two computer chess programs. Computer chess today is about making something which is challenging, but fun to play against for users of a wide range of strengths.

For my own program, at least 99% of the users run it on an iPod or iPhone. So far, nobody has complained that the program is too weak on an iPhone. On the other hand, I get several e-mails per week with complaints saying that the program is too strong even at the weakest levels.

On modern multi-core 64 bit desktop CPUs, playing strength is rapidly becoming completely irrelevant. To use my favorite analogy once again, the difference between playing against a 2800 rated and a 3000 rated chess program is comparable to the difference between falling from 2800 meters and falling from 3000 meters.
Tord Romstad
Posts: 1808
Joined: Wed Mar 08, 2006 9:19 pm
Location: Oslo, Norway

Re: Hi Dann

Post by Tord Romstad »

plattyaj wrote:
Tord Romstad wrote:The problem is that 64-bit hardware is currently not relevant for computer chess, and seems unlikely to ever be relevant. Today, only desktop and full-featured laptop computers use 64-bit CPUs, and these computers are invariably so fast that any half decent
Actually I doubt you could easily buy a laptop that didn't have a 64 bit chip in it these days. I just checked Dell's lowest entry laptop right now (Celeron 743) and that's 64 bit.
True, but the trend today is away from laptops, as they are too expensive and unnecessarily powerful for the majority of users. Netbooks are more popular these days, and these are still much slower.
Mincho Georgiev
Posts: 454
Joined: Sat Apr 04, 2009 6:44 pm
Location: Bulgaria

Re: Hi Dann

Post by Mincho Georgiev »

To use my favorite analogy once again, the difference between playing against a 2800 rated and a 3000 rated chess program is comparable to the difference between falling from 2800 meters and falling from 3000 meters.
:lol: You made my day with that one, really :lol:
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: LMR

Post by bob »

JVMerlino wrote:
bob wrote:
Bas Hamstra wrote: Naive version: reduce everything after the 4th move, provided the move is no capture and there was no extension triggered. It sucks :-)
Bas
I'd never do that. I don't reduce the hash move, nor captures, nor killer moves, moves that give check, etc. Anything else is fair game, if I can't see any tactical potential for the move.
Ditto here. Here are the moves/situations that I won't reduce:

-- First four moves in move ordering (includes the hash move)
-- remaining depth > 3
-- not a promotion, capturing or checking move
-- not a pawn move
-- not while in check
-- not in a mate threat situation as reported by the hash move

Perhaps the above are too conservative, but that's fine by me. :)

jm
Very conservative. Don't like the depth > 3. Most of the advantage of LMR occurs when you reduce moves near the root, since this is an exponential gain based on depth. Ditto for pawn moves. Passed pawn moves, maybe. But there are a ton of totally hopeless pawn moves that can safely be reduced.
BubbaTough
Posts: 1154
Joined: Fri Jun 23, 2006 5:18 am

Re: Hi Dann

Post by BubbaTough »

Tord Romstad wrote:
Uri Blass wrote:1)Computer chess is not about beating humans but about beating other programs so I think that 64 bit hardware is clearly relevant for computer chess.
This is only the case for an extremely tiny minority of all computer chess users. Most users have never played a single game between two computer chess programs. Computer chess today is about making something which is challenging, but fun to play against for users of a wide range of strengths.

For my own program, at least 99% of the users run it on an iPod or iPhone. So far, nobody has complained that the program is too weak on an iPhone. On the other hand, I get several e-mails per week with complaints saying that the program is too strong even at the weakest levels.

On modern multi-core 64 bit desktop CPUs, playing strength is rapidly becoming completely irrelevant. To use my favorite analogy once again, the difference between playing against a 2800 rated and a 3000 rated chess program is comparable to the difference between falling from 2800 meters and falling from 3000 meters.
Well, just to play devils advocate, there are a pretty large number of people that use computers for things like analyzing their own games, or opening ideas and such. In which case, stronger is better. In fact, I wouldn't be surprised if just as many people use them to analyze as use them to play against. One is certainly free to speculate regarding which is more common, but there is no doubt that using computers to analyze games and openings is extremely widespread, and its a worthwhile pursuit to continue to improve computer capabilities in this area. In my opinion, there are many large breakthroughs left to discover in computer chess to improve computer analysis ability by leaps and bounds.

-Sam
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Hi Dann

Post by michiguel »

Tord Romstad wrote:
Uri Blass wrote:1)Computer chess is not about beating humans but about beating other programs so I think that 64 bit hardware is clearly relevant for computer chess.
This is only the case for an extremely tiny minority of all computer chess users. Most users have never played a single game between two computer chess programs. Computer chess today is about making something which is challenging, but fun to play against for users of a wide range of strengths.

For my own program, at least 99% of the users run it on an iPod or iPhone. So far, nobody has complained that the program is too weak on an iPhone. On the other hand, I get several e-mails per week with complaints saying that the program is too strong even at the weakest levels.

On modern multi-core 64 bit desktop CPUs, playing strength is rapidly becoming completely irrelevant. To use my favorite analogy once again, the difference between playing against a 2800 rated and a 3000 rated chess program is comparable to the difference between falling from 2800 meters and falling from 3000 meters.
I strongly disagree.

Strength will never be irrelevant and there is no limit for that. You are assuming that most users play against the computers. I think that most users use programs in desktop for analysis. In this case, the stronger the better, and the faster the better because I can get games analyzed in a fraction of the time, or with a better quality for the same time.

Miguel
Tord Romstad
Posts: 1808
Joined: Wed Mar 08, 2006 9:19 pm
Location: Oslo, Norway

Re: Hi Dann

Post by Tord Romstad »

BubbaTough wrote:Well, just to play devils advocate, there are a pretty large number of people that use computers for things like analyzing their own games, or opening ideas and such.
Sure, many players do. I am fairly sure almost all of them would be better chess players if they never or just very rarely used computer programs for analysis. Being able to analyze quickly and precisely without any external tools is the single most important skill of a chess player, and using every opportunity to practice this skill is the best way to improve for all but the top few percent of all tournament players. I think the main reason why using computers for analysis at sub-GM level is laziness. Analyzing without a computer is hard work. Tournament chess players feel that they should do something to improve their chess, and analysing games or openings with a computer gives them the nice feeling that they are doing something, but in reality they would be better served by doing some difficult non-computer-assisted analysis.

I'm a mathematician by education, and have spent most of my adult life doing and teaching mathematics. One of the recurring discussions regarding mathematical education is the use of calculators. Many people feel that at least at the college/university level, doing basic numerical calculations by hand is a waste of time, and that using calculators should therefore be allowed at all exams. In my experience (and most other pure mathematicians I have discussed this with agree) students who are used to using calculators turn out to be severely handicapped in practice: They make far too many stupid mistakes in all sorts of moderately complex symbolic calculations where the calculator can't help them. They lack the precision and mental discipline which those who are used to calculating everything by hand have developed.

Even using a calculator just to check that something is computed correctly is harmful: It is important to develop the ability to calculate sufficiently precisely that you know the answer is right, without any method to check it with external help. I think this is even more important when playing chess than when doing mathematics, because when you discover that you have miscalculated something when making your last move in a game of chess, there is no way to go back and correct the mistake.

For players at GM level and above, for book authors, and for people who write about chess in magazines or on the Internet, chess programs are obviously useful analysis tools. For everybody else, I think they do more harm than good.