Expected CCRL ELO strength of a barebones chess engine?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

JohnWoe
Posts: 491
Joined: Sat Mar 02, 2013 11:31 pm

Re: Expected CCRL ELO strength of a barebones chess engine?

Post by JohnWoe »

It is a good question. To actually implement a magic bitboarder from scratch is not a small feat. There is tons of low level stuff you need figure out. I think learning bit manipulation stuff is the most valuable lesson.

When it comes to my engine. I try to keep it super simple.
Sapeli was built as a move generator and chess engine stuff was added later on.
- Bitboard board representation
- Magic bitboards for move generation
- Pseudo-legal move generator
- Make/Unmake paradigm
- Alpha/Beta in its simplest form
- Evaluation: material count and PSQT
- Detect mate, threefold draw, 50 move draw
- Basic time management
- And obviously a (minimal) UCI interface to enable it to play.
From this list Sapeli has them all.
Except:
- Sapeli only generates legal moves. It is simpler.
- Sapeli doesn't use Make/Unmake. Sapeli doesn't have make/unmake code. It uses a pointer to board. Much simpler.
- UCI is well supported but no "ponder". As it uglifies the code.
- Sapeli also has minimalist support for game playing stuff. No need for GUIs for some UNIX users.

That results 1940 ELO on CCRL Blitz list. Of course v1.64.
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Expected CCRL ELO strength of a barebones chess engine?

Post by mvanthoor »

JohnWoe wrote: Tue Mar 10, 2020 2:00 pm It is a good question. To actually implement a magic bitboarder from scratch is not a small feat. There is tons of low level stuff you need figure out. I think learning bit manipulation stuff is the most valuable lesson.

When it comes to my engine. I try to keep it super simple.
Sapeli was built as a move generator and chess engine stuff was added later on.
- Bitboard board representation
- Magic bitboards for move generation
- Pseudo-legal move generator
- Make/Unmake paradigm
- Alpha/Beta in its simplest form
- Evaluation: material count and PSQT
- Detect mate, threefold draw, 50 move draw
- Basic time management
- And obviously a (minimal) UCI interface to enable it to play.
From this list Sapeli has them all.
Except:
- Sapeli only generates legal moves. It is simpler.
- Sapeli doesn't use Make/Unmake. Sapeli doesn't have make/unmake code. It uses a pointer to board. Much simpler.
- UCI is well supported but no "ponder". As it uglifies the code.
- Sapeli also has minimalist support for game playing stuff. No need for GUIs for some UNIX users.

That results 1940 ELO on CCRL Blitz list. Of course v1.64.
Thanks for your input :) The one thing I'm curious about is that you're saying Sapeli doesn't have make/unmake code, but a pointer to a board. You'll have to make a move somehow, and then run the search for the other side, making those moves, and so on? Then, to be able to run the next search, you'll have to unmake the moves. The only way I can think of right now how to avoid unmaking moves, is to copy the board and throw it away if you're done generating moves with it. That might actually be faster than unmaking, if your board representation is very small.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
JohnWoe
Posts: 491
Joined: Sat Mar 02, 2013 11:31 pm

Re: Expected CCRL ELO strength of a barebones chess engine?

Post by JohnWoe »

mvanthoor wrote: Tue Mar 10, 2020 7:16 pm Thanks for your input :) The one thing I'm curious about is that you're saying Sapeli doesn't have make/unmake code, but a pointer to a board. You'll have to make a move somehow, and then run the search for the other side, making those moves, and so on? Then, to be able to run the next search, you'll have to unmake the moves. The only way I can think of right now how to avoid unmaking moves, is to copy the board and throw it away if you're done generating moves with it. That might actually be faster than unmaking, if your board representation is very small.
Yes I make moves in Sapeli :D

This is "make()" in Sapeli:
https://github.com/SamuraiDangyo/Sapeli ... li.c#L3021

In perft function:

Code: Select all

for (i = 0; i < len; i++) {
    BRD    = moves + i;
    nodes += Perft_b(depth - 1);
  }
BRD is a pointer to a whole board. That board contains all(bitboards, board as chars). Also move to, move from and move type keys. So I can actually print moves to UCI / user.

