Review

Due:
5:00am, Monday November 25, 2024

Description

There is a file in the assignment directory named wumpus.pl. This is a simulator for the Wumpus World. Your solution to this assignment can use the following predicates:

Complete the Prolog file named run_trials.pl by defining a predicate named run_trials(Actions, Score, Iterations) that initializes and repeatedly restarts the Wumpus World, searching for a solution. A successful solution is one where the agent leaves the cave with the gold piece. If a solution is found, the Actions is bound to a list of actions, otherwise it is the empty list. The Score is bound to the cumulative agent score The Iterations is bound to the number of restarts.

The run_trials should call the following agent predicates:

There are some sample agents in the agents.pl file that you can use for testing purposes.

Here is an approximation to the algorithm that you should implement (using functions instead of predicates):

function Run-Trials out: Actions, Score, Iterations
    initialize()
    init_agent()
    for i = 1 to max_agent_trials
        percept := restart()
        restart_agent()
        Actions := empty list
        for j = 1 to max_agent_actions
            action := run_agent(percept)
            append action to Actions
            percept := execute(action)
            if goal reached
                Score := Score + agent_score()
                return Actions, Score, i
            if agent is dead or left cave
                break
        Score := Score + agent_score()
    return empty list, Score, max_agent_trials

Turning in the Assignment

To submit your assignment, create a zip file named p5.zip of a DIRECTORY named p5 containing the following files:

Then submit that file to the appropriate folder on D2L.