Tilbage til Skak


Dabbaba ver. 0.098 by Jens B‘k Nielsen

Improvements from ver. 0.096 to ver. 0.098:
Selfplay: a) shows the board the first 56 halfmoves
b) does not loop above the 160 halfmoves
The internal solution to position H is corrected.
The game now always ends nice with 'Oh, the game is over...'
The matesearch is now working when playing games.
It now (again) chooses one of the moves with the shortest way to a mate.
(I had tried to jump out of the search when a mating move was found, but
it has to be one of the shortest ways to prevent the program from playing
mating moves 'forever')

The most special about this chessprogram is that it can play chess with
other sets of rules. But more about this later.

Dabbaba is written in C. It consists of approximately 3.000 lines of code.
It is not very strong. With 3 minutes/move it should be lucky to beat half
of the members in a usual chessclub (average rating 1.500). With less time
it should beat more of them (supposed the humans also plays faster. Both
the computer and the humans play worse with less time, but the human
playing strenght declines faster.)

Dabbaba searches ca. 2.500 positions pr. second on my 50Mhz 486dx with 256K
cache (coprocessors and amount of ram don't influence the programs speed).
All subsequent figures also refers to this PC-model.

Tactics is Dabbabas favourite disciplin. With 2 minutes/move it solves 70
out of the 100 combinations found in Bent Larsen's book 'Find the
combination'. Even though my rating is 2037 I doubt I could do it better.

So far Dabbaba only knows very little. It knows of mate, stalemate and the
value of the pieces (pawn=90, knight=305, bishop=320, rook=475 and
Besides this it tries to get pieces near the centre and tries to achieve
positions with good mobility - that is positions where Dabbaba can make
relative more moves than its opponent (remember, the values of the men is
based on how the particular man moves).
Finally Dabbaba have about 20 opening tips to get the pieces developed a
little better. The opening is defined as a position where one of the
players still have the right to castle (for chessvariants without castling
the opening is defined as a position where black has more than 9 men on the
7.th and 8.th rank).

Dabbaba knows so far nothing about king safety, weak pawns, isolated pawns,
double pawns, passed pawns, bad/good bishops, bad/good knights, rooks on
open or halfopen files and on the 7.th rank, trapped pieces, insufficient
materiel, draw by repetition a position 3 times (the most usual outcome of
a selfplay-game, where Dabbaba plays against itself).
Strategy and planning is of course also completely unknown for Dabbaba.
So still a lot can be done to improve Dabbaba.

But tactics is the most important for a chessprogram, and this can be
improved by increasing the speed. Some of the code can still be improved,
and the use of hash-tables can also increase the speed. Hashtables is a way
of storing information during the search, and when the program encounters
the same position later (evt. by transposition of moves) in the search, it
doesn't have to search the whole subtree from that position again.

Dabbaba uses internally an 8x12 chessboard, and it uses an iterative search
(it makes more searches from the position and goes deeper in each search
using information from the previous searches. I won't explain all
computerchess terms in detail in this text. Read some of the many books and
magazines on this subject.)

********************** 1) in the main menu ************************
The search time/depth is controlled by these figures:
Brute force depth:
the number of halfmoves where all the possible moves are considered. Use
2,3,4,>4 for blitz, quick game, tournament game and long analysis.
Selektiv depth:
the number of halfmoves where only checks, some captures, promotions etc.
are tried for the side on the move after the brute-force search. The other
side tries always all the moves.
I strongly recommend this set to 4.
Check search depth:
Set this to zero. It is not completed yet. Some checks should be tried at
the end of each line...

********************** 2) in the main menu ************************
Computes a move in the current position. See screen-info later.

********************** 3) in the main menu ************************
Play agaist Dabbaba. This is easy and is not needed to be explained.

I will only emphasize the selfplay option, if you want to study Dabbabas
play at deeper levels without having to spend too much of your own time by
the computer.
I have used levels like (3,4,0) or even (4,4,0) and then started a game. After
3-4 hours I return to the PC and make a hardcopy of the screen. This gives
me a paper with a game that represents hours of computing, but only very
little of my own time is used.
NB: the hardcopy may not work if you run Dabbaba under Windows.
The selfplay cannot be interrupted, so think about it before you start
the selfplay.
Ctrl+Break stops Dabbaba at the next move.
At selfplay Dabbaba stops after 160 halfmoves, and it displays the board
the first 56 halfmoves.

