Here some minor problem that I found reading your code:
- Comment and variable names should be in english.
- Some functions are commented, other not.
- The strategy implemented doesn't take into consideration a k-version of the Nim game.
- The results are not clear. A plots showing the percentage of wins should be implemented.
- In order to make the final result even more accurate, your strategy shouldn't always be the first moving.
Here some major problem of the strategy:
- You are not actually implementing a one-cut-crossover, you are just randomly choosing a parent. In this type of implementation (so with probabilities), I personally don't think that crossover is a valuable technique, since you also need to deal with probabilities constraints (sum of all prob = 1). You should focus only on mutations. Since you are also using steady state, I would put mutation probability = 1.
- It's not really fair to evaluate your moves against the optimal strategy, in the fitness!
- In the fitness function only during the first game you are actually using the adaptive strategy, in all the others you are evaluating an optimal vs optimal strategy. This should be fixed in order to get a reliable fitness value.
Here some minor problem that I found reading your code:
Here some major problem of the strategy: