COMP9021程序 写作、program程序 写作、Python程序

” COMP9021程序 写作、program程序 写作、Python程序Assignment 2COMP9021, Trimester 2, 20201. General matters1.1. Aim. The main purpose of the assignment is to: develop your problem solving skills; write a medium sized Python program; design and implement an interface based on the desired behaviour of an application program; work with classes.1.2. Submission. Your programs will be stored in a file named frieze.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 August 9, 8:00pm.1.3. Assessment. The assignment is worth 13 marks. It is going to be tested against a number of inputs. Foreach 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 13 minus the number of full and partial days that have elapsed from the due date.The outputs of your programs should be exactly as indicated.1.4. Reminder on plagiarism policy. You are permitted, indeed encouraged, to discuss ways to solve theassignment with Oher 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 peoples work, or work very closely together on a single implementation. Severe penaltiesapply.1COMP9021作业 写作、program作业 写作2. General presentationYou will design And implement a program that will check whether some numbers, stored in a file, represent a particular coding of a frieze, and either display the period of the pattern of the frieze and the transformations that keep it invariant,based on a result that classifies friezes into 7 groups of symmetries, or output some Latex code in a file, from which a pictorial representation of the frieze can beproduced.The representation of a frieze is based on a coding with numbers in the range 0 15, each such number n beingassociated with a particular Point p such that if the rightmost digit of the representation of n in base 2 is equal to 1 then p is to be connected to itsnorthern neighbour: if the second rightmost digit of the representation of n in base 2 is equal to 1 then p is to be connectedto its north-eastern neighbour: if the third Rightmost digit of the representation of n in base 2 is equal to 1 then p is to be connectedto its eastern neighbour: if the fourth rightmost digit of the representation of n in base 2 is equal to 1 then p is to be connectedto its south-eastern neighbour:3. Examples3.1. First example. The file frieze_1.txt has the following contents.Here is a Possible interaction:$ python3… from frieze import * frieze = Frieze(frieze_1.txt) frieze.analyse()Pattern is a frieze of period 15 that is invariant under translation only. frieze.display()The effect of executing frieze.display() is to produce a file named frieze_1.tex that can be given asargument to pdflatex to produce a file named frieze_1.pdf that views as follows.33.2. Second example. The file frieze_2.txt has the following contents.Here is a possible interaction:$ python3… from frieze import * frieze = Frieze(frieze_2.txt) frieze.analyse()Pattern is a frieze of period 12 that is invariant under translationand vertical reflection only. frieze.display()The effect of executing frieze.display() is to produce a file named frieze_2.tex that can be given asargument to pdflatex to produce a file named frieze_2.pdf that views as follows.43.3. Third example. The file frieze_3.txt has the following contents.Here is a possible interaction:$ python3… from frieze import * frieze = Frieze(frieze_3.txt) frieze.analyse()Pattern is a frieze of period 3 that is invariant under translationand horizontal reflection only. frieze.display()The effect of Executing frieze.display() is to produce a file named frieze_3.tex that can be given asargument to pdflatex to produce a file named frieze_3.pdf that views as follows.53.4. Fourth example. The file frieze_4.txt has the following contents.Here is a possible interaction:$ python3… from frieze import * frieze = Frieze(frieze_4.txt) frieze.analyse()Pattern is a frieze of period 6 that is invariant under translationand glided horizontal reflection only. frieze.display()The effect of executing frieze.display() is to produce a file named frieze_4.tex that can be given asargument to pdflatex to produce a file named frieze_4.pdf that views as follows.63.5. Fifth example. The file frieze_5.txt has the following contents.Here is a possible interaction:$ python3… from frieze import * frieze = Frieze(frieze_5.txt) frieze.analyse()Pattern is a frieze of period 8 that is invariant under translationand rotation only. frieze.display()The effect Of executing frieze.display() is to produce a file named frieze_5.tex that can be given asargument to pdflatex to produce a file named frieze_5.pdf that views as follows.73.6. Sixth example. The file frieze_6.txt has the following contents.Here is a possible interaction:$ python3… from frieze import * frieze = Frieze(frieze_6.txt) frieze.analyse()Pattern is a frieze of period 4 that is invariant under translation,glided horizontal and vertical reflections, and rotation only. frieze.display()The effect of executing frieze.display() is to produce a file named frieze_6.tex that can be given asargument to pdflatex to produce a file named frieze_6.pdf that views as follows.83.7. Seventh example. The file frieze_7.txt has the following contents.Here is a possible interaction:$ python3… from frieze import * frieze = Frieze(frieze_7.txt) frieze.analyse()Pattern is a frieze of period 4 that is invariant under translation,horizontal and vertical reflections, and rotation only. frieze.display()The effect of executing frieze.display() is to produce a file named frieze_7.tex that can be given asargument to pdflatex to produce a file named frieze_7.pdf that views as follows.94. Detailed description4.1. Input. The input is expected to consist of height + 1 lines of length + 1 numbers in {0, …, 15}, wherelength is at least equal to 4 and at most equal to 50 and height is at least equal to 2 and at most equal to 16,with possibly lines Consisting of spaces only that will be ignored and with possibly spaces anywhere on the lineswith numbers. The xth number n of the ythline, with 0 x length and 0 y height, is to be associated with a point situated x ? 0.2 cm to the right and y? 0.2 cm below an origin, is to be connected to the point 0.2 cm above if the rightmost digit of n is 1, is to be connected to the point 0.2 cm above and 0.2 cm to the right if the second rightmost digit of nis 1, is to be connected to the point 0.2 cm to the right if the third rightmost digit of n is 1, and is to be connected to the point 0.2 cm to the right and 0.2 cm below if the fourth rightmost digit of nis 1.To qualify as a frieze, the input is further constrained to fit in a rectangle of length length ? 0.2 cm and ofheight heigth ? 0.2 cm, with horizontal lines of length length at the top and at the bottom, identical verticalborders at both ends, no crossing segments connecting pairs of neighbours inside the rectangle, and a patternof integral period at least equal to 2 that is fully repeated at least twice in the horizontal dimension.4.2. Output. Consider executing from the Python prompt the statement from frieze import * followedby the statement frieze = Frieze(some_filename). In case some_filename does not exist in the workingdirectory, then Python will raise a FileNotFoundError exception, that does not need to be caught. Assumethat some_filename does exist (in the working directory). If the input is incorrect in that it does not containonly numbers in {0, . . . , 15} besides spaces, or in that it contains either too few or too many lines of numbers,or in that some line of Numbers contains too many or too few numbers, or in that two of its lines of numbersdo not contain the same number of numbers, then the effect of executing frieze = Frieze(some_filename)should be to generate a FriezeError exception that readsTraceback (most recent call last):…frieze.FriezeError: Incorrect input.If the previous conditions hold but the further conditions spelled out above for the input to qualify as a frieze donot hold, then the effect of executing frieze = Frieze(some_filename) should be to generate a FriezeErrorexception that readsTraceback (most recent call last):…frieze.FriezeError: Input does not represent a frieze.If the input is correct and represents a frieze, then executing frieze = Frieze(some_filename) followed byfrieze.analyse() should have the effect of outputting one or two lines that readPattern is a frieze of period N that is invariant under translation only.orPattern is a frieze of period N that is invariant under translationand vertical reflection only.orPattern is a frieze of Period N that is invariant under translationand horizontal reflection only.orPattern is a frieze of period N that is invariant under translationand glided horizontal reflection only.orPattern is a frieze of period N that is invariant under translationand rotation only.or10Pattern is a frieze of period N that is invariant under translation,glided horizontal and vertical reflections, and rotation only.orPattern is a frieze of period N that is invariant under translation,horizontal and vertical reflections, and rotation only.with N an appropriate integer at least equal to 2.These 7 possible outputs are based on a mathematical result on the classification of friezes that lists allpossible complete lists of symmetries that leave a frieze invariant under an isometry (that is, a transformationthat does not alter the distance between any two points). These possible lists involve 5 symmetries. Translation by period; of course, any frieze is invariant under this symmetry. Vertical reflection about some vertical line; that line does not necessarily delimit the pattern nor doesit necessarily go Through its middle (these conditions are actually equivalent). Horizontal reflection about the line that goes through the middle of the frieze. Glided horizontal reflection, that is, horizontal reflection about the line that goes through the middleof the frieze and translation by half the period of the resulting lower half of the frieze. Rotation around some point situated on the horizontal line that goes through the middle of the frieze;this is equivalent to horizontal refection combined with vertical reflection.Pay attention to the expected format, including spaces.If the input is correct and represents a frieze, then executing frieze = Frieze(some_filename) followedby frieze.display() should have the effect of producing a file named some_filename.tex that can be givenas argument to pdflatex to generate a file named some_filename.pdf. The provided examples will show youwhat some_filename.tex should contain. Segments are drawn in purple with a single draw command for eachlongest segment, starting with the Vertical segments, from the topmost leftmost one to the bottommost rightmost onewith the leftmost ones first, followed by the segments that go from north west to south east, from the topmost leftmost one to thebottommost rightmost one with the topmost ones first, followed by the segments that go from west to east, from the topmost leftmost one to the bottommostrightmost one with the topmost ones first, followed by the Segments that go from the south west to the north east, from the topmost leftmost oneto the bottommost rightmost one with the topmost ones first.Pay attention to the expected format, including spaces and blank lines. Lines that start with % are comments;there are 4 such lines, that have to be present even when there is no item to be displayed of the kind describedby the comment. The output of your program redirected to a file will be compared with the expected outputsaved in a file (of a different name Of course) using the diff command. For your program to pass the associatedtest, diff should silently exit, which requires that the contents of both files be absolutely identical, character forcharacter, including spaces and blank lines. When testing locally, check your program on the provided examplesusing the associated .tex files, renaming them as they have the names of the files expected to be generated byyour program.如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导