********************** 4) in the main menu ************************
Choose a variant of chess. These are explained later.

********************** 5) in the main menu ************************
Just some usefull positions I use developing the program.

********************** 6) in the main menu ************************
Choose english letters(default) or danish letters(=german letters).
Change size of the graphic chessboard.

********************** 7) in the main menu ************************
Chesspositions in files. Mainly for developing the program.
You can study the files and make your own if you like.
You can run the whole file or pick out a single position.
A line with '+++-+-?-+....' indicates positions solved(+) or not(-).
A ? indicates that no answer is marked at the position.
An answer marked with a '?' is solved by not playing this move.

The rest of the options are mainly my internal figures to be adjusted.
But you can experiment if you like.

********************** 8) in the main menu ************************
top-kill: This is a name I have used for the moves that are the best answer
to each possible move in the current position. The programs speed depends
heavily on trying good moves first, so the opponents bad moves can be
refused immediately and the search can go on. This should always be turned

'selektiv search dynamic limit': if the first moves are captures, checks,
promotion etc., the program accumulates some points. If this sum is bigger
than this limit, ALL moves on the first move of the selektive search are
If this limit is lowered, it happens more often and the program searches
more moves and takes longer time to calculate a move.
With a value of 8 it will find the mate in 5 in the built-in position
(1.b7+) sooner.
A big value turns this off.

initiativ change: if set to 1 the program 'turns' the selektive search if
the 'defender' happens to give a check during the selektive search. The
defendes becomes attacker from that position.

********************** 9) in the main menu ************************
iterativ search: if turned on the program goes deeper and deeper into the
position. Because of better move ordering this is at least as fast as doing
one whole search. With hashtables the iterative search will be the fastest.

simple kill: is turned on with 10 - the value doesn't matter very much.
Simple killers is used deeper in the search of the tree, where the top-
killers are not working. Simple killers is simply moves, that earlier in
the search has proved to be good, and they are tried a little earlier than
other moves to refuse the opponents move.
Two killers are used at each depth in the search.

always cut-off: this concerns top-killers. If a top-killer is found that
refuses one of the moves in the current position, you can go on to the next
move. This happens with 1. If the value is 0, all the moves are tried, and
this means you may find a better top-killer. This may be useful in the
iterative search, so the program better can refuse moves later in the
A value of 2=auto means, that the program uses 0 if an iterative search to
depth 4 or deeper is in progress; otherwise it is set to 1.
It seems this idea is usefull. I've never read about it anywhere.

********************** A) in the main menu ************************
trace: allows you to see all the lines to a certain depth. Use small values
like 1 and 2 the first time you try this option.
The -30000 option will probably soon be changed, so I won't explain it now.

screen-info: is turned on with 1.
If screen-info is turned on, a lot of internal information is shown:
How deep the current search is, what move is investigated now, what
replymove is investigated now (is just shown as a '*' from move 4), what
score the move got (positive values are good for white).
Use the Break-key if the information scrolls too fast.
The number of nodes pr. second is also shown. Turn screen-info off to give
Dabbaba the fastest performance.
Screen-info is automatically turned off during game play.

mate search:
Before the regular search is done, a mate search is done. This is default
set to 12 halfmoves to find mates in up to 6 moves (all the moves must be
checks; though Dabbaba don't recognises discovered checks outside the brute
force search).
The program has a built-in position, where this matesearch takes two
minutes, and this won't give you a blitzgame! Very bad.
Because of this problem I have turned the matesearh of when playing a game
with Dabbaba. The value is not reset after the game.
Later I must let Dabbaba itself cancel this search if it takes too much
Position 2 in the Colditz-test (see later) - a queen-sacrifice giving mate
in 5 moves - is solved in 1/100 second because of the mate search! Very

full evaluation: For developing purposes. Full evaluation of positions or
only material (incl. mate and stalemate) is considered.

********************** B) in the main menu ************************
A set-up I use while developing the program.

********************** C) in the main menu ************************
Weights for mobility, centralisation and opening tips.

