COMP9021作业代做、Python程序语言作业调试、syntax留学生作业代做、Python课程设计作业代写代写Python编程|代做留学生Process

Assignment 2COMP9021, Trimester 1, 20191. General matter1.1. Aims. The purpose of the assignment is to: design and implement an interface based on the desired behaviour of an application program; practice the use of Python syntax; develop problem solving skills.1.2. Submission. Your program will be stored in a file named tangram.py. After you have developed andtested your program, upload it using Ed (unless you worked directly in Ed). Assignments can be submittedmore than once; the last version is marked. Your assignment is due by April 28, 11:59pm.1.3. Assessment. The assignment is worth 10 marks. It is going to be tested against a number of input files.For each test, the automarking script will let your program run for 30 seconds.Late assignments will be penalised: the mark for a late submission will be the minimum of the awarded markand 10 minus the number of full and partial days that have elapsed from the due date.1.4. Reminder on plagiarism policy. You are permitted, indeed encouraged, to discuss ways to solve theassignment with other people. Such discussions must be in terms of algorithms, not code. But you mustimplement the solution on your own. Submissions are routinely scanned for similarities that occur when studentscopy and modify other people’s work, or work very closely together on a single implementation. Severe penaltiesapply.122. BackgroundThe game of tangram consists in creating shapes out of pieces. We assume that each piece has its own colour,different to the colour of any other piece in the set we are working with. Just for reference, here is the list ofcolours that are available to us (you will not make use of this list):https://www.w3.org/TR/2011/REC-SVG11-20110816/types.html#ColorKeywordsA representation of the pieces will be stored in an .xml file thanks to a simple, fixed syntax.2.1. Pieces. Here is an example of the contents of the file pieces_A.xml, typical of the contents of any file ofthis kind (so only the number of pieces, the colour names, and the various coordinates can differ from one suchfile to another–we do not bother with allowing for variations, in the use of space in particular).Opened in a browser, pieces_A.xml displays as follows:Note that the coordinates are nonnegative integers. This means that the sets of pieces we consider rule outthose of the traditional game of tangram, where √2 is involved everywhere...We require every piece to be a convex polygon. An .xml file should represent a piece with n sides (n ≥ 3)by an enumeration of n pairs of coordinates, those of consecutive vertices, the first vertex being arbitrary, andthe enumeration being either clockwise or anticlockwise.The pieces can have a different orientation and be flipped over. For instance, the file pieces_AA.xml whosecontents is3and which displays asrepresents the same set of pieces (the fact that the latter appear as smaller than the former is just due to thedifferent scaling of the included pdf’s; the sizes of the pieces are actually the same in terms of the coordinatesof their vertices).The pieces can overlap, but that does not concern us. In practice, we will just use representations where thepieces do not overlap as that allows us to visualise the pieces properly when we open the corresponding .xmlfile, but it is just for convenience and irrelevant to the tasks we tackle.2.2. Shapes. A representation of a shape is provided thanks to an .xml file with the same structure, storingthe coordinates of the vertices of just one polygon.The file shape_A_1.xml whose contents isand which displays asis such an example. The file shape_A_2.xml whose contents is...L 50 130 L 50 90 L 10 90 L 10 50 L 50 50 z fill=brown/>and which displays as4is another such example.Contrary to pieces, shapes are not assumed to be convex polygons. Still they are assumed to be simplepolygons (the boundary of a simple polygon does not cross itself; in particular, it cannot consist of at least 2polygons that are connected by letting two of them just “touch” each other at one of their vertices–e.g., tworectangles such that the upper right corner of one rectangle is the lower left corner of the other rectangle; thatis not allowed).Whereas you will have to check that the representation of the pieces in an .xml file satisfies our constraints,you will not have to do so for the representation of a shape; you can assume that any shape we will be dealingwith satisfies our constraints.2.3. Tangrams. The first shape can be built from our set of pieces, in many ways. Here is one, given by thefile tangram_A_1_a.xml whose contents isand which displays as follows.Here is another one, given by the file tangram_A_1_b.xml whose contents is5and which displays as follows.The second shape can also be built from our set of pieces, in many ways. Here is one, given by the filetangram_A_2_a.xml whose contents isand which displays as follows.Here is another one, given by the file tangram_A_2_b.xml whose contents isand which displays as follows.673. First task (3 marks)You have to check that the pieces represented in an .xml file satisfy our constraints. So you have to checkthat each piece is convex, and if it represents a polygon with n sides (n ≥ 3) then the representation consistsof an enumeration of the n vertices, either clockwise or anticlockwise. Here is the expected behaviour of yourprogram.$ python3...>>> from tangram import *>>> file = open(pieces_A.xml)>>> coloured_pieces = available_coloured_pieces(file)>>> are_valid(coloured_pieces)True>>> file = open(pieces_AA.xml)>>> coloured_pieces = available_coloured_pieces(file)>>> are_valid(coloured_pieces)True>>> file = open(incorrect_pieces_1.xml)>>> coloured_pieces = available_coloured_pieces(file)>>> are_valid(coloured_pieces)False>>> file = open(incorrect_pieces_2.xml)>>> coloured_pieces = available_coloured_pieces(file)>>> are_valid(coloured_pieces)False>>> file = open(incorrect_pieces_3.xml)>>> coloured_pieces = available_coloured_pieces(file)>>> are_valid(coloured_pieces)False>>> file = open(incorrect_pieces_4.xml)>>> coloured_pieces = available_coloured_pieces(file)>>> are_valid(coloured_pieces)FalseNote that the function are_valid() does not print out True or False, but returns True or False.84. Second task (3 marks)You have to check whether the sets of pieces represented in two .xml files are identical, allowing for piecesto be flipped over and allowing for different orientations. Here is the expected behaviour of your program.$ python3...>>> from tangram import *>>> file = open(pieces_A.xml)>>> coloured_pieces_1 = available_coloured_pieces(file)>>> file = open(pieces_AA.xml)>>> coloured_pieces_2 = available_coloured_pieces(file)>>> are_identical_sets_of_coloured_pieces(coloured_pieces_1, coloured_pieces_2)True>>> file = open(shape_A_1.xml)>>> coloured_pieces_2 = available_coloured_pieces(file)>>> are_identical_sets_of_coloured_pieces(coloured_pieces_1, coloured_pieces_2)FalseNote that the function identical_sets_of_coloured_pieces() does not print out True or False, butreturns True or False.95. Third task (4 marks)You have to check whether the pieces represented in an .xml file are a solution to a tangram puzzle representedin another .xml file. Here is the expected behaviour of your program.$ python3...>>> from tangram import *>>> file = open(shape_A_1.xml)>>> shape = available_coloured_pieces(file)>>> file = open(tangram_A_1_a.xml)>>> tangram = available_coloured_pieces(file)>>> is_solution(tangram, shape)True>>> file = open(tangram_A_2_a.xml)>>> tangram = available_coloured_pieces(file)>>> is_solution(tangram, shape)FalseNote that the function is_solution() does not print out True or False, but returns True or False.本团队核心人员组成主要包括BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected] 微信:codehelp

你可能感兴趣的:(COMP9021作业代做、Python程序语言作业调试、syntax留学生作业代做、Python课程设计作业代写代写Python编程|代做留学生Process)