"unmake()" is like this: https://github.com/SamuraiDangyo/Sapeli ... li.c#L2998

Code: Select all

BRD = board;
A simple pointer to a stored board.

My board presentation isn't actually small, it's 184 bytes. But somehow Sapeli is searching really damn fast. So I have seen no reason for other solutions. I could squeeze my board smaller but that would hurt readability.

I'm not saying my method is the best. When I benchmarked Xiphos/Stockfish/Crafty their move generators were generating 100M NPS compared to Sapeli's 25M NPS on my machine. So those engines are 4x+ faster already generating moves.

I forgot to mention Sapeli has code for both black and white. White calls black and vice versa. That alone screams to keep Sapeli as simple as possible.
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Expected CCRL ELO strength of a barebones chess engine?

Post by mvanthoor »

Code: Select all

BRD = board;
So you actually do store the entire board in "board" before the search, and then just copy that pointer over to BRD to unmake the move? That would be the copy/make paradigm. If it's faster or slower than make/unmake depends on your board representation (size, type of used constructs, etc...)

I've finished my move generation, and I'm now (slowly) writing and testing the make/unmake function. (I'm tempted to try copy/make as not having to write an unmake function; maybe at some point I'll try both and compare if one is faster than the other.) I can't wait to actually get my engine playing. Just praying I don't encounter any weirdness in Perft... up to now, all of my manual tests and sample testing have checked out OK.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
JohnWoe
Posts: 491
Joined: Sat Mar 02, 2013 11:31 pm

Re: Expected CCRL ELO strength of a barebones chess engine?

Post by JohnWoe »

mvanthoor wrote: Tue Mar 10, 2020 9:36 pm

Code: Select all

BRD = board;
So you actually do store the entire board in "board" before the search, and then just copy that pointer over to BRD to unmake the move? That would be the copy/make paradigm. If it's faster or slower than make/unmake depends on your board representation (size, type of used constructs, etc...)

I've finished my move generation, and I'm now (slowly) writing and testing the make/unmake function. (I'm tempted to try copy/make as not having to write an unmake function; maybe at some point I'll try both and compare if one is faster than the other.) I can't wait to actually get my engine playing. Just praying I don't encounter any weirdness in Perft... up to now, all of my manual tests and sample testing have checked out OK.
Sorry it was my mistake I wanted to edit but was too late.

That board is a pointer copy of BRD pointer.

Code: Select all

BOARD_T *board  = BRD;
I just copy this pointer back where it was in Think() function. For example If user makes 2 searches in a row. Like go command in UCI multiple times.

Code: Select all

BRD = board;
I copy BRD pointer just 3 times. Think(), Perft() and Sort_root() (as I need to call Eval()).
Otherwise I don't copy/make()/unmake() anything. Board is copied in move generator(and move applied) and after that referenced by BRD.

To debug a move generator it is actually a good idea to make it play fast games against other engines.
For example I don't test against Stockfish for strength. But to see there's no illegal moves/crashes in Chess960 games.
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Expected CCRL ELO strength of a barebones chess engine?

Post by mvanthoor »

I have been testing each function in the move generator separately and exhaustively, and completely where possible, such as generating the Rook and Bishop masks and the function that calculates the attack rays. The magic numbers exactly fill up the attack table as expected, for both the bishop and rook. (I just generated the magics below; and a set of magics from this function is also in the move generator.)

Code: Select all

