Closed s320168 closed 11 months ago
Thank you for your comprehensive review and valuable insights. I appreciate the feedback provided by your analysis, and I am committed to addressing the identified issues. Here are the planned adjustments:
rule_based_nim_sum
strategy. To enhance its effectiveness, I will modify the strategy to consider the number of remaining rows before making a move. This adjustment aims to better align the strategy with the goal of leaving only one matchstick for the next player in certain scenarios.evolved_strategy
function to facilitate a meaningful evolution of strategies.
I appreciate your thorough review, and I'm open to any further recommendations or specific aspects you believe should be addressed. Your input is invaluable, and I'm dedicated to refining the code to meet the objectives of the lab.
Thank you once again for your insights.
It seems to me that you considered as winner of the game the player who takes the last matchstick while the goal of the lab was to avoid taking the last one: this would mess up the fitness calculation and favor worse individuals over better ones inside the population.
In task 2.1 rule_based_nim_sum is most likely to lose because it only checks for nim-sum to be 0, so it will lose once there is only 1 row with 1 or more matchsticks. By adding a check on how many rows remain before choosing what to play it's possible to switch strategy to leave only 1 match (if initially there are 2 or more of them) to the next player, forcing them to lose when a game presents this setting.
In task 2.2 there shouldn't be any ranking before choosing mu parents as they should be chosen entirely randomly in ES. The bias computed in the evolved_strategy function isn't used to compute the player's move so there is no real evolution. The correct way to implement (mu+lambda)-ES is to select mu random parents to be kept from the previous population, use them to create lambda // mu children to be mutated and perform a survival of the fittest selection over all population, I'm not sure about the population size and parents amount every generation used in the code.