Answered You can hire a professional tutor to get the answer.
Design and implement a Python program that will Check whether some numbers, stored in a file, represent a particular coding of a frieze, and - either...
Design and implement a Python 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 le, from which a pictorial representation of the frieze can be
produced.
The representation of a frieze is based on a coding with numbers in the range 0 . . . 15, each such number
n being associated 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
its northern neighbour: |
- if the second rightmost digit of the representation of n in base 2 is equal to 1 then p is to be
connected to 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 connected
to 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
connected to its south-eastern neighbour:
First example
The file frieze_1.txt has the following contents.
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0
0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0
0 0 0 0 4 4 1 5 4 4 4 4 8 0 0 0 0 0 0 4 4 1 5 4 4 4 4 8 0 0 0
0 0 0 2 0 0 5 1 0 0 0 0 0 8 0 0 0 0 2 0 0 5 1 0 0 0 0 0 8 0 0
0 0 2 0 0 0 0 0 0 0 0 0 0 0 8 0 0 2 0 0 0 0 0 0 0 0 0 0 0 8 0
0 6 4 4 4 4 4 4 4 4 4 4 4 4 4 0 6 4 4 4 4 4 4 4 4 4 4 4 4 4 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
1 1 0 0 0 0 0 0 4 4 4 12 4 4 4 1 1 0 0 0 0 0 0 4 4 4 12 4 4 4 1
1 1 0 4 4 0 0 0 1 2 0 0 8 1 0 1 1 0 4 4 0 0 0 1 2 0 0 8 1 0 1
1 1 0 5 5 1 0 0 3 0 0 0 0 1 0 1 1 0 5 5 1 0 0 3 0 0 0 0 1 0 1
1 1 0 5 5 1 0 0 5 4 4 4 4 1 0 1 1 0 5 5 1 0 0 5 4 4 4 4 1 0 1
1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1
1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1
1 5 4 5 4 5 4 4 4 4 4 4 4 4 4 1 5 4 5 4 5 4 4 4 4 4 4 4 4 4 1
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0
Here is a possible interaction:
$ python3
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
...
>>> 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
as argument to pdflatex to produce a file named frieze_1.pdf that views as follows.