日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

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

時間:2025-11-08  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



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.
請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp

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

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 trae 豆包網頁版入口 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

      <em id="rw4ev"></em>

        <tr id="rw4ev"></tr>

        <nav id="rw4ev"></nav>
        <strike id="rw4ev"><pre id="rw4ev"></pre></strike>
        一区二区三区www| 在线成人免费视频| 欧美区在线播放| 国产欧美一区二区精品婷婷| 亚洲精品国产精品国自产在线| 国产精品女主播在线观看| 国产欧美精品一区| 极品av少妇一区二区| 91久久国产综合久久| 欧美一区二区三区在线视频| 久久午夜精品一区二区| 欧美成人精品| 欧美日韩国产高清| 91久久中文字幕| 午夜免费电影一区在线观看| 欧美日韩成人网| 亚洲国产美国国产综合一区二区| 国产麻豆综合| 欧美另类一区二区三区| 亚洲国产精品成人精品| 亚洲精品国产精品国自产在线| 午夜在线观看免费一区| 久久天天躁狠狠躁夜夜爽蜜月| 99精品视频网| 亚洲欧洲精品一区二区精品久久久| 樱桃视频在线观看一区| 国产一区二区三区精品欧美日韩一区二区三区| 一级成人国产| 在线观看欧美| 欧美日韩国产区| 欧美高清不卡| 欧美亚洲免费| 久久精品av麻豆的观看方式| 欧美激情第10页| 欧美少妇一区二区| 欧美午夜三级| 久久久久久精| 国产精品一二三视频| 亚洲资源在线观看| 午夜精品免费视频| 欧美一区二区视频网站| 免费亚洲视频| 久久久夜色精品亚洲| 亚洲国产婷婷香蕉久久久久久| 国产日韩综合一区二区性色av| 国产偷自视频区视频一区二区| 99国产精品国产精品久久| 亚洲欧美日韩成人高清在线一区| 欧美成人免费网| 亚洲国产电影| 欧美二区乱c少妇| 日韩西西人体444www| 欧美激情综合五月色丁香小说| 国产揄拍国内精品对白| 亚洲一区二区三区乱码aⅴ| 欧美精品一区二区久久婷婷| 在线综合视频| 亚洲欧洲日本专区| 久久精品国产欧美激情| 久久av一区二区三区亚洲| 午夜一区在线| 久久―日本道色综合久久| 欧美一区二区视频在线| 一区二区三区视频观看| 久久网站免费| 亚洲午夜精品视频| 日韩亚洲一区在线播放| 欧美成年人视频网站欧美| 极品日韩av| 亚洲综合第一页| 亚洲一区二区综合| 国产精品亚洲人在线观看| 欧美一区二区视频在线观看2020| 日韩一级大片| 欧美色欧美亚洲高清在线视频| 免费观看一区| 美女国产一区| 久久综合网色—综合色88| 日韩小视频在线观看| 欧美大片在线观看一区二区| 亚洲天堂偷拍| 欧美在线欧美在线| 亚洲缚视频在线观看| 一区二区不卡在线视频 午夜欧美不卡'| 久久精品99无色码中文字幕| 在线一区日本视频| 欧美午夜美女看片| 国产精品视频你懂的| 在线成人av.com| 国产精品大片wwwwww| 亚洲欧洲一区二区三区在线观看| 国产一区二区三区丝袜| 欧美日韩八区| 欧美日韩综合在线| 久久久无码精品亚洲日韩按摩| 欧美天堂亚洲电影院在线观看| 欧美国产日韩一区二区在线观看| 国语自产精品视频在线看抢先版结局| 欧美中文在线免费| 久久亚洲捆绑美女| 亚洲欧洲精品天堂一级| 国产精品丝袜白浆摸在线| 久久免费精品视频| 亚洲宅男天堂在线观看无病毒| 亚洲夫妻自拍| 亚洲国产天堂网精品网站| 欧美成人精品三级在线观看| 欧美精品麻豆| 暖暖成人免费视频| 国内揄拍国内精品久久| 国产精品美女久久久浪潮软件| 欧美国产日本高清在线| 亚洲特黄一级片| 国产视频一区在线观看| 国产精品免费区二区三区观看| 亚洲青色在线| 在线免费观看日本欧美| 国产在线乱码一区二区三区| 亚洲欧美电影院| 精品88久久久久88久久久| 欧美日韩不卡| 国产精品人人爽人人做我的可爱| 久久av资源网| 免费欧美在线视频| 欧美v国产在线一区二区三区| 欧美一区综合| 国产欧美大片| 一区二区三区精品在线| 国产一区二区高清视频| 欧美freesex8一10精品| 国产日韩欧美一区二区三区四区| 午夜一区二区三区不卡视频| 亚洲视频在线播放| 亚洲四色影视在线观看| 欧美激情第3页| 亚洲视频一区二区| 好吊妞这里只有精品| 欧美日韩一区二区精品| 国产农村妇女毛片精品久久麻豆| 欧美日本一道本在线视频| 国产精品福利在线观看| 欧美激情一二区| 亚洲一区二区在线免费观看视频| 国产精品日韩精品| 久久亚洲图片| 亚洲理伦电影| 欧美一区二视频在线免费观看| 久久精品夜色噜噜亚洲a∨| 欧美福利一区二区| 国产亚洲欧美一区在线观看| 久久久欧美精品| 91久久综合亚洲鲁鲁五月天| 欧美成人午夜77777| 日韩视频精品在线| 久久欧美中文字幕| 亚洲日韩欧美一区二区在线| 欧美xart系列在线观看| 欧美人成在线视频| 一区二区三区无毛| 国产主播喷水一区二区| 国产精品美女久久久久av超清| 亚洲视频免费| 蜜桃精品久久久久久久免费影院| 亚洲精品久久久久久久久久久|