New Engine: Cosette

Questions and comments related to CCRL testing study
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

New Engine: Cosette

Post by Pawel Osikowski »

Hi

I want to introduce my new open-source chess engine Cosette, written in C# for .NET platform. Despite it's still in a rather early stage of development (lacks a few important things like better evaluation, futility pruning, extensions, etc.), the engine plays good and is fully usable.

Name: Cosette
Version: 1.0
Protocol: UCI
Author: Pawel Osikowski
Country: Poland
Source code: https://github.com/Tearth/Cosette
Download: https://github.com/Tearth/Cosette/releases/tag/v1.0
Estimated strength: 1900 Elo (based on 500 games played on lichess platform)

A few words about executables: they are quite big because in theory every program written in C# requires .NET runtime - so I've decided to make them self-contained (which means that the mentioned runtime is packed together with the engine), which allows running without any additional actions. They are tested on Windows 7, Windows 10, and Ubuntu, so I hope we won't have any trouble.

The engine will be developed further, but this version is stable and I would be very grateful for accepting.
Last edited by Pawel Osikowski on Sat Mar 06, 2021 3:27 pm, edited 1 time in total.
User avatar
Sergio Martinez
Posts: 3396
Joined: Tue Mar 12, 2013 11:38 pm
Sign-up code: 10159
Location: Murcia, Spain

Re: New Engine: Cosette

Post by Sergio Martinez »

Hi Pawel

Thank you very much for your engine.

A question

Is your engine made from scratch or based on another project?

Best regards
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Hi Sergio,

Cosette is made from scratch (using my experience gained on two weaker engines done in the past, but never published here). Also, there are only a few engines written in C#, mostly old and not updated for years, so it's quite motivating to make something own which can possibly play better in the future (at least I hope so!).

Pawel
User avatar
Sergio Martinez
Posts: 3396
Joined: Tue Mar 12, 2013 11:38 pm
Sign-up code: 10159
Location: Murcia, Spain

Re: New Engine: Cosette

Post by Sergio Martinez »

Fantastic

I have just started a test

Best regards
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Wonderful, thank you.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Hi, after a month of silence, I'm proud to introduce the next version of Cosette chess engine. v2.0 doesn't have any revolutionary changes, it's more like an evolution of existing features + a few new ones.

Version: 2.0
Download: https://github.com/Tearth/Cosette/releases/tag/v2.0
Estimated strength: 1950 Elo (v1.0 one was a bit overestimated)

Changelog:
- Added fifty-move rule detection
- Added new evaluation functions: pawn shield, bishop pair, doubled rooks, a rook on open file
- Added "evaluate" command to get FEN position evaluation
- Added ability to postpone moves generation before PV move check
- Added evaluation hash table
- Added Arbiter app to speed up the process of testing engine
- Added support for UCI's winc and binc
- Fixed PV node detection
- Fixed invalid detection of passing pawns
- Fixed invalid best move when a search has been aborted
- Fixed static exchange evaluation - in rare cases the table was returning an invalid score
- Improved method of probing piece type at the specified field
- Improved time management - now allocated time depends on the moves count
- Improved move ordering: castling and better promotions are now prioritized
- Improved transposition tables: entries are now smaller, have proper checkmate scores (relative to position) and are used between moves (aging)
- Redefined and reduced the size of Move structure (from 4 bytes to 2 bytes)
- Reduced size of transposition table entry (from 16 bytes to 12 bytes), evaluation hash table entry (from 8 bytes to 4 bytes) and pawn hash table entry (from 8 bytes to 4 bytes)
- Optimized printing UCI output
- Adjusted move ordering scores
- Updated .NET Core runtime version to 3.1.403

Feel free to ask if you have any question, I'm frequently checking this forum.
Last edited by Pawel Osikowski on Sat Mar 06, 2021 3:28 pm, edited 1 time in total.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

The new engine version is out - this time, I was focused on adding a few new interesting features like multi-stage move ordering and generating, improved SEE accuracy, internal iterative deepening and more. There is also a separate project (Tuner) to adjust search and evaluation values, which I hope will give a significant increase of strength in the next version (probably February/March 2021).

Version: 3.0
Download: https://github.com/Tearth/Cosette/releases/tag/v3.0
Estimated strength: 2000 Elo

