IFB104编程讲解、Python编程调试、program程序辅导

- 首页 >> Python编程
IFB104 Building IT Systems
Semester 1, 2021
2021-03-29 1
Assessement Task 1: Client’s Briefing #2 Transcript
Hello, it’s your client again. Thanks for your submission to meet our first set of requirements.
I’ve forwarded it to our back-room boffins for their appraisal and you’ll receive an
appropriate reward as soon as possible, proportional, of course, to how precisely you’ve met
our specific requirements.
I’m 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 company is engaged in a new business called “contact tracing,” which requires us to understand
how entities move through the community and evolve into different variants as they
do so. This is why it was so important that you provided us with four copies of exactly the
same image—not four different images—and with each variant clearly distinguishable from
the others by two or more significant additions.
Associated with this briefing is a Python module that generates the data sets of interest to our
analysts. You’re welcome to study this code but do not change any of it.
[Displays data_generator module]
As you can see, it contains a single function which will be imported automatically by the
program template we gave you earlier. All you need to do is put the data_generator
module in the same folder as the Python program you have already developed. When you do
so the program’s behaviour will change as follows.
[Runs the demonstration solution with the data_generator module in place]
Our sample solution displays the same symbols on the right as before. But now the program
also displays the data set to be visualised in the programming environment’s shell window.
[Shows the data set displayed in the shell]
As you can see, the data set is a list of steps, each describing the way the entity of interest behaves.
There are three different kinds of steps:
1. The first is always a start step which gives us the grid coordinates where the entity of
interest was first observed. It also tells us which variant, A to D, was seen.
2. The second form of step is a change, which means the entity has evolved into a different
variation, which can be any of A to D, matching your four symbols.
3. All the other steps tell us which way the entity moves geographically, either North,
South, East or West, and by how many grid spaces. (Sometimes the number of spaces
is zero, in which case the entity remains stationary for that step.)
Each time you run the program a new data set is generated, so your code must be able to
work correctly for any possible data set of this form.
[Runs the program again]
This time we get a different data set, but it still begins with a start step and then contains various
moves and changes.
As you can imagine, trying to understand the behaviour of the entities we’re trying to trace
just by looking at this list of steps is very difficult for our data analysts. This is why we want
you to display it in a visual form.
IFB104 Building IT Systems
Semester 1, 2021
2021-03-29 2
Given any such data set your task is to draw symbols in the grid accordingly. Your program
must:
1. Start the entity in the given grid cell, using the given variant;
2. Change the image to the corresponding variant for each change step; and
3. Draw copies of the current variant moving the appropriate number of cells, in the given
direction, for each of the four kinds of move step.
To help you, each data set generated is printed to the shell window, as you have just seen.
More importantly, however, the data set is also returned as a list by function data_set,
which makes it available to your visualise function.
[Shows the call to data_set in the template’s main program]
This function call returns the same list that is printed in the shell window, so you will use the
value returned by this function as the basis for your visualisation.
To help you understand what’s required our boffins have extended their sample solution. I’ll
run their program a few times to show how it responds to different data sets.
[Runs several examples while pointing out the correspondences
between the steps in the data sets and the images displayed]
Your solution needs to do an equivalent job, using the symbols you created for us previously.
For your own purposes, please feel free to continue to improve your images if you like, but in
our appraisal of your work we won’t consider any changes made after the submission you
have just completed. Make sure your images fit exactly in the 100 by 100 pixel cells in the
grid as per our example. If you used differently sized images in the previous task you may
need to adjust them to fit.
We fully appreciate how difficult it is to work with such large data sets that keep changing.
To help you develop your program with some unchanging data sets, our boffins have therefore
incorporated a feature into the Python template that allows the data sets to be constrained.
If you add an integer argument to the call to function data_set in the main program
it will always generate the same data set. In the data_generator module we’ve listed
some such numbers you may find helpful because they produce very short data sets. Let’s
have a look at some examples.
[Shows the “seed” values documented in the data_generator module]
[Demonstrates how to use such values to cause the same
data set to be produced each time the program runs]
For instance, using seed value 139 or 174 produces a data set with no move or change steps at
all, so you can use it to test your ability to start in the right cell. Seed 49 produces a data set
with only one variant, so you could use this to test your program before you have implemented
the change feature. Seed 57 produces a short sequence of steps involving two variants only,
and so on. Feel free to try other seed values during development of your solution. (Our
boffins haven’t been able to find one that fills the entire grid yet, so let us know if you do.)
Of course, when you submit your finished program it must work for any random list that can
be generated by function data_set and you must not have any argument in the call to the
function.
[Shows the call to data_set with no argument]
IFB104 Building IT Systems
Semester 1, 2021
2021-03-29 3
When you’ve finished your program, please upload it to our company’s IT system as you did
before. We only need the single Python file. Don’t send us a copy of the data_generator
module; we already have it! Also, we welcome receiving, and encourage you to submit,
multiple drafts as you develop your code, as insurance against technical issues, natural
disasters, pandemics, and so on in Week 7.
That’s all for this set of requirements. Hmmm, but I’ve just noticed there’s a big empty space
on the left-hand side of the drawing canvas. I’ll check with our data analysts to see if they
want some extra information about the data set displayed there. I’ll let you know at the beginning
of Week 7.

站长地图