by trying to learning the general rules that to explain the dataset and minimise its loss. That's what machine learning is about, it's not called machine memorising.
It cannot be learning the general rules because it occasionally tries to invent pieces out of whole cloth.
that would be the optimal rule :) We usually optimise to improve and learn better and better rules, hopefully approximating the optimal rule after some iterations. There's still a gap here, but hopefully it can be closed by improving the models, training algorithms etc.
Try asking it if a previous move was legal. Or why it decided to do the move.
The problem is not a failure to understand the rules. It is just not very good at maintaining the state.