CS计算机代考程序代写 prolog 7. The Platypus game. (16 marks)

7. The Platypus game. (16 marks)

We have previously talked about running as large a tournament as possible with the
Platypus game. The way we will do this in this assignment is for each of your to run
a tournament of 2,500 machines. From these, you will report your top 10 machines
(see below for details). These 10 will then be part of a knock-out tournament to
determine the overall winner.

Before answering the questions below, do the following.

7

� Get your allocation of 2,500 machines. These will in a OneDrive directory
that will be shared with you. Once you have the link, look for a file in the
folder with your student number, i.e. if your student number is 7654321, look
for the file 7654321.pl. Store this somewhere that suits you with a name like
machines.pl for convenience.

� Open a new SWI-Prolog shell and consult both platypus.pl and machines.pl
(or whatever you called it). Then run the command below. This will classify
your list of machines into three categories, and will generate one file each cate-
gory named none.pl, reachable.pl and unreachable.pl, as per the descrip-
tion below. This will be in the directory specified by the results directory
predicate in platypus.pl; you can change this to something more convenient
for you if you like.

?- classify machines.

None The machine has no platypus state in the fourth row of columns 1-6
Reachable It is possible reach the platypus state from the kangaroo state
Unreachable It is not possible reach the platypus state from the kangaroo state

The point of this analysis is to work out whether it is possible for the machine
to terminate the game or not. An example of each class of machine is below.
In the first case, the machine cannot terminate the game, as it is not possible
for it to go from the start state (kangaroo) to the platypus state as there is
no transition that will move the machine into the platypus state.

Y G Y G Y G Y
K K E E W W P
g y y g y y g
Emu Emu Wombat Kangaroo Wombat Emu Kangaroo
w gg gg w w w gg

The second and third cases occur when there is indeed such a platypus state.
When it is possible to move from the kangaroo state to the platypus state
(depending on the cells on the tape of course), then the machine is classified
as reachable, as in the machine below. This is because it is possible to move
from the kangaroo state to the emu state (column 1 or 2), from the emu state
to the wombat state (column 3) and from the wombat state to the platypus
state (column 6).

Y G Y G Y G Y
K K E E W W P
g y y g y y g
Emu Emu Wombat Kangaroo Wombat Platypus Kangaroo
w gg gg w w w gg

It is also possible that even if such a platypus state exists, it is not possible
to move into that state from the kangaroo state. In this case, the machine is
classified as unreachable, as in the machine below. In this machine we can get
from the kangaroo state to the wombat state and vice-versa, but we can never
get to the emu state or platypus state from either of these.

8

Y G Y G Y G Y
K K E E W W P
g y y g y y g
Wombat Wombat Platypus Kangaroo Wombat Kangaroo Kangaroo
w gg gg w w w gg

Intuitively, machines classified as reachable are in some sense “genuine” with
the others being “imposters”. Accordingly, having separate tournaments for
each seems only fair.

� Run a tournament for each of the following classes of machines

– All 2,500 machines

– Only machines classified as reachable

– Only machines classified none or unreachable (ie all those not classified as
reachable).

To do this, you will first have to prepare a file containing only the machines
as above (the above classify machines command will more or less do this
for you). You will also need to use the command below, which will run the
tournament with all of the options below.

?- my tournament([competition]).

Variation Description
Tree 5 points for whenever either tree is reached
Green 2 points rather than 1 for changing green to yellow
Animal 1 point every time a change of animal occurs
Tiebreaker A random starting configuration is chosen with game length is 200

(a) For each of your tournaments, report the overall time taken, the top 10 ma-
chines (by ’football’ ranking), the overall number of wins and draws, and the
number of winless machines. How many machines were classified as none,
reachable and unreachable respectively? Report your results in a table as be-
low. (2
marks)

Class Number Percentage
Reachable

Unreachable
None

(b) Re-run your tournament of all machines, but this time you are to include 10
extra machines of your own choice. These should be different from any ma-
chines in your list already, but otherwise you are free to choose them however
you like.

You can use platypus.pl from Canvas (link here) to assist with this if you
wish. This will check whether your 10 added machines are ’legal’, and whether
or not they were already part of your allocation. To do this, consult platypus.pl
and machines.pl as above, and a third file extra.pl. Then run the command

?- check new.

This will then output whether your added machines are legal, and whether
they are already part of your allocation or not (and if they are, which ones are
already in their allocation).

9

https://rmit.instructure.com/files/14967767/download?download_frd=1

You should report where each of these 10 machines finish in the ’football’
ranking, and your reasons for choosing each of them. (2 marks)

(c) Were you surprised how your chosen 10 machines performed? What can you
conclude from this about high performing Platypus machines? If you had to
choose one machine to represent you in a tournament, what machine would it
be? Briefly explain your decision. (4 marks)

(d) In the previous assignment, your calculated the largest Platypus tournament
you can play on your machine in 4 hours, ie 4 × 60 × 60 = 14, 400 seconds.
This is of course for the ’standard’ 2-player game. 3-player and 4-player tour-
naments will of course take longer. Calculate the largest 3- and 4-player tour-
naments you can play on your machine in 4 hours. You may assume that a 3-
or 4-player match takes the same time as a 2-player one. You may also find
the following table useful (see the notes on 3- and 4-player tournaments for
how these are derived). (2 marks)

Players Matches required
2 n(n+ 1)/2
3 n(n+ 1)(n+ 2)/6
4 n(n+ 1)(n+ 2)(n+ 3)/24

(e) If the Platypus tournament were to be run again, what alterations would you
recommend? Some ideas are below; you can add others as you see fit. You
should have at least three suggestions. (6 marks)

� Once students are allocated their machines, they play a tournament amongst
these to find the best 10. These 10 then take on the best 10 from other
students. This could include the possibility of students choosing their 10
machines from their allocation or from the set of machines which are not
allocated to any student.

� The initial tape and scoring processes are changed from tournament to
tournament. These are announced in advance, and allow choices to be
made for which machines will be used.

� Non-player machines can be added. These are not competitors, but may
change the tape in ways that influence the game. Such machines would
not be allowed to terminate the game (presumably by allowing them tran-
sitions for a green cell with a platypus).

� When a player has a platypus on a green cell, the game does not halt,
but is “rebooted”, i.e. the tape reverts to its initial state, the player which
’halted’ the game gets a bonus or a penalty, and the machines involved
are changed in some way. This change could be swapping rows 3, 4 and
5 of column 1 and 2 (kangaroo), and the same for columns 3 and 4 (emu)
and 5 and 6 (wombat). There could be a maximum of say 5 reboots per
game.

� (insert your idea here!)

3 Submission

You should submit a PDF file, and all tournament.csv files from your tournaments. Do
not use a zip file. Just add attach all relevant files to the submission on Canvas. No

10

https://rmit.instructure.com/files/19412917/download?download_frd=1