Ideas of engines written in C#
Moderator: Ras
-
- Posts: 72
- Joined: Sun Nov 01, 2020 5:27 pm
- Full name: Richard Porti
Ideas of engines written in C#
Do you guys know if some serious chess engines have been written in C#?
-
- Posts: 256
- Joined: Wed Oct 02, 2013 12:36 am
Re: Ideas of engines written in C#
Perhaps you might want to read this: https://tearth.dev/posts/performance-of ... rp-part-1/
-
- Posts: 440
- Joined: Thu Apr 26, 2012 1:51 am
- Location: Oak Park, IL, USA
- Full name: Erik Madsen
Re: Ideas of engines written in C#
I don't know your definition of "serious" but here's mine. MadChess is roughly 2700 Elo.
Blog
Source Code
Blog
Source Code
Erik Madsen | My C# chess engine: https://www.madchess.net
-
- Posts: 72
- Joined: Sun Nov 01, 2020 5:27 pm
- Full name: Richard Porti
Re: Ideas of engines written in C#
Very niceemadsen wrote: ↑Fri Mar 24, 2023 4:10 pm I don't know your definition of "serious" but here's mine. MadChess is roughly 2700 Elo.
Blog
Source Code

-
- Posts: 440
- Joined: Thu Apr 26, 2012 1:51 am
- Location: Oak Park, IL, USA
- Full name: Erik Madsen
Re: Ideas of engines written in C#
I don't think so. It has no significant NuGet package dependencies other than for unit tests. I don't believe it references many .NET 7 specific APIs. Perhaps you'll have difficulties with the System.Numerics namespace. I don't know. I haven't written .NET 4 code in years.
Why would you want to backport the code to a 13 year old runtime?
Erik Madsen | My C# chess engine: https://www.madchess.net
-
- Posts: 1062
- Joined: Tue Apr 28, 2020 10:03 pm
- Full name: Daniel Infuehr
Re: Ideas of engines written in C#
One of the best ones : https://github.com/lithander/Leorik
You dont need to think about the API. Microsoft consolidated .net .net core and .net framework into .net standard which is basically backwards compatible. So most of .net 8 (the one from 2023) is the same code as .net framework 4.0 (barring all of nuget)
If you need to run it on windows 98 (for whatever reason) you need .net framework 2
For windows XP you can go .net framework 4
Recommendation: just go with .net 8 and be done with it. It runs of your phone too etc.
Rant about JIT:
Too bad the promise of more performance compared to C++ never materialized. Since all JIT could compile at runtime like march=native which shipped binaries cannot do.
Or compiling a startup settings file at runtime. (c++ can only ever be a const variable x) but C# can compile it as the constant "3" etc..
Its not even a fault of the language - but the MSIL optimizer is not where it could be in theory.
You dont need to think about the API. Microsoft consolidated .net .net core and .net framework into .net standard which is basically backwards compatible. So most of .net 8 (the one from 2023) is the same code as .net framework 4.0 (barring all of nuget)
If you need to run it on windows 98 (for whatever reason) you need .net framework 2
For windows XP you can go .net framework 4
Recommendation: just go with .net 8 and be done with it. It runs of your phone too etc.
Rant about JIT:
Too bad the promise of more performance compared to C++ never materialized. Since all JIT could compile at runtime like march=native which shipped binaries cannot do.
Or compiling a startup settings file at runtime. (c++ can only ever be a const variable x) but C# can compile it as the constant "3" etc..
Its not even a fault of the language - but the MSIL optimizer is not where it could be in theory.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Daniel Inführ - Software Developer
-
- Posts: 253
- Joined: Mon Aug 26, 2019 4:34 pm
- Location: Clearwater, Florida USA
- Full name: JoAnn Peeler
Re: Ideas of engines written in C#
+1 and +1dangi12012 wrote: ↑Fri Mar 24, 2023 6:49 pm One of the best ones : https://github.com/lithander/Leorik
Recommendation: just go with .net 8 and be done with it. It runs of your phone too etc.
-
- Posts: 72
- Joined: Sun Nov 01, 2020 5:27 pm
- Full name: Richard Porti
Re: Ideas of engines written in C#
Thank youemadsen wrote: ↑Fri Mar 24, 2023 6:37 pmI don't think so. It has no significant NuGet package dependencies other than for unit tests. I don't believe it references many .NET 7 specific APIs. Perhaps you'll have difficulties with the System.Numerics namespace. I don't know. I haven't written .NET 4 code in years.
Why would you want to backport the code to a 13 year old runtime?

-
- Posts: 440
- Joined: Thu Apr 26, 2012 1:51 am
- Location: Oak Park, IL, USA
- Full name: Erik Madsen
Re: Ideas of engines written in C#
Oh, you mean .NET Framework 4.8 not .NET Framework 4. Big difference.
I don't understand what you mean by Unity being "super limited". The Unity documentation you linked to says it supports .NET Standard 2.1. So target that. I don't see any reason to limit the runtime to .NET Framework 4.8.
I don't understand what you mean by Unity being "super limited". The Unity documentation you linked to says it supports .NET Standard 2.1. So target that. I don't see any reason to limit the runtime to .NET Framework 4.8.
Erik Madsen | My C# chess engine: https://www.madchess.net
-
- Posts: 1062
- Joined: Tue Apr 28, 2020 10:03 pm
- Full name: Daniel Infuehr
Re: Ideas of engines written in C#
.NET Standard 2.1 is the interface
So you can literally pick any modern framework
So you can literally pick any modern framework
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Daniel Inführ - Software Developer