COMP310 CA Task: ¡°The Quest¡±
1 Important Information
Grade Weight 15%
Learning Objectives Asssessed Understand the main application areas of agent-based solutions, and be
able to develop a meaningful agent-based system using a contemporary agent development platform.
2 Premise
Grodor the Goblin has stolen some of your items. In order for him to return them, he has sent you on a quest to search the forest and collect particular items of great value to him: a coin, a vase, and a gem. You need to collect these items, and then return to Grodor the Goblin and give them to him. Upon further consideration, you have decided that the forest is far too dangerous for you to be wandering around alone, so you have decided to employ an agent who will do the task for you.
Much too dangerous…
3 Brief
In the zip file entitled ¡°Forest.zip¡± there is a JASON project. In addition to other files which you needn¡¯t concern yourself with, It contains the following:
ForestEnv.java The forest environment that the Goblin and the Hero will occupy.
Forest.mas2j The JASON main file that will instruct JASON to use the correct environment and to establish
the correct agents
hero.asl The AgentSpeak file which contains the Hero agent goblin.asl The AgentSpeak file which contains the Goblin agent
1
Your task is to write the Hero agent, within the hero.asl. The agent task is described below, followed by details of the environment given, with actions and percepts available to you. You are not to change the environment file (forestEnv.java), nor the forest.mas2j file, nor the goblin.asl file- you should make changes ONLY to the hero.asl file.
3.1 TASK: Write the Hero Agent
The hero agent is to move through the environment in a systematic way. He should collect a vase, coin, and gem. Upon finding these three items, he should then move to where the goblin is, and then drop the items in that position. If he does not find all three times, then he should not visit the goblin.
A rule has been placed in hero.asl for you. This rule is at(P). This rule will state whether it is true that the Hero agent is in the same position as the agent named in the parameter P . For example, if there is an agent named philby within the system, then adding the achievement goal !at(philby) will instruct the hero agent to achieve the state of affairs where he is at the same position in the grid as the agent philby. If you wish to use this rule, you must of course define a plan which is applicable.
Your code within the hero.asl file should contain your name and student ID at the top, and it should be well commented – it is very important to convey your understanding through these comments.
3.2 The Goblin Agent
The goblin agent (given for you in goblin.asl) is waits in his given position (this is defined by the environment), and he will stash an item that is dropped in his location, should it be a coin, gem, or vase.
3.3 The Forest Environment
The forest environment consists of a 8×8 grid, each square representing the location within the forest. Within several squares of the forest there will be items that the Hero Agent can choose to pickup, if so desired.
There may be a teleporter present (this is a square labelled as T ) in the environment which teleports the hero to a random spot in the forest.
The environment has several percepts and actions that can be utilised by the agents. These are:
Percepts
pos(hero, x, y) The hero agent is at the position (x,y). pos(goblin, x, y) The goblin agent is at the position (x,y) gem(hero) The hero is at a position that contains a gem coin(hero) The hero is at a position that contains a coin vase(hero) The hero is at a position that contains a vase gem(goblin) The goblin is at a position that contains a gem coin(goblin) The goblin is at a position that contains a coin vase(goblin) The goblin is at a position that contains a vase hero(coin) The hero is currently holding a coin
hero(vase) The hero is currently holding a vase hero(gem) The hero is currently holding a gem
Actions
next(slot) The hero will advance his position to the next one in the forest. This is on a left-to-right, top-to- bottom sequence.
move towards(x,y) The hero will move towards the location stated.
pick(coin) Hero will pick up the coin object in the current position, if there is one.
drop(coin) Hero will drop the coin object, should they have one, in the current position. The hero will then advance to the next position.
2
stash(coin) The Goblin will pick up the coin object that is in his current position and stash it. There is no percept to signal that the goblin has stashed an item.
pick(gem) Hero will pick up the gem object in the current position, if there is one.
drop(gem) Hero will drop the gem object, should they have one, in the current position. The hero will then
advance to the next position.
stash(gem) The Goblin will pick up the gem object that is in his current position and stash it. There is no percept to signal that the goblin has stashed an item.
pick(vase) Hero will pick up the vase object in the current position, if there is one.
drop(vase) Hero will drop the vase object, should they have one, in the current position. The hero will then
advance to the next position.
stash(vase) The Goblin will pick up the vase object that is in his current position and stash it. There is no percept to signal that the goblin has stashed an item.
4 Grading
Your hero agent should do as is described above. Further marks can be obtained for particularly elegant or efficient solutions. 70% of marks are allocated for the functionality of your agent.
Your code should be well commented, so that it is clear to the marker that you understand what your code is doing – it is very important to convey your understanding of the agent and how they interact with the environment within these comments. Sample comments have been given for you in hero.asl. 25% of marks are allocated for the good and clear commenting of your code.
Your code should be nicely laid out, in a consistent manner. 5% of marks are allocated for well laid out code.
Your file should contain your name and student number at the top (A penalty of 5 marks will be imposed if your details are not present at the top of the file).
5 Submission
You are to submit the asl file for your hero agent. This is to be called hero.asl. Your file is to be submitted to CANVAS on the assignment page. Submissions are to be by the deadline stated at the start of this document.
3