AIND play each match twice — once
AIND Project 2: Build a game playing agentHeuristic Analysis By – Aditya Paliwal INTRODUCTIONFor the given project of Building an advance game playing agent, we were required to implement min-max algorithm, alpha-beta pruning, and iterative deepening algorithms. Here in this project three heuristics are created and had similar outcomes. The below figures, depict the win rate of those three heuristic functions vs AB_improved when running the provided tournament.
py script.In tournament.py script, the student agent plays a number of “fair” matches against each test agent. The matches are fair because the board is initialized randomly for both players, and the players play each match twice — once as the first player and once as the second player.
Before analyzing the results, the above script ran three times that is, played 10, 20 and 30 matches in each 1st, 2nd and 3rd round respectively. Figure 1: Results when number of matches played=10. Figure 2: Results when number of matches played=20. Figure 3: Results when number of matches played=30 HEURISTIC DESCRIPTIONCustom_score takes the difference of the percentage of legal_moves a player has vs. the number of remaining the blank spaces. The more legal moves a player versus blank spaces allows the player become opponent value is doubled to provide more aggressive play. Custom_score_2 is the difference of legal moves multiplied by a probability value whose sum equals one. The opponent weight is .
95 and your own equals .05. This provides a more conservative game play deeper into the game. Reversing the probability values resulted in a higher loss rate. Ultimately, I decided use .95/.05 combo because it seemed to have more consistent results.
Custom_score_3 is the difference of legal moves. The opponent’s moves are doubled then increased by 100%. My rationale was to guarantee that the opponent player always had a commanding lead. Thus, your own player would be ultra-aggressive. RESULTAll Three seem to win around 70% most of the time. Adjusting time seemed to have a negative impact on my alpha-beta pruning techniques. It is possible that I might need to make my weights less or compare against neighboring moves differently.
RECOMMENDATION The below table shows the comparison between the different heuristics Custom_score 71.83% Custom_score_2 74.46% Custom_score_3 73.13% According to the results obtained, I would recommend custom_score_2 because it had the most consistent win rate. The respective heuristic also weighs the opponent’s number of moves more heavily even if equal. This possibly provides deeper searches prior to pruning potential leafs. It is also incredible fast to compute, O(1), and is easily interpretable.