I have thought about the limit where an engine goes from being written from scratch, to being inspired by some other, to being a clone of, to being stealing from etc. I know it isn't a hard limit on number of lines you can steal or so, but what is the general opinion on the matter?
Personally I like writing stuff myself and understand what is going on. Sometimes the understanding comes from looking at others code and then implementing your own stuff. I stole (with permission) how TTs are handled from Thomas/Leorik and I will eventually re-write it when I learn how it works.
I also took the PeSTO tables values straight off for evaluation. As a chess player I later want to implement my own tables along with other concepts I think about myself when playing. But the tables are there as a "placeholder" for now when developing and optimizing other parts.
There are lots of other concepts that I guess all engines use, such as null-move, late move prunings, alpha/beta prunings, quiescence and such. All of those have some conditions which needs to apply and there is not many ways you can implement this. Is it stealing to use these? Cloning?
Same would go for magic bitboards, move generation approaches and all of that. The bit operations you need to use is rather standardized.
Not sure where I am going with this, just curious what would be considered a clone/inspired by someone, and what is an engine written from "scratch". There gotta be an optimal way of doing all basic stuff like move gen, make moves and such. Is all that differs top engines their evaluation or is there more to it?
Ethics in chess programming
Moderator: Ras
-
- Posts: 114
- Joined: Sat Nov 14, 2020 12:49 pm
- Full name: Elias Nilsson
-
- Posts: 157
- Joined: Fri Apr 30, 2021 7:19 am
- Full name: Pedro Duran
Re: Ethics in chess programming
These things / features are the results of years of research of very smart people in the world of chess programming.
About if it's "stealing" or not it depends of the License of these algorithms, as far as I know, these algorithms are inside GNU License ( correct me please if i'm wrong ) so is ok to use them in your software, they are just tools, and here is were it comes the Quote "Don't reinvent the wheel", and "Work smart, not hard"
Of coruse, is always a good thing thinking out of the box, is always good to try to find of new ways of developing an more optimized SEE algorithm, or a new and stable pruning technique inside the search.
But again, don't be afraid of using existing stuff.
That is my personal opinion about this stuff.
About if it's "stealing" or not it depends of the License of these algorithms, as far as I know, these algorithms are inside GNU License ( correct me please if i'm wrong ) so is ok to use them in your software, they are just tools, and here is were it comes the Quote "Don't reinvent the wheel", and "Work smart, not hard"
Of coruse, is always a good thing thinking out of the box, is always good to try to find of new ways of developing an more optimized SEE algorithm, or a new and stable pruning technique inside the search.
But again, don't be afraid of using existing stuff.
That is my personal opinion about this stuff.
-
- Posts: 965
- Joined: Fri Aug 21, 2020 1:25 am
- Location: Planet Earth, Sol system
- Full name: Michael J Sherwin
Re: Ethics in chess programming
I've been sitting here for over an hour thinking of what I can say. And I still do not know what I am going to say. So I am going to just wing it. The only thing that everyone should agree on is that compiling someone else's code and changing the author's string is a clone. Not honoring the GPL in some way is a violation. What Thomas Jahn is doing with Leorick is excellent work. He takes known ideas and tries to maximise their efficiency. I wish that at some point he will write a full tutorial on his work but also at some point close Leorick's sources. Personally I would rather learn from a tutorial than from source code. Are you writing your engine in C#? Is that why you are using Leorick as a guide? Are you able to improve upon Thomas's programming style? Will you then give something back to Thomas by sharing what you have come up with? I like Thomas's work and I plan on seeing if his work will meld well with what I am doing with Rommie that is written in C++ (as a better C). But what I am not going to do is translate his code line by line into C++. I feel okay with that because I have contributed to Leorick in some small way. Or at least I think that I have. What I personally do not like are authors that take take take and never even try to give anything back. I have helped pioneer improvements to Null-move, LMR, LMP, PEXT/PAND(2006), 15x15 tables for king safety (20 elo for Winter), ordering of moves by using collected statistics(Mar reported a 20 elo gain), feedback from search to the evaluation and of course RL. And quite a few more. Most of which have ended up in one engine or another. Also my Sherwin50.pgn has been used by some engine authors and by Ray Banks of CCRL. So my conscious is clear if I borrow a few things from other's.eligolf wrote: ↑Wed Mar 09, 2022 9:32 am I have thought about the limit where an engine goes from being written from scratch, to being inspired by some other, to being a clone of, to being stealing from etc. I know it isn't a hard limit on number of lines you can steal or so, but what is the general opinion on the matter?
Personally I like writing stuff myself and understand what is going on. Sometimes the understanding comes from looking at others code and then implementing your own stuff. I stole (with permission) how TTs are handled from Thomas/Leorik and I will eventually re-write it when I learn how it works.
I also took the PeSTO tables values straight off for evaluation. As a chess player I later want to implement my own tables along with other concepts I think about myself when playing. But the tables are there as a "placeholder" for now when developing and optimizing other parts.
There are lots of other concepts that I guess all engines use, such as null-move, late move prunings, alpha/beta prunings, quiescence and such. All of those have some conditions which needs to apply and there is not many ways you can implement this. Is it stealing to use these? Cloning?
Same would go for magic bitboards, move generation approaches and all of that. The bit operations you need to use is rather standardized.
Not sure where I am going with this, just curious what would be considered a clone/inspired by someone, and what is an engine written from "scratch". There gotta be an optimal way of doing all basic stuff like move gen, make moves and such. Is all that differs top engines their evaluation or is there more to it?
-
- Posts: 5695
- Joined: Tue Feb 28, 2012 11:56 pm
Re: Ethics in chess programming
If it is only about programming, then copyright law is the limit (which does not mean you can't copy: you can copy with permission). I don't see what ethics has to do with the programming itself; the game of chess does not tread on current day sensitivities, at least not yet.eligolf wrote: ↑Wed Mar 09, 2022 9:32 am I have thought about the limit where an engine goes from being written from scratch, to being inspired by some other, to being a clone of, to being stealing from etc. I know it isn't a hard limit on number of lines you can steal or so, but what is the general opinion on the matter?
If it is about competition, i.e. entering your engine in a tournament, then it is up to the tournament organiser to set the rules. Lying to the organiser about compliance of your engine with those rules or concealing properties of your engine that you know are relevant to the engine's admission even if the rules aren't explicit about them would normally be unethical. (However, there can be lots of complicated questions here, e.g. what does it mean for an engine not to use a book. When is it OK to include code from others, e.g. TB code or NN code.)
If it is about bragging rights, then it seems sufficient that you don't pretend to have done something yourself that you didn't do yourself. (I think this is rare, but your can probably find threads here of people casually remarking that they wrote a 3000+ Elo engine from scratch in 6 months. No, they took the SF code and learned how to compile it.)
Don't let anyone stop you from doing what you like.Personally I like writing stuff myself and understand what is going on. Sometimes the understanding comes from looking at others code and then implementing your own stuff. I stole (with permission) how TTs are handled from Thomas/Leorik and I will eventually re-write it when I learn how it works.
I also took the PeSTO tables values straight off for evaluation. As a chess player I later want to implement my own tables along with other concepts I think about myself when playing. But the tables are there as a "placeholder" for now when developing and optimizing other parts.
When it comes to releasing your engine, you should consider if there is any code left in it that is still a more or less straight copy & paste of code for which you don't have permission from the copyright holder. (So if a piece of code came from Stockfish, you would have to release the engine under GPLv3 or rewrite that part before you release your engine.) You don't have to completely re-implement such code, the copyright is not on the functionality but on how it is expressed with variable naming and white spacing etc., and for large pieces of code perhaps also the overall code structure. There is no copyright on the values of a table with evaluation values.
Ideas are unprotected by copyright.There are lots of other concepts that I guess all engines use, such as null-move, late move prunings, alpha/beta prunings, quiescence and such. All of those have some conditions which needs to apply and there is not many ways you can implement this. Is it stealing to use these? Cloning?
Same would go for magic bitboards, move generation approaches and all of that. The bit operations you need to use is rather standardized.
However, a tournament organiser, if he or she so wishes, may decide to admit only one alpha-beta engine, for example. That would be very silly, but being silly is not forbidden or unethical.
Where do you want your engine to play...Not sure where I am going with this, just curious what would be considered a clone/inspired by someone, and what is an engine written from "scratch". There gotta be an optimal way of doing all basic stuff like move gen, make moves and such. Is all that differs top engines their evaluation or is there more to it?
If it is just for the fun of writing a chess engine (and I guessing this is the case for you, at least for now), you should set your own rules. Do you enjoy re-inventing the wheel (nothing wrong with that) or do you want to test a specific idea that you have (and e.g. write a paper on it)? If the latter, it would make a lot of sense to start with Stockfish (or perhaps a simpler engine) and implement your idea on top of it (and if it works, submit a patch).
Completely re-inventing the wheel obviously does not make sense. No single person can replicate what took mankind over 70 years to produce. You cannot avoid re-using ideas and solutions invented by others.
-
- Posts: 915
- Joined: Sun Dec 27, 2020 2:40 am
- Location: Bremen, Germany
- Full name: Thomas Jahn
Re: Ethics in chess programming
With MinimalChess I recorded a few "educational" Youtube videos but it's pretty time consuming work. Also I feel like I'm just a rookie in the world of chess programming and taking the role of the teacher with the little I know seems pretentious.Mike Sherwin wrote: ↑Wed Mar 09, 2022 7:42 pm I wish that at some point he will write a full tutorial on his work but also at some point close Leorick's sources.
What do you mean with "close Leorik's sources"? Make the repository private and just release binaries? Why...?
The Transposition table Elias borrowed is doing a good job but if there's original work it's in the *details* of the implementation. I can turn an idea into code pretty reliably and this forum and the wiki are full of amazing ideas. So writing a chess engine is right within my comfort zone, ironically, despite me being a measly 1000 Elo player. I can imagine for many it's the other way round: They have a vested interest in chess and chess engines but maybe not decades of programming experience to write a bug-free engine completely from scratch.Mike Sherwin wrote: ↑Wed Mar 09, 2022 7:42 pm Are you writing your engine in C#? Is that why you are using Leorik as a guide? Are you able to improve upon Thomas's programming style? Will you then give something back to Thomas by sharing what you have come up with?
So I think it's absolutely fine to adapt some stuff. I borrow the high level concepts and ideas. I learned a lot in the last year. What transpositions are in chess and why every engine has such a table, for example. Others borrow the implementation of a tricky algorithm from an engine that already works. Just be transparent about it. Don't disguise it and claim it's original work. And abide by the rules. That means respect the terms of the open source license. And if there's no license and you still want to use it: Well... you just ask permission. Which Elias did. So he acted 100% ethical as far as I'm concerned.
I think the spirit here is one of competitive collaboration. Almost nobody is in here for the money. Whatever your personal goals are they are... well... personal.
I don't think so. People have different preferences. And they end up using different techniques in their engines. There's no optimal way to paint a picture, is there? It's about what you want to capture and about what you can pull off. And just doing creative work is rewarding in itself, optimal or not.
-
- Posts: 965
- Joined: Fri Aug 21, 2020 1:25 am
- Location: Planet Earth, Sol system
- Full name: Michael J Sherwin
Re: Ethics in chess programming
You have come such a long way in only a year that if you keep on keeping on for a few years more Leorick will be a top tier engine, no doubt. So my wish would be for you to start a tutorial now and revise it ever so often as Leorick improves. SF is great but it is not a tutorial and afaik no one explains exactly what they do and why they do it. And learning from SF source is just to difficult for most people. Besides what you do is much simpler. And simple is good.lithander wrote: ↑Thu Mar 10, 2022 1:01 amWith MinimalChess I recorded a few "educational" Youtube videos but it's pretty time consuming work. Also I feel like I'm just a rookie in the world of chess programming and taking the role of the teacher with the little I know seems pretentious.Mike Sherwin wrote: ↑Wed Mar 09, 2022 7:42 pm I wish that at some point he will write a full tutorial on his work but also at some point close Leorick's sources.
What do you mean with "close Leorik's sources"? Make the repository private and just release binaries? Why...?
The Transposition table Elias borrowed is doing a good job but if there's original work it's in the *details* of the implementation. I can turn an idea into code pretty reliably and this forum and the wiki are full of amazing ideas. So writing a chess engine is right within my comfort zone, ironically, despite me being a measly 1000 Elo player. I can imagine for many it's the other way round: They have a vested interest in chess and chess engines but maybe not decades of programming experience to write a bug-free engine completely from scratch.Mike Sherwin wrote: ↑Wed Mar 09, 2022 7:42 pm Are you writing your engine in C#? Is that why you are using Leorik as a guide? Are you able to improve upon Thomas's programming style? Will you then give something back to Thomas by sharing what you have come up with?
So I think it's absolutely fine to adapt some stuff. I borrow the high level concepts and ideas. I learned a lot in the last year. What transpositions are in chess and why every engine has such a table, for example. Others borrow the implementation of a tricky algorithm from an engine that already works. Just be transparent about it. Don't disguise it and claim it's original work. And abide by the rules. That means respect the terms of the open source license. And if there's no license and you still want to use it: Well... you just ask permission. Which Elias did. So he acted 100% ethical as far as I'm concerned.
I think the spirit here is one of competitive collaboration. Almost nobody is in here for the money. Whatever your personal goals are they are... well... personal.
I don't think so. People have different preferences. And they end up using different techniques in their engines. There's no optimal way to paint a picture, is there? It's about what you want to capture and about what you can pull off. And just doing creative work is rewarding in itself, optimal or not.
For me chess programming was far more interesting 20 years ago because there was at least the illusion that an author could start from scratch and reach the top all on his own. RomiChess when it came out scored about 35% against Crafty and Crafty was a top tier engine at that time. And Dann Corbit posted that RomiChess was the most original source code that he had seen in a long time. And back then Romi's learning could triumph over all the top engines (except Spike) including Rybka. Now top engines are too nondeterministic for Romi to beat without training for millions of games. I asked Prof. Robert Hyatt once if he regretted making his source open. His reply was if he could go back and do it all over again that he would not have made Crafty open source. Without open source there would be no SF and it would be a far more competitive environment for chess programmers.
I wrote RomiChess completely from scratch except for Popcount in inline assembler that I took from Crafty. Really that is all. The rest I got from David Levy's book on chess programming. And things like LMR from Winboard and TalkChess.
So bottom line is that I miss the days that open source destroyed.

-
- Posts: 7299
- Joined: Thu Aug 18, 2011 12:04 pm
- Full name: Ed Schröder
Re: Ethics in chess programming
Since 10 year I maintain the Programmer code of Honor, 70 engine authors have subscribed to it.
Check out if it is something for you.
http://rebel13.nl/download/programmer-c ... honor.html
Check out if it is something for you.
http://rebel13.nl/download/programmer-c ... honor.html
90% of coding is debugging, the other 10% is writing bugs.
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Ethics in chess programming
Well, it is clear that virtually no engine with a rating over 2000 can be considered original works in the sense that the author could have written it without knowing that programs to play chess already exist. He would likely not get beyond negamax, and it would already be questionable whether he would discover null-move pruning. (AlphaZero should count as an exception to this.)
I guess an accurate statement would be that all strong engines are often independently written) implementations of an algorithm that is for 99% the same, and are only ~1% original at the algorithmic level.
I guess an accurate statement would be that all strong engines are often independently written) implementations of an algorithm that is for 99% the same, and are only ~1% original at the algorithmic level.
-
- Posts: 70
- Joined: Thu Feb 25, 2021 5:12 pm
- Location: Poland
- Full name: Pawel Osikowski
Re: Ethics in chess programming
I have a pretty simple rule, I just don't look at sources of other engines at all (at least these parts related to search or evaluation, others should be ok) - I accept reading about general ideas, but the implementation itself is always mine. Not the most effective in Elo terms, but feels the most fun.
Inanis (Rust, active development) - https://github.com/Tearth/Inanis, http://talkchess.com/forum3/viewtopic.php?f=7&t=79625
Latest version: 1.6.0 (3100 Elo) - https://github.com/Tearth/Inanis/releases/tag/v1.6.0
Cosette, Bitboard Viewer
Latest version: 1.6.0 (3100 Elo) - https://github.com/Tearth/Inanis/releases/tag/v1.6.0
Cosette, Bitboard Viewer
-
- Posts: 1062
- Joined: Tue Apr 28, 2020 10:03 pm
- Full name: Daniel Infuehr
Re: Ethics in chess programming
Well there was also giraffe. But that turned into Alpha zero so you might be right.hgm wrote: ↑Thu Mar 10, 2022 10:53 am Well, it is clear that virtually no engine with a rating over 2000 can be considered original works in the sense that the author could have written it without knowing that programs to play chess already exist. He would likely not get beyond negamax, and it would already be questionable whether he would discover null-move pruning. (AlphaZero should count as an exception to this.)
You would have to hand wire your processor too and write your own compiler with that puritan approach.
We all stand on the shoulders of our predecessors and that is a good thing.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Daniel Inführ - Software Developer