Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python 3 Motivation One of the most basic functions of any IT system is to proce

ID: 3873027 • Letter: P

Question

Python 3

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 image by following instructions stored in a list. It tests your abilities to: Process lists of data values Design a solution to a computational problem; Display information in a visual form; and Produce maintainable, reusable code. Goal Advertising billboards are a familiar, if annoying, feature of the urban landscape. Today many such billboards are electronic, although there are still plenty of traditional ones consisting of several rectangular sheets of paper pasted onto a wooden backing board. REGEST R BT BT primesig

Explanation / Answer


Goal
Jigsaw puzzles are a familiar, traditional pastime. In this assignment you are required to develop a Python program which processes data stored in a list to display an attempt to solve a jigsaw puzzle consisting of four distinct pieces. To do so you will need to use basic Python features and the Turtle graphics module. You must design four interlocking puzzle pieces which, when assembled in the correct order, produce a single picture. The picture must be non-trivial, and must span all four pieces, but otherwise you have a free choice of what to draw, e.g., cartoon, game or science fiction characters, household objects, corporate or sporting logos, buildings or vehicles, animals or pets, landscapes, etc. To position the pieces you must develop your code so that they can be drawn in different locations on the screen. A skeletal Python program,
jigsaw_puzzle.py is provided with these instructions which draws:


A four-place template for putting pieces whose position has been chosen; and

A box to contain unused pieces. It also contains several data sets, in the form of lists, to guide your drawing of the attempted solution to the puzzle. The lists contain instructions in two or three part

The identity of the jigsaw puzzle piece to draw, from ‘
PieceA’ to ‘Piece D


The place where the piece must be drawn, either in one of the four template locations, ‘Topleft’, ‘Topright’, ‘Bottomleft’ or ‘Bottomrigh’, or in the box of unused pieces, as indicated by ‘Inbox’.

An optional mystery value, ‘X’, whose purpose will be revealed only in the second part of the assigment. All four jigsaw pieces must have a different shape, with protruding “tabs” that interlock into corresponding “blanks” in other pieces, just like a physical jigsaw puzzle. When assembled correctly the four pieces must form a perfect square. The picture produced by assembling the puzzle correctly must be non-trivial, and must span all four pieces. For instance, four separate images, one per piece, would be unacceptable. Although it’s difficult to generalise the artistic requirements for this assignment, given the wide range of pictures that could be chosen, it’s expected the assembled image would involve several different shapes of several different colours and the resulting picture must be immediately recognisable. You are required to use Turtle graphics to draw the pieces in the places specified by any of the given data sets, and your code should work for any other similar data sets in the same format. Furthermore, you must provide your own data set for the correct solution to your particular puzzle


Requirements and marking guide
To complete this task you are required to extend the providedjigsaw_puzzle.py
Python file by completing functiondraw_attempt
so that it can draw jigsaw puzzle pieces at the places specified by a data set provided as its single parameter. Your code must work for all the supplied “attempt” data sets and any other data set in the same format. You must also provide your own “solution” data set that completes your puzzle correctly. Your submitted solution will consist of a single Python file, and must satisfy the following criteria. Percentage marks available are as shown.

1.Drawing four distinct puzzle pieces
Your program must be able to drawfour distinct puzzle pieces, each of adifferent shape.The basic shape of each piece must be a 300
300 pixel square, but they can have any number of “tabs” that protrude by up to 100 pixels (and corresponding indented “blanks”). When assembled correctly, as yourprovided solution, all of the pieces mustfit together preciselyas a 600600 pixel square in the provided template, with no parts overlapping or sticking out.



2.Drawing a picture in four parts
Each of your puzzle pieces must contain one piece of a single complete picture. Each piece must contain a
different, non-trivial part of the overall pictureThe whole picture must span all four pieces. When assembled correctly, as per your provided solution, the parts of the complete picture mustalign correctlyThe picture should be clearly recognisable and of a reasonable degree of complexity, involving multiple shapes and colours.

3.Relocating puzzle pieces
Your code must be capable of drawing each of the four puzzle piecesat any of the five marked places, either in the four-place jigsaw template on the left or in the unused pieces box on the right. The pieces must preserve their appearance no matter where they are drawn and must fit perfectly into the marked places (although “tabs” may stick out, of course). Your solution for relocating the pieces must work forall of the provided data sets andany other data setsin the same format.

4.Providing a solution to the puzzle
You must provide a“solution” list , using the same data format as the “attempt” data sets, whose contents tell us how to solve your particular puzzle correctly.
When yourdraw_attempt function is called with this list as its argument your program should draw a perfect solution to the puzzle. Your solution list should
not contain the optional third value, ‘X’, in any of its elements. NB: If you do not provide a solution list we will not be able to assess how well your pieces fit together and you cannot receive full marks for Criteria 1 and 2 above.

5.Code quality and presentation
Your program code must be presented in a professional manner. See the coding guidelines in the IFB104 Code Presentation Guide (on Blackboard under Assessment ) for suggestions on how to achieve this. In particular, given the obscure and repetitive nature of the code needed to draw complex images using Turtle graphics, each significant code segment must be clearly commented to say what it does, e.g., “Draw Barney’s right eye”, “Draw Barney’s left ear”, .

6.Extra feature
Part B of this assignment will require you to make a ‘last-minute extension’ to your solution. The instructions for Part B will not be released until just before the final deadline for Assignment