Computer Chess Club Archives


Search

Terms

Messages

Subject: Let the king capture or generate legal moves

Author: Michel Langeveld

Date: 05:51:46 11/20/04


I decided to investigate something:

TSCPGothic NORMAL
=================
This program generates moves, and after a move is played, it checks if the own
king is brought into check. If this was the case, then it undoes the move
without searching futher, and continues with another move.

TSCPGothic KINGCAP
==================
This program generates moves, plays them all despite legalness, and let the king
get captured (Crafty makes this too).

I hoped for a faster program with KINGCAP.
I found out that this was not true (Note *2)

I can explain why. . . .

If the TSCPGothic KINGCAP is in check, then it ignores it and generates for
example 35 moves (this costs time).

All this 35 illegal moves are played (this costs time),
all fall into QSearch (time + increased nodecount),
All (Note *2) captures are generated.
Then all moves are scored (time!).
During scoring I see that there is an illegal move, and that the position has to
be undone. I return a high score (INF + ply).

Checking after each move if the own king is not in check cost also a lot of
time.

Both worlds doesn't seem to differ a lot in quiet position......
BUT ....  as soon as a few lines get open, the NORMAL version is much faster:

Opening Position
****************

tscpgothic> getfen
rnbqckabnr/pppppppppp/10/10/10/10/PPPPPPPPPP/RNBQCKABNR/ w KQkq -
tscpgothic> d

8 r n b q c k a b n r
7 p p p p p p p p p p
6 . . . . . . . . . .
5 . . . . . . . . . .
4 . . . . . . . . . .
3 . . . . . . . . . .
2 P P P P P P P P P P
1 R N B Q C K A B N R

  a b c d e f g h i j

TSCP NORMAL:
11*   4278  13774907 11  b1c3 b8c6 d2d4 i8h6 d4d5 c6e5 d1d4 d7d6 c1d2 h6f5 d4e4

TSCPKINGCAP:
11*   4134  14903848 11  b1c3 b8c6 d2d4 i8h6 d4d5 c6e5 d1d4 d7d6 c1d2 h6f5 d4e4

Middlegame position
*******************

tscpgothic> setfen
r3ck1b1r/2pqpppp1p/3pba4/1p1Pnn2p1/4NN4/3CBAP3/1PP1PP1PPP/R2Q1K1B1R w KQkq
-tscpgothic> d

8 r . . . c k . b . r
7 . . p q p p p p . p
6 . . . p b a . . . .
5 . p . P n n . . p .
4 . . . . N N . . . .
3 . . . C B A P . . .
2 . P P . P P . P P P
1 R . . Q . K . B . R

  a b c d e f g h i j

TSCP NORMAL:
9*  3909  13012529  696  e4f6 e7f6 a1a8 f5e3 d3e3 e6h3 f4h3 e8a8 f3e4 e5g6 h1g2

TSCP KINGCAP:
9*  5371  20849002  696  e4f6 e7f6 a1a8 f5e3 d3e3 e6h3 f4h3 e8a8 f3e4 e5g6 h1g2

Position with promotion
=======================

tscpgothic> setfen rnbqckabnB/pppppppp1p/10/10/3P6/2N4N2/PPP1PPPpPP/R2QCKAB1R/ b
 KQq -
tscpgothic> d

8 r n b q c k a b n B
7 p p p p p p p p . p
6 . . . . . . . . . .
5 . . . . . . . . . .
4 . . . P . . . . . .
3 . . N . . . . N . .
2 P P P . P P P p P P
1 R . . Q C K A B . R

rnbqckabnB/pppppppp1p/10/10/3P6/2N4N2/PPP1PPPpPP/R2QCKAB1R/ b KQq -

TSCP NORMAL:
11*   8046  28778176    266  h2g1q f1g1 h7h6 d1d3 i8j6 h3f4 g8i6 j8h6 e8f6 g1f1
f6h6 c3e4

TSCP KINGCAP:
11*  14273  62211042    266  h2g1q f1g1 h7h6 d1d3 i8j6 h3f4 g8i6 j8h6 e8f6 c3e4
f6h6 g1f1

Endgame (KBNK)
=======

tscpgothic> getfen
10/10/1K8/10/10/10/kbn7/10/ b - -
tscpgothic> d

8 . . . . . . . . . .
7 . . . . . . . . . .
6 . K . . . . . . . .
5 . . . . . . . . . .
4 . . . . . . . . . .
3 . . . . . . . . . .
2 k b n . . . . . . .
1 . . . . . . . . . .

  a b c d e f g h i j

TSCP NORMAL:
15*   1457   3666999   -577  a7b6 a2b3 b6c6 b2g7 c6d7 b3c4 d7e6 c2d4 e6f7 d4f5 f
7g8 g7h6 g8h7 c4d5 h7i8 d5d4

TSCP KINGCAP:
15*   3562  12700783   -589  a7b8 a2b3 b8c7 b3c4 c7d7 c4d5 d7e7 c2d4 e7f7 d5d6 f
7f8 b2c3 f8e8 d4e6 e8f7 d6d7 f7g6

Note *1 = (I tried a variation where during move generation we see that an
illegal move is found. Then we stop generating. Als this was not faster).

Note *2 = (for Gothic Chess - have to check normal chess).



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.