C463/B551/I400 Artificial Intelligence
Dana Vrajitoru

C463/B551/I400 Homework 6

Due date: Wednesday, October 8, 2025.

Ex. 1. State Benefit Heuristic

Download the following Python modules implementing a D&D like game with one human player and multiple NPCs, like in Homework 2.
GM2.py
Player2.py

We will continue the implementation of an intelligent NPC for this game. For this homework, in the class Player, in the function play, the selected action and the opponent to attack if the action is 4 are obtained by a call to the function strategy_choice. For now, this function just makes a random choice of action and opponent, which is done now by the function with the same name. Replace that function call with a call to a function you define implementing your chosen strategy.  The goal is to implement an informed search for the best action by defining a heuristic that estimates the benefit of a state and chooses an action that attempts to optimize the outcome.

After the deadline, we will collect all the heuristics and have a tournament where they compete with each other. The winner gets 3 extra credit points. The second place gets 2 points, the third place 1 point, and the first loser 1 point. 

Changes to the rules defined in homework 2 and other tournament details:

Turn in:

Submit the modified file Player2.py to Canvas, Assignments, Homework 6.