Finding magics for: Rook
Magic found for a1:      1765429195875287075u64 (offset:      0 end:   4095, attempts: 44583)
Magic found for b1:      4629700485658443842u64 (offset:   4096 end:   6143, attempts: 9058)
Magic found for c1:       324276771952263808u64 (offset:   6144 end:   8191, attempts: 401910)
Magic found for d1:       360292506480462080u64 (offset:   8192 end:  10239, attempts: 41367)
Magic found for e1:      1873532733544730628u64 (offset:  10240 end:  12287, attempts: 32483)
Magic found for f1:      2449975798065809449u64 (offset:  12288 end:  14335, attempts: 13398)
Magic found for g1:        36029346791555584u64 (offset:  14336 end:  16383, attempts: 58969)
Magic found for h1:       324259448728062208u64 (offset:  16384 end:  20479, attempts: 154876)
Magic found for a2:        38421341673620353u64 (offset:  20480 end:  22527, attempts: 2494)
Magic found for b2:      1459518260432080896u64 (offset:  22528 end:  23551, attempts: 17604)
Magic found for c2:      4611826893363228674u64 (offset:  23552 end:  24575, attempts: 13361)
Magic found for d2:       144396821967933440u64 (offset:  24576 end:  25599, attempts: 70111)
Magic found for e2:        18577486306873856u64 (offset:  25600 end:  26623, attempts: 20574)
Magic found for f2:      9800677386088415250u64 (offset:  26624 end:  27647, attempts: 35975)
Magic found for g2:          563141113022465u64 (offset:  27648 end:  28671, attempts: 9413)
Magic found for h2:       144678211111125058u64 (offset:  28672 end:  30719, attempts: 32484)
Magic found for a3:     10412323163651784709u64 (offset:  30720 end:  32767, attempts: 13023)
Magic found for b3:     10687044390188236800u64 (offset:  32768 end:  33791, attempts: 42233)
Magic found for c3:          427160804265988u64 (offset:  33792 end:  34815, attempts: 16939)
Magic found for d3:      1152957788625831169u64 (offset:  34816 end:  35839, attempts: 28583)
Magic found for e3:      9241527722742645760u64 (offset:  35840 end:  36863, attempts: 22926)
Magic found for f3:      9511743701357954048u64 (offset:  36864 end:  37887, attempts: 1850)
Magic found for g3:            4398080657424u64 (offset:  37888 end:  38911, attempts: 1802)
Magic found for h3:        72094977458765908u64 (offset:  38912 end:  40959, attempts: 5811)
Magic found for a4:      2308165192803975217u64 (offset:  40960 end:  43007, attempts: 1970)
Magic found for b4:      4611721203874267200u64 (offset:  43008 end:  44031, attempts: 1549)
Magic found for c4:           35186520621704u64 (offset:  44032 end:  45055, attempts: 2931)
Magic found for d4:      2319357798121478400u64 (offset:  45056 end:  46079, attempts: 64492)
Magic found for e4:      1441195865518936320u64 (offset:  46080 end:  47103, attempts: 90358)
Magic found for f4:       581527310475200516u64 (offset:  47104 end:  48127, attempts: 216686)
Magic found for g4:        18015515203211336u64 (offset:  48128 end:  49151, attempts: 25527)
Magic found for h4:      1158342792716550724u64 (offset:  49152 end:  51199, attempts: 8570)
Magic found for a5:        85709405311467554u64 (offset:  51200 end:  53247, attempts: 44436)
Magic found for b5:       144150375681757184u64 (offset:  53248 end:  54271, attempts: 5527)
Magic found for c5:      9226893910112997376u64 (offset:  54272 end:  55295, attempts: 7963)
Magic found for d5:      6342475798548582400u64 (offset:  55296 end:  56319, attempts: 61720)
Magic found for e5:      2666271734079965184u64 (offset:  56320 end:  57343, attempts: 13740)
Magic found for f5:        36310418175562752u64 (offset:  57344 end:  58367, attempts: 39926)
Magic found for g5:         2269396361843208u64 (offset:  58368 end:  59391, attempts: 1778)
Magic found for h5:      1189517650733039753u64 (offset:  59392 end:  61439, attempts: 16685)
Magic found for a6:         4855481475563524u64 (offset:  61440 end:  63487, attempts: 3185)
Magic found for b6:        40532689240997896u64 (offset:  63488 end:  64511, attempts: 3025)
Magic found for c6:         2394736595959874u64 (offset:  64512 end:  65535, attempts: 53828)
Magic found for d6:       648589032915337232u64 (offset:  65536 end:  66559, attempts: 15453)
Magic found for e6:       587719889884808192u64 (offset:  66560 end:  67583, attempts: 167696)
Magic found for f6:        18084819599098144u64 (offset:  67584 end:  68607, attempts: 35455)
Magic found for g6:        54255436205129744u64 (offset:  68608 end:  69631, attempts: 14237)
Magic found for h6:       577041571938172929u64 (offset:  69632 end:  71679, attempts: 29589)
Magic found for a7:      2324561096238719104u64 (offset:  71680 end:  73727, attempts: 49)
Magic found for b7:       144401885741195520u64 (offset:  73728 end:  74751, attempts: 2364)
Magic found for c7:      9223521639157727360u64 (offset:  74752 end:  75775, attempts: 5038)
Magic found for d7:       218444374211043840u64 (offset:  75776 end:  76799, attempts: 17502)
Magic found for e7:         6755828942110784u64 (offset:  76800 end:  77823, attempts: 42543)
Magic found for f7:         9326058901897344u64 (offset:  77824 end:  78847, attempts: 33457)
Magic found for g7:       144678155227496960u64 (offset:  78848 end:  79871, attempts: 21078)
Magic found for h7:      1157742364895365632u64 (offset:  79872 end:  81919, attempts: 10362)
Magic found for a8:      1153625197419497617u64 (offset:  81920 end:  86015, attempts: 3306)
Magic found for b8:       144819992479940613u64 (offset:  86016 end:  88063, attempts: 24579)
Magic found for c8:      4656722161552083139u64 (offset:  88064 end:  90111, attempts: 32958)
Magic found for d8:      9225800377013112065u64 (offset:  90112 end:  92159, attempts: 31753)
Magic found for e8:       288511885491700753u64 (offset:  92160 end:  94207, attempts: 164646)
Magic found for f8:      2360167714145698305u64 (offset:  94208 end:  96255, attempts: 45697)
Magic found for g8:            8805488337028u64 (offset:  96256 end:  98303, attempts: 14994)
Magic found for h8:        76562997635678274u64 (offset:  98304 end: 102399, attempts: 706)

