Quick loss

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Quick loss

Post by Henk »

Tested my chess program. Now I played with white myself.
I got:

e2-e4 g8-f6
e4-e5 f6-e4 ?? This knight can not be saved anymore.
d2-d4 e7-e6
g2-g3 b8-c6
f2-f3 e4-g5
h2-h4 f8-b4 Maybe this is why the program does not see it because this check extends the variation
c2-c3 (1 - 0)


How can I prevent f6-e4 from being played ?
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Quick loss

Post by lucasart »

Perhaps you should try to put a penalty for a knight on e4.

We will call it the "Henk heuristic", and the community will forever be grateful for its contribution.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
Henk
Posts: 7221
Joined: Mon May 27, 2013 10:31 am

Re: Quick loss

Post by Henk »

lucasart wrote:Perhaps you should try to put a penalty for a knight on e4.

We will call it the "Henk heuristic", and the community will forever be grateful for its contribution.
Yes a penalty for f6-e4. I normally play petroff defense with black which gives a knight on e4 and it always results in a draw. So a penalty is justified.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Quick loss

Post by lucasart »

I was just taking the piss with the penalty thing. But if you think it's a good idea, and you can't figure out what's wrong with it, then go ahead and do that. It's your program, not mine, so I don't really care...
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
asanjuan
Posts: 214
Joined: Thu Sep 01, 2011 5:38 pm
Location: Seville, Spain

Re: Quick loss

Post by asanjuan »

Henk wrote:Tested my chess program. Now I played with white myself.
I got:

e2-e4 g8-f6
e4-e5 f6-e4 ?? This knight can not be saved anymore.
d2-d4 e7-e6
g2-g3 b8-c6
f2-f3 e4-g5
h2-h4 f8-b4 Maybe this is why the program does not see it because this check extends the variation
c2-c3 (1 - 0)


How can I prevent f6-e4 from being played ?
wow, what a question!
I can make another one: what can I do to make my program play the same moves as houdini? :D

Jokes apart, I remember the times when my program(s) made this kind of mistakes. I think that there must be a bug somewhere. It can be:
- a bad evaluation on knight's mobility?
- you are missing some moves in your move generator so you never reach the position where the knight is lost.
- you are reducing important branches
- null move isn't well implemented. (you can't see the threat)
- your knight value is lower than a pawn... who knows?
- it is going to rain, and the humidity changes some bits in your computer's ram... :shock:
- a combination of everything
- none of the above.
Still learning how to play chess...
knigths move in "L" shape ¿right?
Henk
Posts: 7221
Joined: Mon May 27, 2013 10:31 am

Re: Quick loss

Post by Henk »

lucasart wrote:I was just taking the piss with the penalty thing. But if you think it's a good idea, and you can't figure out what's wrong with it, then go ahead and do that. It's your program, not mine, so I don't really care...
I was just joking back. (sorry for my bad English)
Henk
Posts: 7221
Joined: Mon May 27, 2013 10:31 am

Re: Quick loss

Post by Henk »

If I give black more thinking time he plays 1 .. d7-d5 or 3 .. f6-g8

But this reply of f6-e4 after 1 e4 g8-f6 I encounter so often and then after a while it suddenly disappears. Program is under development you know changing all the time.

[Some annoying errors coming back again and again.
For instance erroneous en passant moves to mention one]
Last edited by Henk on Mon Aug 12, 2013 2:48 pm, edited 2 times in total.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Quick loss

Post by lucasart »

Henk wrote:
lucasart wrote:I was just taking the piss with the penalty thing. But if you think it's a good idea, and you can't figure out what's wrong with it, then go ahead and do that. It's your program, not mine, so I don't really care...
I was just joking back. (sorry for my bad English)
OK. You got me worried ;-)
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
asanjuan
Posts: 214
Joined: Thu Sep 01, 2011 5:38 pm
Location: Seville, Spain

Re: Quick loss

Post by asanjuan »

Henk wrote:If I give black more thinking time he plays 1 .. d7-d5 or 3 .. f6-g8

But this reply of f6-e4 after 1 e4 g8-f6 I encounter so often and then after a while it suddenly disappears. Program is under development you know changing all the time.

[Some annoying errors coming back again and again.
For instance erroneous en passant moves to mention one]
I had the same problems time ago. The solution is to test every part of the engine intensively.
I mean: check that the move generator until you are sure that is perfect, and nothing less.
It is only done implementing, testing and debugging a perft function. This is the first step. Forget anything else. Then, implement an eval function that has only material + piece-square tables.
And after that, take your perft function (that is a almost a minimax) and change it to make your first alpha beta search function, so your search can detect mate, slatemate, or a simple evaluation.
Copypaste your alphabeta, and change it to search only for captures. Call this new function "quiescence".
Forget everything. this is my advice. Forget everything and try to get this minimum working PERFECTLY.
Believeme, I have rewritten my engine twice, and this is the right way.

I know that is a lot of work, but is the only way IF YOU WANT TO DO IT YOURSELF, and understanding everything in your chess program.
This is what I've done, and currently I have a nice engine rated about 2400 elo. Still with a lot of work to be done.

There is another way to get a good chess program: take a good open-source program, change 2 or 3 parameters, compile it, and publish the binaries, but never the sources. You'll have a very good program.

And there is another way to achieve good results in chess programming: take a good open-source program, copy the board representation, and change the name of the variables at your own like, take move generation routines and do the same, repeat until you have a complete chess program. Run 10.000 games to test it, and release it as another open-source.
One or two guys here in this forum call this technique "create a chess engine from scratch" and they have a really nice engine, a little bit worse than the original, but really nice in fact. Much better than yours and mine in terms of elo.

Best wishes.
Still learning how to play chess...
knigths move in "L" shape ¿right?
Uri Blass
Posts: 10380
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Quick loss

Post by Uri Blass »

Henk wrote:Tested my chess program. Now I played with white myself.
I got:

e2-e4 g8-f6
e4-e5 f6-e4 ?? This knight can not be saved anymore.
d2-d4 e7-e6
g2-g3 b8-c6
f2-f3 e4-g5
h2-h4 f8-b4 Maybe this is why the program does not see it because this check extends the variation
c2-c3 (1 - 0)


How can I prevent f6-e4 from being played ?
Ne4 is a bad move but the real tactical mistake is 4...Nc6
4...f5 or 4...f6 prepare Nf7 and save the knight.

searching to depth 7 or 8 should be clearly enough to avoid Nc6
and if your program cannot get this depth in less than 0.5 second then something is clearly wrong with your search.