Programming Assignment

110 views 8:19 am 0 Comments March 23, 2023

Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
1
PA8 – Boustrophedonic Lists
Integrity Policy: All university integrity and class syllabus policies have been followed. I have neither given, nor
received, nor have I tolerated others’ use of unauthorized aid.
I understand and followed these policies: Yes No
Name:
Date:
Final
Changelist number:
Verified build: Yes No
Number Tests Passed:
Required Configurations:
Discussion (What did you learn):
Student Information
Submission Details

Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
2
Follow the Piazza procedure on submission
o Verify your submission compiles and works at the changelist number.
Verify that only MINIMUM files are submitted
o No – Generated files
*.pdb, *.suo, *.sdf, *.user, *.obj, *.exe, *.log, *.pdb, *.db, *.user
Anything that is generated by the compiler should not be included
o No – Generated directories
/Debug, /Release, /Log, /ipch, /.vs
Typical files project files that are required
o *.sln, *.cpp, *.h
o *.vcxproj, *.vcxproj.filters, CleanMe.bat
Submit multiple times to Perforce
Submit your work as you go to perforce several times (at least 5)
o As soon as you get something working, submit to perforce
o Have reasonable check-in comments
Points will be deducted if minimum is not reached
Write all programs in cross-platform C++
Optimize for execution speed and robustness
Working code doesn’t mean full credit
Submission Report
Fill out the submission Report
o No report, no grade
Code and project needs to compile and run
Make sure that your program compiles and runs
o Warning level ALL …
o NO Warnings or ERRORS
Your code should be squeaky clean.
o Code needs to work “as-is”.
No modifications to files or deleting files necessary to compile or run.
o All your code must compile from perforce with no modifications.
Otherwise it’s a 0, no exceptions
Project needs to run to completion
If it crashes for any reason…
o It will not be graded and you get a 0
Verify Builds
Standard Rules

Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
3
No Containers
NO STL allowed {Vector, Lists, Sets, etc…}
o No automatic containers or arrays
o You need to do this the old fashion way – YOU EARNED IT
Leave Project Settings
Do NOT change the project or warning level
o Any changing of level or suppression of warnings is an integrity issue
Simple C++
No modern C++
o No Lambdas, Autos, templates, etc…
o No Boost
NO Streams
o Used fopen, fread, fwrite…
No code in MACROS
o Code needs to be in cpp files to see and debug it easy
Exception:
o implicit problem needs templates
Leaking Memory
If the program leaks memory
o There is a deduction of 20% of grade
If a class creates an object using new/malloc
o It is responsible for its deletion
Any MEMORY dynamically allocated that isn’t freed up is LEAKING
o Leaking is HORRIBLE, so you lose points
No Debug code or files disabled
Make sure the program is returned to the original state
o If you added debug code, please return to original state
If you disabled file, you need to re-enable the files
o All files must be active to get credit.
o Better to lose points for unit tests than to disable and lose all points
No Adding files to this project
This project will work “as-is” do not add files…
Grading system will overwrite project settings and will ignore any student’s added files and
will returned program to the original state
UnitTestConfiguration file (if provided) needs to be set by user
Grading will be on the UnitTestConfiguration settings
o Please explicitly set which tests you want graded… no regrading if set incorrectly
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
4
See Piazza for due date and time
Submit program perforce in your student directory assignment supplied.
Fill out your this Submission Report and commit to perforce
o ONLY use Adobe Reader to fill out form, all others will be rejected.
o Fill out the form and discussion for full credit.
Programming Assessment
o More practice with linked lists… (kind of)
Please VERIFY the correct builds for each project
Write a single function: remove()
o Signature and structure need exactly the same
o Place function in file named (see supplied files):
Boustrophedonic.cpp:
Function
Boustrophedonic.h:
Declaration and structure
struct Node
{
Node *pNorth;
Node *pSouth;
Node *pEast;
Node *pWest;
}
void Remove( Node *&head, int row, int col );
ASSUMPTIONS
o Boustrophedonic list is complete and PRISTINE before you remove one node
o Only ONE node will be removed in the function
o The dimensions of the list are NOT given
o Boustrophedonic list has an even number of columns
o Boustrophedonic list has no restrictions on number of rows
o On deletion, horizontal and vertical connections are preserved across the deleted node
Due Dates
Goals
Assignments

Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
5
Rules:
o NOTE :
Your list will be tested with different dimensions
Make sure you solve the problem in a generalized way without crashing
o You cannot modify the Node.h in any way.
It’s needed in the unit tests as is…
o You can add helper functions to Boustrophedonic.h and Boustrophedonic.cpp
All your work should be done in Boustrophedonic.cpp
o Make sure you are not leaking memory
You should delete the Node in your remove function
o Check both Debug and Release mode
Creating a Boustrophedonic List
Boustrophedonic – Greek word:
A method of writing shown in early Greek inscriptions, in which the lines run alternately from
right to left and from left to right, as the furrows made in plowing a field, the plow passing
alternately backward and forward.