Finding magics for: Bishop
Magic found for a1:      2469876962890940928u64 (offset:      0 end:     63, attempts: 4590)
Magic found for b1:      9242521165728088067u64 (offset:     64 end:     95, attempts: 1189)
Magic found for c1:         1127008042226690u64 (offset:     96 end:    127, attempts: 1144)
Magic found for d1:      6990734513970156545u64 (offset:    128 end:    159, attempts: 228)
Magic found for e1:        14936040829616392u64 (offset:    160 end:    191, attempts: 129)
Magic found for f1:         1691117804322916u64 (offset:    192 end:    223, attempts: 56)
Magic found for g1:       289358509513244672u64 (offset:    224 end:    255, attempts: 1552)
Magic found for h1:          741072516941825u64 (offset:    256 end:    319, attempts: 4528)
Magic found for a2:      1153207412258508930u64 (offset:    320 end:    351, attempts: 379)
Magic found for b2:       288234843194722560u64 (offset:    352 end:    383, attempts: 464)
Magic found for c2:      4774176288782952453u64 (offset:    384 end:    415, attempts: 150)
Magic found for d2:      9225642580048347142u64 (offset:    416 end:    447, attempts: 160)
Magic found for e2:        36187711355748384u64 (offset:    448 end:    479, attempts: 1885)
Magic found for f2:     14411521286054414336u64 (offset:    480 end:    511, attempts: 830)
Magic found for g2:       577804361067413544u64 (offset:    512 end:    543, attempts: 633)
Magic found for h2:      4620704765037355008u64 (offset:    544 end:    575, attempts: 1874)
Magic found for a3:      4674747717701142528u64 (offset:    576 end:    607, attempts: 204)
Magic found for b3:      9393383028283179522u64 (offset:    608 end:    639, attempts: 1130)
Magic found for c3:         2251868535332898u64 (offset:    640 end:    767, attempts: 534)
Magic found for d3:         2254016051962305u64 (offset:    768 end:    895, attempts: 2728)
Magic found for e3:       577586680154821761u64 (offset:    896 end:   1023, attempts: 19928)
Magic found for f3:         9288682838493448u64 (offset:   1024 end:   1151, attempts: 11023)
Magic found for g3:          294671398539332u64 (offset:   1152 end:   1183, attempts: 2585)
Magic found for h3:         2392545925562889u64 (offset:   1184 end:   1215, attempts: 808)
Magic found for a4:      1153572759666954242u64 (offset:   1216 end:   1247, attempts: 64)
Magic found for b4:      1802020397954114048u64 (offset:   1248 end:   1279, attempts: 831)
Magic found for c4:     11531818964950974592u64 (offset:   1280 end:   1407, attempts: 2098)
Magic found for d4:       298367880058114176u64 (offset:   1408 end:   1919, attempts: 205)
Magic found for e4:      2598859559498956808u64 (offset:   1920 end:   2431, attempts: 58619)
Magic found for f4:      9243642770697093424u64 (offset:   2432 end:   2559, attempts: 26995)
Magic found for g4:       144256475339165704u64 (offset:   2560 end:   2591, attempts: 1829)
Magic found for h4:      4611863065603016328u64 (offset:   2592 end:   2623, attempts: 2848)
Magic found for a5:         2254273732674612u64 (offset:   2624 end:   2655, attempts: 4174)
Magic found for b5:       433524259755787264u64 (offset:   2656 end:   2687, attempts: 2704)
Magic found for c5:           70540577472576u64 (offset:   2688 end:   2815, attempts: 4436)
Magic found for d5:       292736177017454720u64 (offset:   2816 end:   3327, attempts: 19404)
Magic found for e5:        73187909175611648u64 (offset:   3328 end:   3839, attempts: 40056)
Magic found for f5:         1134696545517696u64 (offset:   3840 end:   3967, attempts: 3196)
Magic found for g5:         4521743717958657u64 (offset:   3968 end:   3999, attempts: 670)
Magic found for h5:         1127000496537792u64 (offset:   4000 end:   4031, attempts: 747)
Magic found for a6:      2342154519502135842u64 (offset:   4032 end:   4063, attempts: 1100)
Magic found for b6:     13907397700359360529u64 (offset:   4064 end:   4095, attempts: 582)
Magic found for c6:       433208148547862784u64 (offset:   4096 end:   4223, attempts: 16141)
Magic found for d6:      4616773742205347848u64 (offset:   4224 end:   4351, attempts: 21739)
Magic found for e6:      6382876175009586176u64 (offset:   4352 end:   4479, attempts: 185)
Magic found for f6:      9585946998008709248u64 (offset:   4480 end:   4607, attempts: 3429)
Magic found for g6:         9009406901485634u64 (offset:   4608 end:   4639, attempts: 1990)
Magic found for h6:        36311410480775680u64 (offset:   4640 end:   4671, attempts: 745)
Magic found for a7:           71487048454144u64 (offset:   4672 end:   4703, attempts: 1254)
Magic found for b7:         4646570534510627u64 (offset:   4704 end:   4735, attempts: 1476)
Magic found for c7:         2569595316871188u64 (offset:   4736 end:   4767, attempts: 224)
Magic found for d7:      3172786626894234112u64 (offset:   4768 end:   4799, attempts: 57)
Magic found for e7:      2384657170957468164u64 (offset:   4800 end:   4831, attempts: 208)
Magic found for f7:      5766885720388665600u64 (offset:   4832 end:   4863, attempts: 98)
Magic found for g7:         1763651312945153u64 (offset:   4864 end:   4895, attempts: 418)
Magic found for h7:        81074147740114944u64 (offset:   4896 end:   4927, attempts: 955)
Magic found for a8:       324294924748001419u64 (offset:   4928 end:   4991, attempts: 13484)
Magic found for b8:      9227881151304108032u64 (offset:   4992 end:   5023, attempts: 2624)
Magic found for c8:      9799835580987671552u64 (offset:   5024 end:   5055, attempts: 101)
Magic found for d8:     11817594955811263492u64 (offset:   5056 end:   5087, attempts: 279)
Magic found for e8:       148627996384559616u64 (offset:   5088 end:   5119, attempts: 17)
Magic found for f8:      5260204675625665568u64 (offset:   5120 end:   5151, attempts: 119)
Magic found for g8:      1225560877869072512u64 (offset:   5152 end:   5183, attempts: 400)
Magic found for h8:      2415218374045991553u64 (offset:   5184 end:   5247, attempts: 19545)
Each table is exactly full from 0-102399 (102.400 permuations) and 0-5247 (5248 permutations) for the rook and bishop respectively (Stockfish comes up with the same numbers), and my sampled tests on random board setups (around 50) all check out. All of the attack masks for the king, knight and pawns have been checked by hand and they're all OK.

