- Blind mode tutorial
lichess.org
Donate

Could an AI figure out the rules of chess from games?

I think from a million games you should be able to figure out how pieces are allowed to move. I would guess even en-passent though I am not sure if it would figure out what is 'not allowed', most tricky one I can think of is you are not allowed to castle the king over a attacked square. I would expect that a million random games may not give enough clarity on this.

A rule I would be very sure that could not be learned unless you have a much bigger training set is 'if there is no way to win, you do not win when the opponent is out of time'. This is very difficult to analyze in general, as there could be forced sequences leading to a locked but not stalemated position.

I think from a million games you should be able to figure out how pieces are allowed to move. I would guess even en-passent though I am not sure if it would figure out what is 'not allowed', most tricky one I can think of is you are not allowed to castle the king over a attacked square. I would expect that a million random games may not give enough clarity on this. A rule I would be very sure that could not be learned unless you have a much bigger training set is 'if there is no way to win, you do not win when the opponent is out of time'. This is very difficult to analyze in general, as there could be forced sequences leading to a locked but not stalemated position.

@AsDaGo said in #5:

You dont need AI to do. Relatively simple algorithm could do it.
Certainly it would not be difficult to code the rules of chess manually, but the question was could an AI learn the rules.
I mean it is relatively easy to build machine learning algorithm that records move that are legal in given situation and what moves are not done. then just tabululating known legal moves that are present.
Obviously the the no-one telling this is OK not OK makes it quite slow process. Biggest issue would stuff like check. It would take large set notice that if king is in check then on small set moves are legal.
I pretty sure this sort simple tabulating could converge quickly on for most of the stuff.

For more complete you neural net is needed. But humans do learn rules of chess just by wathching others play so sufficiently complex neural net should be able do the same i.e given position guess next move and next board position. So at least propose legal move would be achievable. how to get all legal moves out would take some thinking but i don't see any reason why it would be impossible.

@AsDaGo said in #5: >>You dont need AI to do. Relatively simple algorithm could do it. >Certainly it would not be difficult to code the rules of chess manually, but the question was could an AI learn the rules. I mean it is relatively easy to build machine learning algorithm that records move that are legal in given situation and what moves are not done. then just tabululating known legal moves that are present. Obviously the the no-one telling this is OK not OK makes it quite slow process. Biggest issue would stuff like check. It would take large set notice that if king is in check then on small set moves are legal. I pretty sure this sort simple tabulating could converge quickly on for most of the stuff. For more complete you neural net is needed. But humans do learn rules of chess just by wathching others play so sufficiently complex neural net should be able do the same i.e given position guess next move and next board position. So at least propose legal move would be achievable. how to get all legal moves out would take some thinking but i don't see any reason why it would be impossible.

@petri999 said in #12:
... humans do learn rules of chess just by wathching others play...

Actually in reality humans learn some rules by watching others play but get a better understanding by hearing them talk 'ah I wish I could have castled', but if you started with no knowledge and watched a million games without any comments you would certainly not know all the rules.

Here is the simplest path I can think of to learn that there MAY be a rule that your king cannot travel over an attacked field while castling:

  1. Observe so many games that you become a reasonable evaluator of positions
  2. List all positions where people play suboptimal rules
  3. Identify what you think based on your current understanding of the rules would be the best move
  4. Recognize a pattern (ah, in x% of the cases I would have castled)
  5. Check if this situation occurs a significant amount of times (the person lost because they should have castled but did not, and it is unlikely this is just a coincidence for all these occurrences)
  6. List all positions where castling was the best move and they indeed castled, and try to find a pattern in the difference (the king would need to travel to an attacked field)

Now add this to your assumed set of rules (which hopefully is all correct till now), evaluate all games again and look for the next outlier/result you don't understand (as inspiration search for the Chess Unwinnability Analyzer).

Of course this is about properly learning the rules, if the question is 'can we learn which moves are likely legal' that is a much easier question and I would expect that to take much less than a million games.

@petri999 said in #12: ... humans do learn rules of chess just by wathching others play... Actually in reality humans learn some rules by watching others play but get a better understanding by hearing them talk 'ah I wish I could have castled', but if you started with no knowledge and watched a million games without any comments you would certainly not know all the rules. Here is the simplest path I can think of to learn that there MAY be a rule that your king cannot travel over an attacked field while castling: 1. Observe so many games that you become a reasonable evaluator of positions 2. List all positions where people play suboptimal rules 3. Identify what you think based on your current understanding of the rules would be the best move 4. Recognize a pattern (ah, in x% of the cases I would have castled) 5. Check if this situation occurs a significant amount of times (the person lost because they should have castled but did not, and it is unlikely this is just a coincidence for all these occurrences) 6. List all positions where castling was the best move and they indeed castled, and try to find a pattern in the difference (the king would need to travel to an attacked field) Now add this to your assumed set of rules (which hopefully is all correct till now), evaluate all games again and look for the next outlier/result you don't understand (as inspiration search for the Chess Unwinnability Analyzer). Of course this is about properly learning the rules, if the question is 'can we learn which moves are likely legal' that is a much easier question and I would expect that to take much less than a million games.