struct Node
{
Node *pNorth;
Node *pSouth;
North West East

Node *pEast;
Node *pWest;
}
Start with the first node and continue in the Boustrophedonic path way, follow the RED LINE.
o Start with the head, and sequentially go from 0 to 11 in the Boustrophedonic way

0

 

1

 

2

 

3
a

 

7
e

 

6

 

5

 

4

 

8

 

9

 

10

11
head
South

Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
6
Next we create the vertical connections.

0

 

1
c

 

2

 

3
a

 

7
d

 

6

 

5
b

 

4

 

8

 

9

 

10

 

11

e f g h
head
Create the vertical connections between row 0 {0,1,2,4} and row 1 {7,6,5,4}.
o Find arrow a between 3 and 4.
That arrow goes down, from 3 to 4.
o Alternate direction of a, (a goes down in RED)
b goes up YELLOW,
c goes down BLUE,
d goes up YELLOW.
Similar for the connections between row 1 {7,6,5,4} and row 2 {8,9,10,11}
o Alternate direction of e, (e goes down in RED)
f goes up YELLOW,
g goes down BLUE,
h goes up YELLOW.
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
7
Drawing the list with all the links displayed.
o Each node actually has 4 pointers, most are nulls.
North, South, East, West
o Here the list is drawn with GREEN links showing the explicit null pointers.
0

0
0

0
0 0 0

0
0

 

0

 

0
0
0

 

0

 

0
0

0 0 0 0
0 0 0

0

 

0

 

0

 

0

 

0

 

0

0 0
head
Rows and Columns
o Rows and columns are not provided, nor are they added in the Node structure.
o You need to calculate these as you walk the list.
o The lists will vary in dimensions, Row x Column (row,col)
o There will be an even number of columns.

(0,0)
0

 

(0,1)
0
0

 

(0,2)
0

 

(0,3)
0

 

(1,0)
0
0

 

(1,1) 0

 

(1,2) 0
0
0

 

(1,3) 0

 

(2,0)
0

 

(2,1)
0
0

 

(2,2)
0

 

(2,3)
0

0
0
0 0 0
0 0 0 0
0 0 0
0 0
head
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
8
Deletion
o Remove only one node at a time
o Keep horizontal connections, through the deleted node
Fix adjacent nodes connections
o Keep vertical connections, through the delete node
Fix adjacent nodes connections
o Many examples to follow
Delete Node (1,2)
0

0
0

0
0 0 0

0
0

 

0

0
0

0

 

0
0

0 0 0 0
0 0 0

0

 

0

 

0

 

0

 

0

 

0

0 0
head
Delete Node (1,1)
0

0
0

0
0 0 0

0

 

0
0
0
0
0

 

0

0 0 0 0
0 0 0

0

 

0

 

0

 

0

 

0

0 0
head
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
9
Delete Node (1,0)
0 0
0
0 0 0

0
0

 

0

0

0
0
0

 

0

 

0
0

0 0 0 0
0 0 0

0

 

0

 

0

 

0

 

0

0
head
0
Delete Node (0,2)
0

0
0

0
0 0

0 0
0

 

0

 

0
0

 

0
0

 

0

0 0 0 0
0 0 0

0

 

0

 

0

 

0

 

0

0 0
head

Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
10
Delete Node (0,3)
0

0
0

0
0 0

0
0

0

0
0
0

 

0

 

0
0

0 0 0 0
0 0

0

 

0

 

0

 

0

 

0

0 0
head
0
Delete Node (2,3)
0

0
0

0
0 0 0

0
0

 

0

 

0
0
0

0

0
0

0 0 0
0 0

0

0

0

 

0

 

0

 

0

0 0
head
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
11
Delete Node (0,1)
0

0
0

0
0 0
0

0

 

0
0
0

 

0

 

0
0

0 0 0 0
0 0 0

0

 

0

 

0

 

0

 

0

 

0

0 0
head
Delete Node (1,3)
0

0
0

0
0 0 0

0
0

 

0
0
0

 

0
0

0 0 0 0
0 0
0

0

 

0

 

0

 

0

 

0

0 0
head
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
12
Delete Node (2,0)
0

0

0
0 0 0

0
0

 

0

 

0
0
0

 

0

 

0
0

0 0 0
0
0 0 0

0

 

0

 

0

 

0

 

0

0
0
head
Delete Node (0,0)
0 0 0

0
0

 

0

 

0

 

0
0
0

 

0

 

0
0

0 0 0 0
0 0 0

0

 

0

0

0

 

0

 

0

0 0
head
0
Optimized C++ use Adobe Reader to complete Submission Report
CSC 361/461
(Type in fields) Keenan
Optimized C++
Programming Assignment
13
Simple checklist to make sure that everything is submitted correctly
Is the project compiling and running without any errors or warnings?
Does the project run ALL the unit tests execute without crashing?
Is the submission report filled in and submitted to perforce?
Follow the verification process for perforce
o Is all the code there and compiles “as-is”?
o No extra files
Is the project leaking memory?
Most assignments will have hints in a section like this.
Do many little check-ins
o Iteration is easy and it helps.
o Perforce is good at it.
Do diagrams…
Validation
Hints