To be honest, I don't expect the move generator to have bugs. If anything goes wrong, I expect the problem to be in the make/unmake functions, or one of the functions they depend on, where I might forget to (re)set something. I'm now writing and testing those. Slowly.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: Expected CCRL ELO strength of a barebones chess engine?

Post by abulmo2 »

mvanthoor wrote: Mon Mar 02, 2020 11:58 am If I'd test such a barebones engine, what CCRL-rating could be expected? 800 ELO? 1000? Or maybe just slightly better than a random mover?
I do have developed a barebone engine called Dumb in less than 1200 line of codes. However it has more features like qsearch, transposition table, move ordering with killer moves, null move pruning, aspiration window, negascout. But no SEE, nor LMR. It is bitboard based but do not use magic bitboard but the slightly slower hyperbola quintessence approach. Dumb 1.4 is rated about 2360 on CCRL BLITZ.

I removed about 100 line of codes to meet your barebone engine description: no qsearch, no transposition table, no move ordering, no pruning, simple alpha beta. A simple test against tscp181 with 100 games at 1min+1s, shows this dismantled Dumb program about 100 elo weaker than tscp although it is about 8 time faster. So I guess it is about 1400-1450 elo on CCRL BLITZ scale.
Richard Delorme
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Expected CCRL ELO strength of a barebones chess engine?