Changelog:
- Added better time control for Arbiter
- Added more UCI options
- Added Tuner project
- Added insufficient material detection
- Added executable hash generator
- Added abort when search lasts too long
- Added legality checking of the hash table moves
- Added SEE pruning in the quiescence search
- Added fianchetto evaluation
- Added internal iterative deepening
- Added a lot of UCI options, allowing for full engine customization
- Added multi-stage move ordering
- Added multi-stage move generating
- Fixed FEN parser when input didn't have halfmove clock and moves count
- Fixed crash when the engine was receiving invalid position in UCI mode
- Fixed UCI statistics
- Improved time scheduler when incrementation time is present
- Improved mobility calculation by rewarding for center control
- Improved late move reduction conditions
- Improved SEE accuracy (now includes x-ray attacks)
- Improved king safety evaluation
- Changed maximal moves count from 128 to 218 (according to Internet sources)
- Reduced size of transposition table entry (from 12 bytes to 8 bytes)
- Disabled most of the evaluation functions when the game is near to end
- Disabled returning of exact transposition table entries in the PV nodes
- Adjusted evaluation scores
- Optimized king safety evaluation
- Updated .NET Core runtime version to 5.0.100

Feel free to ask questions, and thanks for testing all my previous versions of Cosette.
Last edited by Pawel Osikowski on Sat Mar 06, 2021 3:28 pm, edited 1 time in total.
User avatar
Gabor Szots
Posts: 12889
Joined: Sat Dec 09, 2006 6:30 am
Sign-up code: 10159
Location: Szentendre, Hungary

Re: New Engine: Cosette

Post by Gabor Szots »

Test already running. I was surprised by the dll's but no problem.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Thanks! Yeah, I was also a bit surprised when preparing release files, but I suppose this is something new due to the update of .NET version from 3.1 to 5. Some day I will do an investigation to check if this is going to be permanent, but anyway it's not a big issue.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

I see that Cosette just passed the expected 2000 Elo with a good margin, that's wonderful news! Thanks for testing.
Last edited by Pawel Osikowski on Sat Mar 06, 2021 3:29 pm, edited 1 time in total.
User avatar
Gabor Szots
Posts: 12889
Joined: Sat Dec 09, 2006 6:30 am
Sign-up code: 10159
Location: Szentendre, Hungary

Re: New Engine: Cosette

Post by Gabor Szots »

Pawel Osikowski wrote: Sun Dec 20, 2020 10:43 am I see that Cosette just passed the expected 2000 ELO with a good margin, that's wonderful news! Thanks for testing.
I plan some further testing which may modify Cosette's current rating. It played too weak opponents so the next bunch will be chosen from the 2100-2150 range. Not sure when that happens but probably withing a month.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Sure! 2100-2150 range should be perfect for v3.0.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Hello, the next version of Cosette is available! The last two months were filled with a lot of tuning and toying with futility pruning, which gave quite a good Elo increase. Still a lot of work to reach my 2500 Elo goal, but seems like everything goes in the right direction.

Version: 4.0
Download: https://github.com/Tearth/Cosette/releases/tag/v4.0
Estimated strength: 2300 Elo

Changelog:
- Added Texel project
- Added check extension
- Added check detection in quiescence search
- Added evasion moves generator
- Added static null-move pruning
- Added futility pruning
- Added new formulas calculating reduction for LMR and null move pruning
- Added a new way of building Piece-Square tables, better for tuning
- Fixed redundant saving of transposition table entries
- Adjusted search parameters
- Adjusted evaluation parameters
- Improved threefold repetition detection
- Updated .NET runtime version to 5.0.102

As always thank you for testing all previous versions and feel free to ask if you have any questions.

Thanks Pawel. I'm glad you make good progress and enjoy your work.

My only concern is ELO. For me that is the name of a compatriot who invented a rating system, so we spell it Elo.
Last edited by Pawel Osikowski on Sat Mar 06, 2021 3:29 pm, edited 2 times in total.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Pawel Osikowski wrote: Fri Jan 22, 2021 7:08 pm Thanks Pawel. I'm glad you make good progress and enjoy your work.

