91精品国产91久久久久久_国产精品二区一区二区aⅴ污介绍_一本久久a久久精品vr综合_亚洲视频一区二区三区

合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

代寫COMP9021object-oriented Python  程序
代寫COMP9021object-oriented Python  程序

時(shí)間:2025-11-08  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



Assignment 2
COMP9021, Trimester 3, 2025
1 General matters
1.1 Aim
The purpose of the assignment is to:
• develop object-oriented Python programs with proper exception handling;
• parse and analyse combinatorial structures;
• generate TikZ/LaTeX diagrams programmatically;
• handle both small and complex structures efficiently.
1.2 Submission
Your program should be stored in a file named arches.py, optionally together with additional files. After
developing and testing your program, upload it via Ed (unless you worked directly in Ed). Assignments
can be submitted multiple times; only the last submission will be graded. Your assignment is due on
November 24 at 11:59am.
1.3 Assessment
The assignment is worth 13 marks and will be tested against multiple inputs. For each test, the au tomarking script allows your program to run for 30 seconds.
Assignments may be submitted up to 5 days after the deadline. The maximum mark decreases by 5% for
each full late day, up to a maximum of five days. For example, if students A and B submit assignments
originally worth 12 and 11 marks, respectively, two days late (i.e., more than 24 hours but no more than
48 hours late), the maximum mark obtainable is 11.7. Therefore, A receives min(11.7, 12) = 11.7 and B
receives min(11.7, 11) = 11.
Your program will generate a number of .tex files. These can be given as arguments to pdflatex to
produce PDF files. Only the .tex files will be used to assess your work, but generating the PDFs should
still give you a sense of satisfaction. The outputs of your programs must exactly match the expected
outputs. You are required to use the diff command to identity any differences between
the .tex files generated by your program and the provided reference .tex files. You are
responsible for any failed tests resulting from formatting discrepancies that diff would have
detected.
1.4 Reminder on plagiarism policy
You are encouraged to discuss strategies for solving the assignment with others; however, discussions
must focus on algorithms, not code. You must implement your solution independently. Submissions are
routinely scanned for similarities that arise from copying, modifying others’ work, or collaborating too
closely on a single implementation. Severe penalties apply.
1
2 Open Meanders
2.1 Background
An open meander is a combinatorial structure represented as a non-self-intersecting curve that crosses a
horizontal line of points, forming arches above and below the line. They can be described by permutations
with specific constraints.
Formally, let (a1, a2, . . . , an) be a permutation of {1,…, n} with n ≥ 2. Each integer corresponds to a
distinct point on a fixed horizontal line. The permutation defines a sequence of arches as follows:
• The first arch is an upper arch, drawn above the line.
• Subsequent arches alternate between upper and lower positions, forming a valid open meander.
• Each arch connects two consecutive points ai and ai+1 in the permutation. The orientation of each
arch depends on the relative order of these points:
– An arch is drawn from left to right if ai < ai+1.
– An arch is drawn from right to left if ai > ai+1.
• Arches on the same side do not intersect.
The collection of upper and lower arches can be represented symbolically using extended Dyck words—
one for each side of the line:
• ( corresponds to the left endpoint of an arch.
• ) corresponds to the right endpoint of an arch.
• 1 represents an end of the curve (a free endpoint) that lies on that side.
The position of the endpoints depends on the parity of n:
• For even n, both ends of the curve lie below the line.
• For odd n, one end lies above and the other below the line.
Each extended Dyck word therefore encodes the complete structure of the arches on its respective side,
though only together do the two sides represent the full open meander.
2.2 Examples
For a first example, consider the permutation (2, 3, 1, 4) and the corresponding generated diagram open_me anders_1.pdf.
• Upper arches extended Dyck word: (())
• Lower arches extended Dyck word: (1)1
For a second example, consider the permutation (1, 10, 9, 4, 3, 2, 5, 8, 7, 6) and the corresponding generated
diagram open_meanders_2.pdf.
2
• Upper arches extended Dyck word: (()((())))
• Lower arches extended Dyck word: 1(())1()()
For a third example, consider the permutation (5, 4, 3, 2, 6, 1, 7, 8, 13, 9, 10, 11, 12) and the corresponding
generated diagram open_meanders_3.pdf.
• Upper arches extended Dyck word: (()())()(()1)
• Lower arches extended Dyck word: ((()1))(()())
2.3 Requirements
Implement in arches.py a class OpenMeanderError(Exception) and a class OpenMeander.
Objects of type OpenMeander are created with OpenMeander(a_1, a_2, ..., a_n), where the arguments
form a permutation of {1,…, n} for some n ≥ 2. You may assume that all arguments are integers.
• If the arguments do not form a permutation of {1,…, n} for some n ≥ 2, raise
OpenMeanderError('Not a permutation of 1, ..., n for some n ≥ 2').
• If they do not define a valid open meander, raise
OpenMeanderError('Does not define an open meander').
Implement in OpenMeander three attributes:
• extended_dyck_word_for_upper_arches, a string representing the upper arches;
• extended_dyck_word_for_lower_arches, a string representing the lower arches;
• draw(filename, scale=1), a method that generates a TikZ/LaTeX file drawing the open meander.
No error checking is required in the implementation of draw(filename, scale=1). You may assume that
filename is a valid string specifying a writable file name, and that scale is an integer or floating-point
number (typically chosen so that the resulting picture fits on a page).
An example interaction is shown in open_meanders.pdf.
Carefully study the three example .tex files. Note that the horizontal baseline extends one unit beyond
each end of the curve. Also note that the scale common to x and y, as well as the values for radius, are
displayed as floating-point numbers with a single digit after the decimal point. The length of the ends of
strings is computed as half of the scale of x and y, and is also displayed as a floating-point number with
a single digit after the decimal point.
3 Dyck Words and Arch Diagrams
3.1 Background
A Dyck word is a balanced string of parentheses representing a system of nested arches above a horizontal
line. The depth of an arch is the number of arches it is nested within, providing a way to analyse the
hierarchical structure.
3
For example, the Dyck word (()(()(()))) contains arches of depth 0, 1, 2, and 3. Dyck words can be
visualised as arches drawn above a horizontal line, with nesting reflected in the vertical stacking of arches.
Unlike open meanders, Dyck words involve only one side of arches (above the line) and do not include
endpoints represented by 1. They provide a simplified context for studying nesting depth and arch
diagrams, and arches can optionally be visually distinguished by color according to their depth.
When colouring is applied, the following sequence is used: Red, Orange, Goldenrod, Yellow, LimeGreen,
Green, Cyan, SkyBlue, Blue, Purple. If the maximum depth exceeds 9, the sequence wraps around. For
example, depth 10 would use Red again, depth 11 Orange, etc.
3.2 Examples
For a first example, consider the Dyck word (((((((((((((()))))))))))))) and the corresponding
generated diagrams, drawn_dyck_word_1.pdf and coloured_dyck_word_1.pdf.
• There is 1 arch of depth 0.
• There is 1 arch of depth 1.
• There is 1 arch of depth 2.
• There is 1 arch of depth 3.
• There is 1 arch of depth 4.
• There is 1 arch of depth 5.
• There is 1 arch of depth 6.
• There is 1 arch of depth 7.
• There is 1 arch of depth 8.
• There is 1 arch of depth 9.
• There is 1 arch of depth 10.
• There is 1 arch of depth 11.
• There is 1 arch of depth 12.
• There is 1 arch of depth 13.
For a second example, consider the Dyck word (()(()(()))) and the corresponding generated diagrams,
drawn_dyck_word_2.pdf and coloured_dyck_word_2.pdf.
• There are 3 arches of depth 0.
• There is 1 arch of depth 1.
• There is 1 arch of depth 2.
• There is 1 arch of depth 3.
For a third example, consider the Dyck word ((()())(()(()()))) and the corresponding generated
diagrams, drawn_dyck_word_3.pdf and coloured_dyck_word_3.pdf.
4
• There are 5 arches of depth 0.
• There are 2 arches of depth 1.
• There is 1 arch of depth 2.
• There is 1 arch of depth 3.
For a fourth example, consider the Dyck word ((()(()())(()(()(())))((()()))()(()()))) and the
corresponding generated diagrams, drawn_dyck_word_4.pdf and coloured_dyck_word_4.pdf.
• There are 11 arches of depth 0.
• There are 4 arches of depth 1.
• There are 2 arches of depth 2.
• There is 1 arch of depth 3.
• There is 1 arch of depth 4.
• There is 1 arch of depth 5.
3.3 Requirements
Implement in arches.py a class DyckWordError(Exception) and a class DyckWord.
Objects of type DyckWord are created with DyckWord(s), where the argument s is a nonempty string of
parentheses. You may assume that the argument is a string.
• If the argument is the empty string, raise
DyckWordError('Expression should not be empty').
• Otherwise, if the argument contains characters other than parentheses, raise
DyckWordError("Expression can only contain '(' and ')'").
• Otherwise, if the string is not balanced, raise
DyckWordError('Unbalanced parentheses in expression').
Implement in DyckWord three attributes:
• report_on_depths(), a method that outputs the number of arches at each depth, ordered from
smallest to largest depth;
• draw_arches(filename, scale=1), a method that generates a TikZ/LaTeX file drawing the arches;
• colour_arches(filename, scale=1), a method that generates a TikZ/LaTeX file drawing the
arches coloured according to their depth.
5
No error checking is required in the implementation of both methods. You may assume that filename
is a valid string specifying a writable file name, and that scale is an integer or floating-point number
(typically chosen so that the resulting picture fits on a page).
An example interaction is shown in dyck_words.pdf.
Carefully study the eight example .tex files (four for drawing arches, four for colouring arches). Note
that the horizontal baseline extends one unit beyond the leftmost and rightmost arches. Note that the
scale common to x and y is displayed as a floating-point number with a single digit after the decimal
point. Arches are drawn from the leftmost left end to the rightmost left end. Arches are coloured
from largest depth to smallest depth, and for arches of the same depth, from leftmost left end to
rightmost left end.
請(qǐng)加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp

掃一掃在手機(jī)打開當(dāng)前頁
  • 上一篇:代寫COMP3020J encryptors and decryptors 程序&#160;
  • 下一篇:代寫comp3211程序代做 &#160;IoT Framework&#160;
  • 無相關(guān)信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評(píng)軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務(wù)-企業(yè)/產(chǎn)品研發(fā)/客戶要求/設(shè)計(jì)優(yōu)化
    有限元分析 CAE仿真分析服務(wù)-企業(yè)/產(chǎn)品研發(fā)
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
    急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
    出評(píng) 開團(tuán)工具
    出評(píng) 開團(tuán)工具
    挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
    挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
    海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
    海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
    合肥機(jī)場巴士4號(hào)線
    合肥機(jī)場巴士4號(hào)線
    合肥機(jī)場巴士3號(hào)線
    合肥機(jī)場巴士3號(hào)線
  • 短信驗(yàn)證碼 目錄網(wǎng) 排行網(wǎng)

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
    ICP備06013414號(hào)-3 公安備 42010502001045

    91精品国产91久久久久久_国产精品二区一区二区aⅴ污介绍_一本久久a久久精品vr综合_亚洲视频一区二区三区
    日本v片在线高清不卡在线观看| 极品美女销魂一区二区三区| 精品国产91乱码一区二区三区| 欧美伊人久久久久久午夜久久久久| 99视频在线精品国自产拍免费观看| 欧美激情第10页| av一区二区久久| 成人激情小说乱人伦| 成人免费福利片| 成人18视频日本| 99久久综合狠狠综合久久| 97se亚洲国产综合自在线| 成人国产免费视频| 欧美一区二区三区另类| 欧美激情精品久久久六区热门| 91女人视频在线观看| 91丝袜美腿高跟国产极品老师 | 国产一区二区精品在线观看| 国产高清久久久久| 成人va在线观看| 欧美成人综合一区| 好看的亚洲午夜视频在线| 亚洲成色www久久网站| 国产欧美一级| 一本大道久久a久久综合| 欧美日韩一区二区三区高清| 91麻豆精品国产91久久久久久| 日韩一区二区免费在线电影| 国产婷婷一区二区| 亚洲美女淫视频| 免播放器亚洲一区| 国产91综合一区在线观看| 女女同性精品视频| 欧美日韩国产综合一区二区| 欧美三级蜜桃2在线观看| 在线成人高清不卡| 亚洲国产高清不卡| 亚洲香肠在线观看| 国产夫妻精品视频| 国内精品久久久久国产盗摄免费观看完整版 | 国产视频一区在线观看一区免费| 老牛国产精品一区的观看方式| 678五月天丁香亚洲综合网| 欧美一区二区三区免费| 国产精品理伦片| 免费成人在线播放| 9l国产精品久久久久麻豆| 99精品视频免费| 欧美日韩国产乱码电影| 亚洲国产精品99久久久久久久久| 亚洲成人动漫精品| a级高清视频欧美日韩| av不卡在线看| 欧美一区二区免费观在线| 亚洲丝袜精品丝袜在线| 麻豆精品一区二区综合av| 91网页版在线| 欧美综合一区二区| 国产精品成人免费精品自在线观看 | 久久精品中文| 国产日本欧美一区二区| 秋霞午夜av一区二区三区| 欧美黄色免费| 精品1区2区3区| 综合激情网...| 国产河南妇女毛片精品久久久 | 91精品国产欧美一区二区| 亚洲日本欧美天堂| 丁香天五香天堂综合| 蜜桃av一区| 国产精品护士白丝一区av| 国产一区二区三区av电影| 一区二区91| 久久久综合网站| 国产乱子伦视频一区二区三区| 亚洲国产精品第一区二区三区| 91精品久久久久久蜜臀| 午夜精品久久久久影视| 欧美极品一区| 欧美成人一级视频| 久久99国产乱子伦精品免费| 日韩视频一区| 中文一区在线播放| 成人中文字幕在线| 欧美日韩一区 二区 三区 久久精品| 亚洲色图视频免费播放| 91免费看片在线观看| 欧美一区二区三区视频免费| 奇米综合一区二区三区精品视频| 在线观看福利一区| 国产嫩草影院久久久久| 成人免费视频国产在线观看| 欧美日韩国产大片| 黄色成人在线网站| 日韩一区二区三区在线观看| 六月丁香婷婷久久| 色爱区综合激月婷婷| 午夜视频在线观看一区| 一本一本久久| 亚洲自拍欧美精品| 99亚洲一区二区| 亚洲欧美日韩人成在线播放| 国产一区二区三区四区hd| 久久久99精品免费观看不卡| a4yy欧美一区二区三区| 日韩精品在线看片z| 国产成人啪午夜精品网站男同| 欧美日韩国产成人在线免费| 韩国女主播一区二区三区| 欧美日产国产精品| 国产一区激情在线| 欧美一二三区在线| 福利电影一区二区| 久久久精品人体av艺术| 欧美日韩蜜桃| 亚洲男人的天堂在线观看| 亚洲精品在线观看免费| 亚洲国产精品久久人人爱蜜臀 | 国产精品免费网站在线观看| 国产在线一区二区三区四区| 亚洲视频在线观看三级| 亚洲图片欧洲图片日韩av| 中文字幕中文字幕中文字幕亚洲无线| 欧美激情91| 亚洲日本免费电影| 色综合久久六月婷婷中文字幕| 美女脱光内衣内裤视频久久网站 | 午夜精品一区二区三区四区| 中文字幕亚洲一区二区va在线| 伊人久久综合| 亚洲 欧美综合在线网络| 欧美私模裸体表演在线观看| 成人网在线播放| 国产免费观看久久| 一区二区三区av| 久久电影网站中文字幕 | 舔着乳尖日韩一区| 91麻豆精品国产91久久久久久| 91美女在线观看| 亚洲精品自拍动漫在线| 91黄色免费看| 9i在线看片成人免费| 亚洲综合一区二区| 在线不卡的av| 欧美日韩精品久久| 日本不卡1234视频| 久久精品视频一区二区| 亚洲一区激情| 国产不卡一区视频| 亚洲精品久久7777| 91麻豆精品国产91久久久使用方法| 91浏览器在线视频| 婷婷久久综合九色国产成人| 欧美成va人片在线观看| 一本色道久久| www.色综合.com| 五月天一区二区三区| 26uuu国产日韩综合| 免费亚洲网站| 91猫先生在线| 蜜桃视频免费观看一区| 国产欧美日韩在线| 在线观看中文字幕不卡| 欧美成人中文| 久久爱www久久做| 亚洲人午夜精品天堂一二香蕉| 欧美日韩综合不卡| 国产欧美日韩综合精品二区| 国产乱码精品1区2区3区| 亚洲免费观看高清| 欧美成va人片在线观看| 色婷婷国产精品久久包臀| 欧美另类一区| 国产成人精品免费在线| 亚洲午夜羞羞片| 国产欧美精品在线观看| 欧美精品乱人伦久久久久久| 国产精品久久久一区二区| 99久久精品久久久久久清纯| 久久精品免费看| 亚洲一二三四区不卡| 国产午夜精品久久久久久免费视 | 欧美日韩一区二区三区在线| 国产精品一区视频| 国产精品大片免费观看| 韩国女主播成人在线观看| 久久久久久久国产精品影院| 久久夜色精品| 日韩一区二区久久| 欧美日本一区二区视频在线观看| 国内精品免费**视频| 日韩影院免费视频| 一区二区三区日韩精品视频| 国产精品乱码妇女bbbb| 久久久久久久久一| 精品久久免费看| 91精品国产综合久久福利软件| 欧美伊人久久久久久久久影院| 久久精品观看| 美女久久网站|