Post by mvanthoor »

abulmo2 wrote: Wed Mar 11, 2020 8:27 pm
mvanthoor wrote: Mon Mar 02, 2020 11:58 am If I'd test such a barebones engine, what CCRL-rating could be expected? 800 ELO? 1000? Or maybe just slightly better than a random mover?
I do have developed a barebone engine called Dumb in less than 1200 line of codes. However it has more features like qsearch, transposition table, move ordering with killer moves, null move pruning, aspiration window, negascout. But no SEE, nor LMR. It is bitboard based but do not use magic bitboard but the slightly slower hyperbola quintessence approach. Dumb 1.4 is rated about 2360 on CCRL BLITZ.

I removed about 100 line of codes to meet your barebone engine description: no qsearch, no transposition table, no move ordering, no pruning, simple alpha beta. A simple test against tscp181 with 100 games at 1min+1s, shows this dismantled Dumb program about 100 elo weaker than tscp although it is about 8 time faster. So I guess it is about 1400-1450 elo on CCRL BLITZ scale.
Thanks for this input :)

CCRL Blitz has TSCP listed at 1725 ELO:
https://ccrl.chessdom.com/ccrl/404/cgi/ ... #TSCP_1_81 Why do you guess the rating to be 1400-1450 instead of 1650, if you tested against TSCP at 100 ELO weaker? Even so, a 1500-ish rating is what I'd have expected, so if I can achieve that with an engine that basically does nothing but generate moves and alpha/beta search, I'm happy. Then I have a good base to start adding features to.

1200 lines for your engine is very short. It seems to be written in D (I assume, because of the .d file extension, and the similarity to C regarding syntax). I'm up to 1250 lines now, but this includes around 250 lines of "extra" code, such as printing various (bit)boards, structs, the movelist, and the entire function to find magics. Those lines won't be in the final engine. So, at around 1000 lines, I'm finally done with the move generator.

There are a few things that make my code longer, though.
- I const / define / type basically _everything_ and don't use "magic numbers" (numbers that just appear throughout the code) or complicated-looking types.
- My lines are very short; often things such as:

Code: Select all

let x = get_stuff_a() + get_stuff_b() + 1;
let y = x * SOME_CONSTANT - 5;
- I have Rust Format set at full auto format for the official Rust styling. So, sometimes the formatter thinks that things such as this:

Code: Select all

let x = if this_stuff == CONSTANT_X { a } else { b }
should be formatted like this:

Code: Select all

let x = if this_stuff == CONSTANT_X
{
  a
} else {
  b
}
because the one-liner is longer than a certain number of characters. (It would have been even worse if I hadn't put rustfmt-skip directives above things such as the square name table or the magic number table; it would have formatted those with each number on its own line.)
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
abulmo2
Posts: 433
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: Expected CCRL ELO strength of a barebones chess engine?

Post by abulmo2 »

mvanthoor wrote: Wed Mar 11, 2020 10:49 pm
abulmo2 wrote: Wed Mar 11, 2020 8:27 pm
mvanthoor wrote: Mon Mar 02, 2020 11:58 am If I'd test such a barebones engine, what CCRL-rating could be expected? 800 ELO? 1000? Or maybe just slightly better than a random mover?
I do have developed a barebone engine called Dumb in less than 1200 line of codes. However it has more features like qsearch, transposition table, move ordering with killer moves, null move pruning, aspiration window, negascout. But no SEE, nor LMR. It is bitboard based but do not use magic bitboard but the slightly slower hyperbola quintessence approach. Dumb 1.4 is rated about 2360 on CCRL BLITZ.

I removed about 100 line of codes to meet your barebone engine description: no qsearch, no transposition table, no move ordering, no pruning, simple alpha beta. A simple test against tscp181 with 100 games at 1min+1s, shows this dismantled Dumb program about 100 elo weaker than tscp although it is about 8 time faster. So I guess it is about 1400-1450 elo on CCRL BLITZ scale.
Thanks for this input :)

CCRL Blitz has TSCP listed at 1725 ELO:
https://ccrl.chessdom.com/ccrl/404/cgi/ ... #TSCP_1_81 Why do you guess the rating to be 1400-1450 instead of 1650, if you tested against TSCP at 100 ELO weaker?
Yes, you are right. I briefly read the cegt rating list of tscp and confused the two ratings. So a stripped Dumb should be around 1600-1650 (1725 - 100 +/- 25) on CCRL.
Even so, a 1500-ish rating is what I'd have expected, so if I can achieve that with an engine that basically does nothing but generate moves and alpha/beta search, I'm happy. Then I have a good base to start adding features to.

1200 lines for your engine is very short. It seems to be written in D (I assume, because of the .d file extension, and the similarity to C regarding syntax). I'm up to 1250 lines now, but this includes around 250 lines of "extra" code, such as printing various (bit)boards, structs, the movelist, and the entire function to find magics. Those lines won't be in the final engine. So, at around 1000 lines, I'm finally done with the move generator.
Dumb is a toy program written in D. I probably abused and too often wrote several statements on the same line. But I still think the result is quite clear, easy to read and to understand. Sometime I prefer to code like this:

Code: Select all

	if      (score <= λ && λ > α) { υ = (λ + υ) / 2; λ = score - δ; }
	else if (score >= υ && υ < β) {	λ = (λ + υ) / 2; υ = score + δ; }
than

Code: Select all

	if (score <= λ && λ > α) {
		 υ = (λ + υ) / 2; 
		 λ = score - δ; 
	} else if (score >= υ && υ < β) {
		λ = (λ + υ) / 2; 
		υ = score + δ;
	}
as I feel it easier to spot the similarities/differences of the two expressions when they are parallel on their own single line.
There are a few things that make my code longer, though.
- I const / define / type basically _everything_ and don't use "magic numbers" (numbers that just appear throughout the code) or complicated-looking types.
- My lines are very short; often things such as:

Code: Select all

let x = get_stuff_a() + get_stuff_b() + 1;
let y = x * SOME_CONSTANT - 5;
- I have Rust Format set at full auto format for the official Rust styling. So, sometimes the formatter thinks that things such as this:

Code: Select all

let x = if this_stuff == CONSTANT_X { a } else { b }
should be formatted like this:

Code: Select all

let x = if this_stuff == CONSTANT_X
{
  a
} else {
  b
}
because the one-liner is longer than a certain number of characters. (It would have been even worse if I hadn't put rustfmt-skip directives above things such as the square name table or the magic number table; it would have formatted those with each number on its own line.)
Richard Delorme