My only concern is ELO. For me that is the name of a compatriot who invented a rating system, so we spell it Elo.
Thanks, you're absolutely right - I will try to fix this in the future.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Oops, looks like I've underestimated Elo again - 2395 is a really awesome result because I wasn't even sure if it can pass 2300.
User avatar
Gabor Szots
Posts: 12889
Joined: Sat Dec 09, 2006 6:30 am
Sign-up code: 10159
Location: Szentendre, Hungary

Re: New Engine: Cosette

Post by Gabor Szots »

Pawel Osikowski wrote: Sat Jan 30, 2021 7:53 pm Oops, looks like I've underestimated Elo again - 2395 is a really awesome result because I wasn't even sure if it can pass 2300.
That must be a fluke because the wrong oppoent selection distorted the rating. I'm going to perform further tests to fix that.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Sure, I will be grateful. I have one polite request, can I ask for a change Releases link from "https://github.com/Tearth/Cosette/releases/tag/v1.0" to "https://github.com/Tearth/Cosette/releases"? It would better fit here because it lists all versions instead of the specified one.
User avatar
Gabor Szots
Posts: 12889
Joined: Sat Dec 09, 2006 6:30 am
Sign-up code: 10159
Location: Szentendre, Hungary

Re: New Engine: Cosette

Post by Gabor Szots »

Pawel Osikowski wrote: Tue Feb 09, 2021 5:27 pm Sure, I will be grateful. I have one polite request, can I ask for a change Releases link from "https://github.com/Tearth/Cosette/releases/tag/v1.0" to "https://github.com/Tearth/Cosette/releases"? It would better fit here because it lists all versions instead of the specified one.
Of course.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Thank you.
User avatar
Gabor Szots
Posts: 12889
Joined: Sat Dec 09, 2006 6:30 am
Sign-up code: 10159
Location: Szentendre, Hungary

Re: New Engine: Cosette

Post by Gabor Szots »

We have corrected the links, in fact there are two now. If you think that is too much please tell us.
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: New Engine: Cosette

Post by Pawel Osikowski »

Thanx, I think now it's perfectly fine.
tissatussa
Posts: 4
Joined: Sat Mar 13, 2021 9:01 pm
Sign-up code: 10159

Cosette test positions for parameter tuning ?

Post by tissatussa »

i see many UCI options are possible .. do test positions exist for tuning these parameter ? Some other engines also have such many parameters and default values, i never understood how to use them ..
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: Cosette test positions for parameter tuning ?

Post by Pawel Osikowski »

