首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代写CSC1002、代做Python程序语言
项目预算:
开发周期:
发布时间:
要求地区:
CSC1002 – Computational Laboratory
Console-Based Editor - Basic - 2025
OVERVIEW
In this assignment, you are going to design and develop a simple, basic console-based editor. Unlike the
modern, advanced editor which provides a sophisticated editing environment, utilizing the high resolution of the graphical screen together with the mouse and the keyboard to position and adjust any
text and figures displayed on the screen, giving us the WYSIWYG (What-You-See-Is-What-You-Get)
experience.
In the early days, lacking access to a rich graphical display and mouse, the functionality of editors was
limited, providing only a much simpler user interface, usually console-based. Editing was carried out
based on simple text commands entered via the keyboard, commands such as inserting (i) and
appending (a) a text string, positioning the editor cursor one character position to the left (h), one
character position to the right (l), one-word position forwards (w), one-word position backwards (b), and
so on.
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
SCOPE
1. Complete all the following editor commands:
NOTE: Refer to the section “Specific Spec” for more information on particular requirements.
2. Case-sensitive commands - all editor commands are case-sensitive, for example, the capital
letter ‘A’ does not equal the lowercase letter ‘a’.
3. Command types - most commands are single-letter (in lower case) commands (such as ?, $, x, ^,
…etc), while some are two-letter (such as dw). Most commands do not require extra input,
while a few do, such as insert (i) and append (a).
4. Command prompt (>) - The prompt is a single character string ‘>’. See the screenshots on the
first page.
5. Command Syntax - “Command[Text]”, where “Command” is one of the commands shown in
step 1, and “Text” applies only to commands requiring extra input such as insert (i) and append
(a). Note: any commands whose description includes a substring enclosed in “<>” brackets
require extra input “Text”.
6. Command Parsing - the user types a single command and then presses the return key to
continue. Parse each command string according to “Command Syntax” to ensure that the input
string matches EXACTLY one of the commands from step 1, including the extra input “Text” if
required. When invalid input is entered, simply display another prompt as illustrated in the
following screenshot.
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
a. Examples of valid command input:
i. “$”
ii. “^”
iii. “h”
iv. “x”
v. “ahello world”
vi. “i hello world “
b. Examples of invalid command input:
i. “ $”
ii. “ ?”
iii. “? “
iv. “ ahello world”
v. “i”
7. Command Execution - the editor will repeatedly prompt the user to enter an editor command,
execute the command, and then output the updated content on the display console (except for
commands ‘?’ and ‘q’, see Note follows). After the updated content is displayed, the editor will
display a new prompt on a new line. Refer to the section “Sample Output” for more examples.
Note: when the help command (?) is entered, output only the help menu as shown in step 1;
when the quit command (‘q’) is entered, terminate the program.
NOTE:
• Keep your entire source code in ONE SINGLE file.
• Use only Python modules as specified in the “Permitted Modules” section.
• In your design stick ONLY to functions, in other words, no class objects of your own.
o Furthermore, the lines of code containing the sub-function(s) defined within another
function will be counted as part of the parent function.
o NOTE: Failure to adhere to the instructions outlined in the assignment handout will
result in a 50% reduction in the coding style score.
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
SPECIFIC SPEC
1. Editor content - the editor shows its content, if any, as a single line of text string constructed by
one or multiple Insert/Append commands. If the row cursor is enabled, it shows its position in a
color such as green. When the editor program initially starts, its content is empty. Refer to the
section “Sample Output” for more examples.
2. Row cursor - it’s used to show where the cursor is on the current row if not empty. In other
words, the cursor will appear on printable characters including space. The cursor is shown by
wrapping a character with a pair of escape character strings such as “\033[42m” and “\033[0m”.
For example, given a string “hello world”, to show the green cursor at the position of the letter
‘e’, this is the string to print: “h” + “\033[42m” + “e” + “\033[0m” + “llo world”.
3. Insert - the given string “Text” will be inserted to the left of the cursor and the cursor position
will be changed to the beginning of the “Text” string.
4. Append - the given string “Text” will be inserted to the right of the current cursor position and
the cursor position will be changed to the end of the “Text” string.
5. Delete word - delete all characters from the cursor position to the beginning of the next word or
to the end of the line.
6. Cursor left and right - when repositioning the cursor to the left or right, one or multiple
positions, and if the cursor is already at the far left or far right position, leave the cursor where it
is.
7. Undo - it’s used to reverse the change(s) made to the editor content including the row cursor
positions based on the most recent commands. If multiple consecutive undo commands are
executed, each will undo one command at a time in the reverse order that the commands were
originally executed. For example, given the last 2 valid commands are “ahello” followed by “a
world”, the first undo command will reverse the “a world”, and the second consecutive undo
command will reverse “ahello”. Refer to the following figure for an illustration.
8. Repeat - The “Repeat” command is used to re-execute the last valid command and it offers the
convenience of sparing the user from retyping it again. The “Repeat” command is not
applicable to the Undo and Help commands. For example, consider the command sequence:
“ahello”, “a world”, “?”, and “u”. If the command “r” is subsequently entered multiple times,
each Repeat command will always re-execute “ahello”. Refer to step “Undo followed by Repeat”
for another illustration.
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
9. Undo followed by Repeat - In this case, the “Undo” is not considered as the last command and
the "Repeat" command is used to target the command immediately preceding the "Undo"
command, not the most recent action performed. Any command entered prior to the "Undo"
will be re-executed upon triggering the "Repeat" command. Refer to the following figure for an
illustration.
10. b command - it moves the cursor to the beginning of the word to the left of the cursor. If the
cursor is within a word, the cursor will be placed at the word's first letter. Refer to the following
figure for an illustration.
11. Word - a word is defined as a sequence of consecutive characters including punctuations but not
white space, in other words, any group of characters without spaces is considered a single word,
even if it includes punctuation marks. Refer to the following figure for an illustration.
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
ASSUMPTIONS
1. The goal of this assignment is to illustrate the benefits of “Problem Decomposition”, “Clean
Coding” and “Refactoring”, all together achieving high code readability to ease logic expansion
and keep high maintainability, therefore, it’s not aimed at designing a complex, general-purpose
editor for handling large editing content.
2. It’s assumed that the length of each line is kept within a reasonable length so that each line can
be stored directly using the standard Python ‘str’ type. The number of lines is also kept within a
reasonable number so that all lines can be kept in one standard Python list and the lines can be
efficiently updated using the standard list and str operations such as append, insert, slicing,
cloning, …etc.
3. It is assumed that the user will not input a command that consumes excessive memory and
leads to a buffer overflow (also called memory overflow or overrun) at runtime, such as
inserting a very long string like “ihello …………………………. world.” In other words, all test cases
executed against your program will be based on the commands from step 1 (Scope) with a
short“Text” string.
4. Each test case is designed to evaluate the functionality and correctness of your program, rather
than its speed, performance and memory usage. Each test case consists of multiple editing
commands with short “Text”.
5. The text editor is required to handle only regular English characters, thus additional unicode
support, if any, is unnecessary.
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
STARTUP OPTIONS
Not applicable
SKILLS
In this assignment, you will be trained on the use of the followings:
• Refactoring - logic reuse or simplification based on the existing logic.
• Variable scope: global, local and function parameters.
• Coding Styles (naming convention, meaningful names, comments, doc_string, …etc)
• Problem Decomposition, Clean Code, Top-Down Design
• Functions (with parameters and return) for program structure and logic decomposition
• Standard objects (strings, numbers & lists)
• Variable Scope
PERMITTED MODULES
Only the following Python module(s) is allowed to be used:
• re (regular expression)
DELIVERABLES
Program source code (A1_School_StudentID.py), where School is SSE, SDS, SME, HSS, FE, LHS, MED and
StudentID is your 9-digit student ID.
For instance, a student from SME with student ID “119010001” will name the Python file as follows:
• A1_SME_119010001.py:
Ensure that your source file is saved in standard, regular UTF-8 encoding format. On the status bar of
Visual Studio Code, you can view the current encoding format as follows:
On an occasion, the encoding scheme is set to UTF-8 with BOM as follows:
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
The presence of the Byte Order Mark (BOM) could be due to copying from websites, older version of
editor, file conversion from other sources, default encoding setting, and so on.
Confirm the encoding scheme is UTF-8 and the file name is correct, then submit the plain program file to
the corresponding assignment folder. A deduction of 5% will be penalized if the file is incorrectly named
or in wrong encoding format.
TIPS & HINTS
• Apply problem decomposition, Clean Code and Refactoring as illustrated during classes.
• Beware of variable scope as you might keep a few variables as global such as current editor
content, cursor position, undo buffer, and so on.
• Refer to Python website for program styles and naming conventions (PEP 8)
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
SAMPLE OUTPUT
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
CSC1002 – 2025 Winter By Kinley Lam
CSC1002 – Computational Laboratory
MARKING CRITERIA
• Coding Styles – overall program structure including layout, comments, white spaces, naming
convention, variables, indentation, functions with appropriate parameters and return.
• Program Correctness – whether or the program works 100% as per Scope.
• User Interaction – how informative and accurate information is exchanged between your
program and the player.
• Readability counts – programs that are well structured and easy to follow using functions to
break down complex problems into smaller cleaner generalized functions are preferred over a
function embracing a complex logic with many nested conditions and branches! In other words,
a design with a clean architecture and high readability is the predilection for the course
objectives over efficiency. The logic in each function should be kept simple and short, and it
should be designed to perform a single task and be generalized with parameters as needed.
• KISS approach – Keep It Simple and Straightforward.
• Balance approach – you are not required to come up with a very optimized solution. However,
take a balance between readability and efficiency with good use of program constructs.
DUE DATE
March 2nd, 2025, 11:59:00PM
ITEMS PERCENTAGE REMARKS
CODING STYLES 30%-40% 0% IF PROGRAM DOESN’T RUN
FUNCTIONALITY 60%-70% REFER TO SCOPE
CSC1002 – 2025 Winter By Kinley Lam
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写tc2343、代做python设计程...
2025-04-15
6412ele代写、代做c/c++,pyth...
2025-04-15
fit5221代写、代做python语言编...
2025-04-15
代写assessment 3 – “annota...
2025-04-15
代写 comp 310、代做 java/pyt...
2025-04-14
代做 program、代写 java 语言...
2025-04-14
program 代做、代写 c++/pytho...
2025-04-14
代写review questions – ad/a...
2025-04-14
代写eng5009 advanced control...
2025-04-14
代做ent204tc corporate entre...
2025-04-14
代写assignment st3074 ay2024...
2025-04-14
代做cs3243 introduction to a...
2025-04-14
代做empirical finance (bu.23...
2025-04-14
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!