The Colditz-test
The Colditz-test with its 30 positions was very popular 5-10 years ago to
test chesscomputers. It is from a book (for humans...) by Colditz. It is
about combinations in chess, and it concludes with the test where the
reader can test himself and estimate his tactical rating.
I gave Dabbaba short time (3,4,0) on the test, and after 3 minutes -
average 6 seconds pr. position - it had solved 15 out of 30!
With 25 minutes for the test Dabbaba solved 24/30 (4,4,0).
Given 2-5 minutes pr. position it also solved nr. 12, 20, 25 and 29.
Two positions remains:
Pos. 16 is very hard and is not solved.
Pos. 27 is not solved because black can extend the horizon with 3-4 checks
with his rooks. If I move pawn h2 to g2 the position is solved in a few

The variants of chess in Dabbaba

In a variant is en passant and castle allowed unless otherwise stated.
Similar is the goal to mate the king.
If a man has got a changed movement as fx the nightrider, the change is
complete: There is no usual knight, and a promotion to knight will be to a
In variants where the king can be captured, promotion to king is allowed.

1) Stationary Chess
The king cannot move. No castle.

2) Knightmate Chess
The knights are replaced with kings, and the king is replaced with a
The goal is to mate the knight. No castle.

3) Chancellor Chess
The queen moves as a rook and a knight.

4) Archbishop Chess (Janus Chess)
The queen moves as a bishop and a knight.

5) Nightrider Chess
The knight can make long moves like bishops and rooks.
Ng1 in the startposition can besides f3 and h3 move to e5 and d7.

6) Rooksquare Chess
You also win if you get a man moved to one of the opponents corners (white
moves a man to a8/h8). This variant is not implemented yet.

Dabbaba started in spring 1995 as NO-CHESS (Nielsen-Osted chess).
Soon I made a version called BRUTALIS. It solves helpmates.
Autumn 1995 Dabbaba got simple graphics, and SHOWTIME and SKAKBRAT were
preparations for this.
Dabbaba and NO-chess (with focus on ordinary chess) will be continued.

Stop the program
CTRL+BREAK will cancel the program at the next display to the screen.
If you are computing a move in a testposition and has turned screen-info
on, you have wait for the move or to reset your computer to stop it.

Known error
at the end of a game (mate/stalemate) Dabbaba will claim stalemate in a

Future work with Dabbaba
Make a simple evaluation of king safety (number of pawns covering the
Remove the end-of-the-game-error.
Make Dabbaba play a little random in the opening.
Finish the checksearch and find out what to do with the matesearch.
*** this is the goal with Dabbaba ver. 0.100 ***
Optimize the code to improve the speed.
Make use of hashtables.
Remove more bad moves.
Make a better search of lines.
Make a better positional evaluation.
Incorporate more variants of chess.
Better graphics (Dabbaba is still mainly based on textmode).
Make use of the mouse.
Implement permanent brain (calculate moves while the opponent thinks).
Make an opening library.
Try the null-move trick.
Give Dabbaba endgame knowledge.


If you want to know more about computerchess I can strongly recommend
'Schach am PC' (sep. 1995, 500 pages). It contains a CD-ROM with 50MB data
including a school-example of a chessprogram with binaries and sourche both
in C and Visual Basic (surprisingly only 30% slower than the C-version).
The program is described in the book.
If you want to have a look at the program MiniMAX; first try the version in
BASIC as only this starts with a presentation of the available commands.
A demo-version of ChessBase for Windows includes the endgamedatabase KBB-KN
with 121 million positions compressed in 28MB.

'Grottan' is a computerchess-BBS in G›teborg, Sweden. SysOp is G›ran
Grottling. Phone 31992301.

Variant Chess - 4 issues pr. year.
9 GBP or 13 USD Europa/Rest of world(surface).
Write to editor Peter Wood, 39 Linton Road, Hastings, East Sussex, TN34
1TW, England.

An italian magazine about chess variants. Write to Alessandro Castelli,
62010 Villa Potenza, Macerata, Italy.

In 1994 came the long waited book: The Encyclopędia of Chess Variants (ECV)
by D.B.Pritchard. 1450 variants are explained.
Write to Games & Puzzles, PO Box 20, Godalming, Surrey GU9 4YP, UK.
Price 22 GBP + porto.


Dabbaba is spread to Denmark, England, Italy, Sweden and USA.

If you have any comments you can send me a note.


Jens B‘k Nielsen
Daltoften 15
8600 Silkeborg