tissatussa wrote: Sat Mar 13, 2021 9:27 pm i see many UCI options are possible .. do test positions exist for tuning these parameter ? Some other engines also have such many parameters and default values, i never understood how to use them ..
Hi, I use Texel+Genetic algorithm method together with positions stored in the epd file, which are then evaluated by the engine every iteration. I use the amazing set made by Alexandru Moșoi (https://bitbucket.org/zurichess/tuner/downloads/, quiet-labeled.v7.epd.gz), which contains quiet positions perfect for direct evaluation (instead of doing quiescence search first).
tissatussa
Posts: 4
Joined: Sat Mar 13, 2021 9:01 pm
Sign-up code: 10159

Re: Cosette test positions for parameter tuning ?

Post by tissatussa »

thanks for the explanation! I'm new to the techniques of building / tuning engines -- i'm a programmer but i do not create any engine yet, however i gather and test many (Linux) engines. Eg. i stumbled upon "Rodent IV", the final version (because the author recently declared the project is finished). Rodent' first goal is to experiment with "personalities", for fun, not mainly being a strong engine. See eg. the personality 'Pedrita', its many options are below. Users may create own personalities by changing the values, but i have no clue how to tune those values when using test positions .. is this comparable to the techniques used for creating Cosette ?

in the download section you menton, i see the README text : "tuner is a set of utilities to train zurichess evaluation function" and i see 'weights' .. does this mean a Neural Network is made ? Fascinating -- when i understand all this .. Can you provide links for more information ?

; Pedrita personality for Rodent IV chess engine
; pawns, defence, restraint
; Pedrita stands for “pawns, defense, restraint”. She plays solid openings and thinks defense first, but
; don’t be deceived! She can attack all right if position demands it, and with solid pawn play she is a
; hard nut to crack.
;
setoption name PawnValueMg value 90
setoption name KnightValueMg value 380
setoption name BishopValueMg value 390
setoption name RookValueMg value 530
setoption name QueenValueMg value 1160
setoption name PawnValueEg value 110
setoption name KnightValueEg value 360
setoption name BishopValueEg value 370
setoption name RookValueEg value 650
setoption name QueenValueEg value 1190
setoption name KeepPawn value 0
setoption name KeepKnight value 0
setoption name KeepBishop value 0
setoption name KeepRook value 0
setoption name KeepQueen value 0
setoption name BishopPairMg value 51
setoption name BishopPairEg value 51
setoption name KnightPair value -1
setoption name RookPair value -11
setoption name KnightLikesClosed value 6
setoption name RookLikesOpen value 0
setoption name ExchangeImbalance value 10
setoption name MinorVsQueen value 10
setoption name Material value 100
setoption name OwnAttack value 100
setoption name OppAttack value 120
setoption name OwnMobility value 50
setoption name OppMobility value 70
setoption name FlatMobility value 50
setoption name KingTropism value 20
setoption name PrimaryPstWeight value 58
setoption name SecondaryPstWeight value 40
setoption name PiecePressure value 109
setoption name PassedPawns value 125
setoption name PawnStructure value 120
setoption name Lines value 100
setoption name Outposts value 78
setoption name Space value 0
setoption name PawnShield value 129
setoption name PawnStorm value 99
setoption name DoubledPawnMg value -8
setoption name DoubledPawnEg value -21
setoption name IsolatedPawnMg value -7
setoption name IsolatedPawnEg value -7
setoption name IsolatedOnOpenMg value -13
setoption name BackwardPawnMg value -2
setoption name BackwardPawnEg value -1
setoption name BackwardOnOpenMg value -10
setoption name FianchBase value 13
setoption name FianchKing value 20
setoption name ReturningB value 10
setoption name PawnMass value 125
setoption name PawnChains value 100
setoption name PrimaryPstStyle value 2
setoption name SecondaryPstStyle value 1
; little things, not accessible via UCI options
setoption name blockedcpawn value -17
; non-eval stuff
setoption name Contempt value 0
setoption name SlowMover value 100
setoption name Selectivity value 175
setoption name SearchSkill value 10
setoption name BookFilter value 20
setoption name GuideBookFile value guide/solid.bin
setoption name MainBookFile value rodent.bin
Pawel Osikowski
Posts: 33
Joined: Sat Sep 19, 2020 5:20 pm
Sign-up code: 10159

Re: Cosette test positions for parameter tuning ?

Post by Pawel Osikowski »

tissatussa wrote: Sun Mar 14, 2021 12:20 pm thanks for the explanation! I'm new to the techniques of building / tuning engines -- i'm a programmer but i do not create any engine yet, however i gather and test many (Linux) engines. Eg. i stumbled upon "Rodent IV", the final version (because the author recently declared the project is finished). Rodent' first goal is to experiment with "personalities", for fun, not mainly being a strong engine. See eg. the personality 'Pedrita', its many options are below. Users may create own personalities by changing the values, but i have no clue how to tune those values when using test positions .. is this comparable to the techniques used for creating Cosette ?
It's absolutely possible to make a similar thing with personalities for Cosette by changing parameters through UCI protocol, although I never tried to do this because my main goal is actually increasing Elo. Texel tuning might sound a bit scary, but in fact, it's a really simple method and quite effective - you can read about it here: https://www.chessprogramming.org/Texel% ... ing_Method.
tissatussa wrote: Sun Mar 14, 2021 12:20 pm in the download section you menton, i see the README text : "tuner is a set of utilities to train zurichess evaluation function" and i see 'weights' .. does this mean a Neural Network is made ? Fascinating -- when i understand all this .. Can you provide links for more information ?
Honestly, I don't know Zurichess engine, but if README mentions weights then there is a good chance it uses a neural network for evaluation. I'm not familiar with using NN like this, but I know it's a really powerful tool in chess programming. Cosette uses traditional algorithms to evaluate boards (https://www.chessprogramming.org/Evaluation).
Post Reply