Table of Contents

Assignment #1 – Programming in Jason

News

2015-11-11: The `head` belief contains a bug (thanks to Ondřej Hubáček for pointing that out). If you want to use it, please use the following implementation:

head([],false).
head([X|List],X).
Additionally, you may be interested in the list of internal actions available (those starting with a dot). You can check the Javadoc of Jason's standard library here.

2015-11-10: New public scenario was released. Check downloads section.

Assignment

A group of four miners is facing an uneasy task. It is deployed to a gold mine and the miners have to collect all gold stones scattered around the mine and bring them all to one of the company depots. The company is saving money wherever it can and the stones they have to carry are becoming more and more heavy. At this point, these stones have become that heavy that no single one of them can lift them alone. Every time a miner wants to lift a stone, he must call some friend to help him. Will you help them to collect all the gold stones in time?

Scenario 1: On day one, they were quite lucky. They have arrived in a tidy gold mine and they may go wherever they want. The only problem here is that the work is still in progress and new gold stones appear from time to time. Whenever a gold stone appears somewhere in the mine, miners must be able to find it and bring it to a depot. If the miners do succeed, they will be awarded 2 points.

Scenario 2: The mine they visit on the second day is also a tidy one. The situation on day two might seem even more plausible for them. The hard digging work has already terminated and the miners just have to collect those gold stones that are present in the mine at the time they entered it (i.e. no gold stones will appear throughout the time). Unfortunately the dawn is quite close and miners must hurry to get everything done in time. In case they succeed they will get 2 points.

Scenario 3: The next day, they arrived in a different mine. As soon as they arrived, they realized that several machines are still located on the site (1×1 obstacles). Luckily for them, there is a lot of free space around the machines — if the miners want, they can form a square formation (2×2) and they can keep this formation while walking around the mine. In case of the success, miners will be awarded 2 points.

Scenario 4: The situation is getting harder and harder. The next mine they visit is divided into two rectangular submines and a pair of miners is deployed into each one of them. They might be used to work with just one colleague — but this time they have to forget about their habits and find a new colleague. At the end of their shift, miners will recieve 2 points.

Scenario 5: On day five, they are visiting exactly the same mine as on the day 3 — and it is also in the same mess as it used to be. However in the meanwhile, managers have decided that the division of mines into two rectangular submines was a great success and thus implemented it even here. Successful miners will get 1 points.

Competition: The group of the miners was proven to be highly competent and thus the managers have decided to send them to a mining competition. Five fastest groups of miners will be awarded another 1 point.

Mining research The conditions in the mining industry are getting worse every day. If you think your group of miners can overcome even greater difficulties, they may be awarded some extra points (after prior discussion with the tutor).

Available actions:

do(down), do(up), do(left), do(right), do(skip), do(pick), do(drop)

Available percepts:

cell(X,Y,gold), cell(X,Y,ally), cell(X,Y,depot), cell(X,Y,obstacle), pos(X,Y), carrying_gold, name(N), gsize(_,W,H)

Rules:

Download

Jason project

Additional scenarios (2015-11-10)

Assessment

Note: The scenarios used for evaluation purposes might not be identical to the ones present in the public bundle.

Submitting your solution

Create a zip archive containing miner.asl file and your report in PDF format and submit it to the upload system. If you do not have access to the upload system, please send your files to karel.horak@agents.fel.cvut.cz.

FAQ

Q: Are the actions in the environment executed synchronously?

A: The do() actions take the same time to execute in the environment, but they are not executed synchronously by all the agents.