Can you complete this assignment before the 8th September 11pm (australian time)???
Assignment1a-TreasureMap IFB104 Building IT Systems Semester 2, 2018 Assignment 1, Part A: Treasure Map (20%, due 11:59pm Sunday, September 9th, end of Week 7) Overview This is the first part of a two-part assignment. This part is worth 20% of your final grade for IFB104. Part B will be worth a further 5%. Part B is intended as a last-minute extension to the assignment, thereby testing the maintainability of your code, and the instructions for completing it will not be released until Week 7. Whether or not you complete Part B you will submit only one file, and receive only one assessment, for the whole 25% assignment. Motivation One of the most basic functions of any IT system is to process a given data set to produce some form of human-readable output. This assignment requires you to produce a visual im- age by following instructions stored in a list. It tests your abilities to: • Process lists of data values; • Produce maintainable, reusable code; • Design a solution to a repetitive computational problem; and • Display information in a visual form. In particular, you will need to think carefully about how to design reusable code segments, via well-planned function definitions and the use of repetition, to make the resulting program concise and easy to understand and maintain. Goal The short-lived Pokémon Go craze temporarily reignited interest in old-fashioned treasure hunts. In this assignment you are required to use Python’s Turtle graphics module to draw a map summarising the outcomes of such a treasure hunt. To do so you must follow a given set of instructions, provided as a Python list, to place “tokens”, representing treasures found, in a square grid defining the search area. Most importantly, the path followed will be generated randomly, so your solution must be sufficiently general that it can work correctly for any pos- sible path through the grid. Resources provided A template Python 3 program, treasure_map.py, is provided with these instructions. When run it creates a drawing canvas and displays a simple background image on which you will follow the instructions to draw tokens in the locations where they are found during the imaginary treasure hunt. You have a free choice in the design of the individual tokens. The default image drawn by running the provided Python template appears as shown overleaf. It consists of a simple grid representing the search field, and space for a legend in which you will describe the theme and tokens you have designed. IFB104 Building IT Systems Semester 2, 2018 Note that in this Turtle canvas the “home” coordinate (0, 0) is at the bottom left, rather than the usual default of the canvas’ centre. The canvas contains a grid representing the area ex- plored during the treasure hunt. Each of the grid’s squares measures 100 ´ 100 pixels. The large blank space on the right is where the legend explaining the meaning of each of your to- kens will be drawn. Your task is to extend this template file so that it can draw tokens in the grid to indicate “treasures” found by following a provided path through the grid. To do so you must design five entirely distinct tokens, each of which can be drawn in any grid square (and in the leg- end). Your code will consist of a function called follow_path, and any auxiliary func- tions you define to support it. This function takes a single argument, which is a list of in- structions specifying where to start the treasure hunt and which steps to follow. This list of instructions is created by a provided function called random_path which randomly gener- ates the sequence of instructions, so your code must work correctly for any possible path through the grid! Data format The random_path function used to assess your solution returns a list of instructions repre- senting the steps taken during the treasure hunt. Each of the instructions is expressed as a triple (a sublist of length three). The instructions have two different forms. The first instruc- tion in the path is always of the form ['Start', location, token_number] This is coordinate (0, 0) IFB104 Building IT Systems Semester 2, 2018 where the location may be any one of five character strings, 'Top left', 'Top right', 'Centre', 'Bottom left' or 'Bottom right', and the token_number is an integer from 0 to 4, inclusive. This instruction tells us in which grid square to begin our treasure hunt and the token that we find there. (Every square we visit yields a token, including the first.) For instance, an initial instruction ['Start', 'Bottom right', 3] tells us that our treasure hunt begins in the grid’s bottom-right square and that we should draw a token of type 3 there. The remaining instructions, if any, are all of the form [direction, number_of_squares, token_number] where the direction may be 'North', 'South', 'East' or 'West', the num- ber_of_squares is a positive integer, and the token_number is an integer from 0 to 4, inclu- sive. This instruction tells us where to go from our current location in the grid and the token to draw in the target square. For instance, an instruction ['South', 3, 2] tells us that the next step is to move down by three grid squares and to draw a token of type 2 there. In addition to the random_path function, the template file also contains a number of “fixed” data sets. These are provided to help you develop your code, so that you can work with a known path while debugging your code. However, the “fixed” paths will not be used for assessing your solution. Your follow_path function must work correctly for any path randomly generated by function random_path. Designing the tokens To complete this assignment you must design five entirely distinct tokens representing “treasures” found during the hunt. The five tokens must each fit precisely in a 100 ´ 100 pixel square, must be drawn using Turtle graphics primitives only, must be of a reasonable degree of complexity, and must all be part of some common theme. You have a free choice of theme and are strongly encouraged to be imaginative! Some possible themes you may consider are: • Cartoon or comic characters • TV or movie characters • Sporting teams • Businesses (banks, restaurants, IT companies, etc) • Computer or board games (e.g., Monopoly tokens) • Internet or cloud service providers • Geographical sites (cities, countries or tourist attractions) • Vehicles (cars, boats, planes, etc) • Household objects • Or anything else suitable for creating five distinct and easily-identifiable “tokens” IFB104 Building IT Systems Semester 2, 2018 Illustrative example To illustrate the requirements we developed a solution which uses classic DC Comics super- heroes as its theme. (Don’t copy our example! Develop your own idea!) We wrote Turtle graphics code that could draw the following five tokens, each representing a well-known su- perhero. Each of these images is exactly 100 pixels high or wide, so will fit perfectly into one of the grid squares. In our solution we use these symbols as our “tokens”, with Batman being To- ken 0, Superman being Token 1, and so on, up to Green Lantern as Token 4. For your solu- tion you need to similarly design five tokens for use as Token 0 to Token 4, inclusive. From this basis, our implementation of the follow_path function can follow any plan generated by function random_path, drawing tokens at each step. For instance, consider the following short path: [['Start', 'Top left', 2], ['South', 6, 0], ['East', 4, 2], ['West', 2, 1], ['North', 3, 1], ['West', 1, 3]] IFB104 Building IT Systems Semester 2, 2018 This requires us to start in the top-left square of the grid and draw Token 2 there, which in our case is Wonder Woman. Next we go six squares south and draw Token 0, which is Bat- man. Then we go four squares east and draw Token 2, i.e., Wonder Woman again. We then reverse direction and go two squares west and draw Token 1, Superman. Next we go three squares north and draw Token 1 again. The final step is to go one square west and draw To- ken 3, The Flash. The resulting map of the treasure hunt’s discoveries in the grid is shown below. Notice that each token is of the appropriate style and fits perfectly into the correct square ac- cording to the instructions in the path provided. As a more complex example, consider the following much longer randomly-generated path. [['Start', 'Centre', 3], ['North', 2, 1], ['South', 3, 2], ['South', 1, 1], ['West', 2, 0], ['East', 4, 1], ['West', 3, 1], ['West', 2, 4], ['North', 5, 2], ['South', 6, 4], ['East', 2, 0], ['West', 1, 4], ['North', 4, 2], ['East', 3, 3]] In this case we begin in the centre square with Token 3, The Flash. We then go: two squares north to draw Token 1, Superman; three squares south to draw Token 2, Wonder Woman; IFB104 Building IT Systems Semester 2, 2018 another square south to draw Token 1 again; two squares west to draw Token 0, Batman; and so on until all the specified tokens are drawn. The resulting image appears below. As well as drawing tokens in the grid according to a provided path, the final requirement for this part of the assignment is to complete the treasure map with a legend which clearly de- scribes the chosen theme and the meaning