@FunnyAnimatorJimTV I asked Chat-gpt :

"AlphaZero, an AI developed by DeepMind, was specifically designed to learn and master games like chess, shogi, and Go through self-play. However, AlphaZero does require some foundational information to start the learning process, such as the basic rules and objectives of the game. Once it has this initial information, it can then play countless games against itself, improving through reinforcement learning without further human intervention.

So, while AlphaZero can achieve superhuman proficiency in chess and other games through self-play, it still needs to be provided with the basic rules of the game initially. It cannot independently deduce the rules of chess from scratch without any prior information."

@FunnyAnimatorJimTV I asked Chat-gpt : "AlphaZero, an AI developed by DeepMind, was specifically designed to learn and master games like chess, shogi, and Go through self-play. However, AlphaZero does require some foundational information to start the learning process, such as the basic rules and objectives of the game. Once it has this initial information, it can then play countless games against itself, improving through reinforcement learning without further human intervention. So, while AlphaZero can achieve superhuman proficiency in chess and other games through self-play, it still needs to be provided with the basic rules of the game initially. It cannot independently deduce the rules of chess from scratch without any prior information."
<Comment deleted by user>

@petri999 said in #12:

I mean it is relatively easy to build machine learning algorithm that records move that are legal in given situation and what moves are not done. then just tabulating known legal moves that are present.

I feel like "just" is doing some heavy lifting here. What do you do in a position that you haven't seen before? Or in a position that you have seen before, how do you know which unseen moves are illegal and which just haven't been played? It's hard to see how you'd get this to work without either giving it a fair bit of prior information about the rules or doing a lot more than just "tabulating known legal moves"...

@petri999 said in #12: > I mean it is relatively easy to build machine learning algorithm that records move that are legal in given situation and what moves are not done. then just tabulating known legal moves that are present. I feel like "just" is doing some heavy lifting here. What do you do in a position that you haven't seen before? Or in a position that you have seen before, how do you know which unseen moves are illegal and which just haven't been played? It's hard to see how you'd get this to work without either giving it a fair bit of prior information about the rules or doing a lot more than just "tabulating known legal moves"...

Capablanca famously learned the rules of chess just by observing his father play. Now could an AI figure out the rules of chess from games is an interesting question. In my opinion what we currently consider AI could not, at least not without providing a lot of extra information (the type of game, notation.. stuff like that).

Capablanca famously learned the rules of chess just by observing his father play. Now could an AI figure out the rules of chess from games is an interesting question. In my opinion what we currently consider AI could not, at least not without providing a lot of extra information (the type of game, notation.. stuff like that).
<Comment deleted by user>

@Hagredion said in #17:

Capablanca famously learned the rules of chess just by observing his father play. Now could an AI figure out the rules of chess from games is an interesting question. In my opinion what we currently consider AI could not, at least not without providing a lot of extra information (the type of game, notation.. stuff like that).
First of all Capablanca was gifted. Secondly when they say "just by observing games" they didn't meant that he wasn't listening. And listening to and "observing" his father (he knows him well to see even patterns in his behavior), was more like and AI learning from another AI, not from some random games.

@Hagredion said in #17: > Capablanca famously learned the rules of chess just by observing his father play. Now could an AI figure out the rules of chess from games is an interesting question. In my opinion what we currently consider AI could not, at least not without providing a lot of extra information (the type of game, notation.. stuff like that). First of all Capablanca was gifted. Secondly when they say "just by observing games" they didn't meant that he wasn't listening. And listening to and "observing" his father (he knows him well to see even patterns in his behavior), was more like and AI learning from another AI, not from some random games.

@SquareTableKnight said in #19:

First of all Capablanca was gifted. Secondly when they say "just by observing games" they didn't meant that he wasn't listening. And listening to and "observing" his father (he knows him well to see even patterns in his behavior), was more like and AI learning from another AI, not from some random games.

Listening to what exactly?

@SquareTableKnight said in #19: > First of all Capablanca was gifted. Secondly when they say "just by observing games" they didn't meant that he wasn't listening. And listening to and "observing" his father (he knows him well to see even patterns in his behavior), was more like and AI learning from another AI, not from some random games. Listening to what exactly?

This topic has been archived and can no longer be replied to.