Question: ITD 1 0 4 Building IT Systems C 1 , 2 0 2 4 Portfolio 1 Assignment: RACE TO THE FINISH LINE USING PYTHON code

ITD104 Building IT Systems
C1,2024
Portfolio 1 Assignment: RACE TO THE FINISH LINE USING PYTHON code
Clients Briefing #2 Transcript
Hello, its your client again. Thanks for following our first set of requirements.
Im now authorised to entrust you with the data sets we need visualised. Time is of the
essence because we need your finished program by the end of Week 7.
Our organisation is very interested in the way objects move competitively to reach a goal and
expend energy as they do so. The rectangular grid created by the program we gave you
represents spaces on some sort of racetrack. The objects will be represented by your
characters.
[Runs demo from the Part 1 briefing]
Recall that the characters cannot cross the boundaries of the grid under any circumstances.
Another boundary of interest is the finish line which is marked on the grid as a thick red line
on the right edge of the grid. The two special dots mark the starting blocks for the two
characters in the race to the finish line. The characters should appear here (and in the legend)
before the race starts. That was part of the clients first briefing which you should have by
now completed.
Our data analysts have now created a Python module called AT1_data_source, which you
can find accompanying this briefing. Youre welcome to study this code but do not change any
of it.
[Displays the data_source module]
If you put this module into the same folder as the original Python template we gave you, it will
cause the program to generate a new data set each time it is run.
[Runs the demonstration solution a few times with the data_source module in place]
As you can see a different data set is printed to the shell window each time the program is
run. These are the data sets of interest to our analysts, but in this form theyre very hard to
understand. Its not immediately obvious from the sequence of individual actions where the
objects go, and whether or not they will get to the finish line, or if indeed there will be an
attempt to escape the bounds of the racetrack entirely! Your job is to create a visual
representation of the behaviours encoded in the data sets, using the two drawings you have
already created for us, so that we can see clearly what each object does.
In each data set there are potentially two different types of information:
1. The first is always an initialisation step which tells us the energy levels each object
starts with.
2. The remaining data (if any) are move instructions that tell us how a particular
object is to move. Each instruction identifies:
the object: either A for the first character, or B for the second; and
the direction of the next cell it is to move to. There are only three possibilities:
Forward,Up or Down.
To help you understand whats required our back-room boffins have extended their sample
solution. Ill run their program a few times to show how it responds to different data sets.
[Runs an example in which the objects are shown in their initial states, but do not move 1]
In this case the data set only contains the initialisation action. Our solution therefore displays
the characters on their starting blocks and in the legend. Lets try again.
[Runs example in which both objects move but not very far2]
This time the instructions were all to move forward towards the finish line, and resulted in
both characters reaching column D in their original rows when there are no more instructions
and the race finishes.
In this case, all the instructions were able to be carried out. However, the characters may not
always be able to follow the instructions because:
they cannot move outside the grid;
they cannot move at all if they run out of energy; and
the race finishes when one of the characters reaches the finish line.
[Runs an example in which a character attempts to run off the race track3]
Our boffins have added an additional feature to our demo. To help keep track of which
instruction has been processed, they have written the instruction number in the bottom left
hand corner of the character.
You can see from the visualisation that there is no drawing numbered 9. If you look at the
dataset you will see that instruction 9 required the first character to move up. As it was
already at the top boundary after instruction 8, this move was not legal and was therefore
ignored, and processing continued with the next move instruction.
[Runs an example where character draws over the top of occupied cell 4]
When a character moves into a grid cell where it or the other character has been previously,
its image is simply drawn over the first. The instruction numbers help us see in this case that
from instruction 2, the second character is moved forward, then up and down, drawing over
the top of itself in the process.
[Runs an example where character runs out of energy 5]
Here, the second character makes a great effort to get to the finish line, but ru

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!