→This assignment is due by Thursday, May 04, 2023, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
→ Do not forget to complete the following labs with this set: L6A,
L6B,
L6C
←
→ Do not forget to complete zyBooks Assignment 6 for this set.←
· Instructions · Rubric · Best Practices · Submission Process · Submission Contents ·
For this assignment you will build upon Lab6C - Maze Drawer. This piece will now animate a solution to the maze, such as Maze 7 below.
![Maze 7](images/maze7.png)
Solve the Maze (Maybe)
Before the maze has been drawn, ask the user via the terminal how they wish to solve the maze. Either by BFS or by DFS.
Based on the user's selection, search the maze using BFS with a Queue or DFS with a Stack as appropriate. Begin your search at
the S
space and continue until the E
space is reached or the search is exhausted.
When the search is complete, draw the maze with visited cells colored Magenta.
An example of a successful BFS search is shown below:
![Maze 7 BFS](images/maze7_bfs.png)
An example of a successful DFS search is shown below:
![Maze 7 DFS](images/maze7_dfs.png)
An example of an unsuccessful search is shown below:
![Maze 4 Unsolvable](images/maze4_unsolved.png)
Animating the Solve
To animate each step of the search process, we'll use the draw loop as the loop for our search process. Each iteration, we will do a few steps:
- clear the current window
- Draw the current maze state (walls = Black, unvisited = white, visited = Magena, start = Green, end = Red)
- Get our next location to process (if it exists)
- Check if it's the end location
- Print end reached
- For the purposes of our animation - empty the list of nodes to process to halt the search
- If it's not the end location
- Check each neighbor to potentially add to list to process
- display the current window
- check for events (window close, q or escape keypress)
- Tell SFML to sleep for a brief amount of time - without this, the animation will run as fast as the window can redraw. We'll explicitly put in a delay
before drawing the next frame. This delay equates to our framerate. Choose a delay of 50 milliseconds, which equates to 20 frames per second. The
following SFML call will sleep for
n
milliseconds:
You may tune this value up or down as you are testing to trace the process of your search algorithm.sf::sleep( sf::milliseconds(n) );
An example of a partial search in progress is shown below:
![Maze 3 Partially Solved](images/maze3_partial_solve.png)
Extra Credit
There are two potential extra credit pieces:
- Color potential cells to explore Blue. These are locations that have been added to the neighbors to process list but not yet visited to check.
- Color the path from start to end in Yellow.
An example of both is shown below;
![Maze 3 DFS Path](images/maze3_dfs_path.png)
Testing
The graders will build your program with the Makefile you provide to match your code structure and run your program against five private test mazes.
Best Practices To Follow
· Code Style · Code Correctness · Code Structure · Dynamic Memory Management · Software Engineering Design Principles ·
Code Style
The following set of guidelines ensure all code in this class will be written in a similar and consistent manner, allowing any reader to understand the program's intent and contents.
- One clear and consistent coding style used (such as K&R, 1TBS, or Allman).
- Course naming scheme is followed for variable, function, class, and other identifiers. See the course style guide for more specifics.
- Code is self-documenting. Variables sensibly named, function names descriptive of their purpose.
Code Correctness
The following set of guidelines ensure all programs written in this class behave properly without side effects.
- Code compiles and links without any errors or warnings.
- Program runs without any run time errors. Exceptions are properly caught, user input is validated appropriately, and program exits successfully without error.
- Use
const
wherever possible:- If you declare a variable and that variable is never modified, that variable should be
const
. - If your function takes a parameter and does not modify that parameter, that parameter should be
const
. - If a member function does not modify the callee, that member function should be
const
. - If you are pointing at a value that does not change, the pointer should point at a constant value (e.g.
const T*
). - If the pointer itself is never modified, the pointer should be a constant pointer (e.g.
T* const
). - If the pointer itself is never modified AND the value pointed at does not change, the pointer should be a constant pointer AND the pointer should point at a constant value (e.g.
const T* const
).
- If you declare a variable and that variable is never modified, that variable should be
Code Structure
The following set of guidelines ensure all programs written in this class are done in an abstracted, modular, extendable, and flexible manner.
- Do not use global variables unless absolutely necessary. Instead, encapsulate them and design your interfaces effectively. If there is no way around using a global variable, be prepared to defend and justify its usage.
- Program flow uses structural blocks (conditionals/loops) effectively, appropriately, and efficiently.
- Keep your headers clean. Put the absolute minimum required in your headers for your interface to be used.
Anything that can go in a source file should. Do not
#include
any system headers in your .h files that are not absolutely required in that file specifically. Do not addusing namespace
in headers. - Use header guards correctly and appropriately.
- Place templated class and function definitions in a
*.hpp
file. - Place static class and function definitions in abstracted
*.h
and*.cpp
files. - Place each class and structure in their own files as appropriate based on their makeup.
Dynamic Memory Management
The following set of guidelines ensure all programs written in this class behave properly without side effects.
- Implement the Big-3 as appropriate.
- Do not leak memory. Every allocation using
new
needs to have a correspondingdelete
.
Software Engineering Design Principles
The following set of guidelines ensure all program components written in this class are done in an abstracted, modular, extendable, and flexible manner.
- Follow and apply the following design principles:
- Write Once, Use Many / Write Once, Read Many (WORM) / Don't Repeat Yourself (DRY): Use loops, functions, classes, and
const
as appropriate. - Encapsulate what varies: Use functions and classes as appropriate. Identify the aspects that vary and separate them from what stays the same.
- Favor composition over inheritance.
- Program to an interface, not an implementation & SOLID Principles: When using object-oriented inheritance & polymorphism, do the following:
- No variable should hold a reference to a concrete class.
- No class should derive from a concrete class.
- No method should override an implemented method from any of its base classes.
- Use appropriate inheritance access. Only expose necessary members to derived classes and/or publicly.
- Use
virtual
andoverride
as appropriate. Mark members asfinal
wherever possible and/or appropriate on derived classes.
- Write Once, Use Many / Write Once, Read Many (WORM) / Don't Repeat Yourself (DRY): Use loops, functions, classes, and
Grading Rubric
Your submission will be graded according to the following rubric.
Points | Requirement Description |
15 | All labs completed and submitted L6A, L6B, L6C |
4 | Maze displayed in SFML. |
4 | Maze searching animated in SFML. |
4 | Solves a maze with edge walls and no loops using BFS & DFS. |
6 | Solves a maze with edge walls and loops using BFS & DFS. |
6 | Solves a maze with no edge walls using BFS & DFS. |
4 | Solves a maze with no solution using BFS & DFS. |
3 | Public mazes solved correctly. |
2 | Private mazes solved correctly. |
+3 | A6 Extra Credit |
5 | Best practices are followed:
|
0 | Submission structured appropriately. Submissions structured improperly will receive deductions. |
53 | Total Points |
→This assignment is due by Thursday, May 04, 2023, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
→ Do not forget to complete the following labs with this set: L6A,
L6B,
L6C
←
→ Do not forget to complete zyBooks Assignment 6 for this set.←
Submission
Always, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available.
It is critical that you follow these steps when submitting homework.
If you do not follow these instructions, your assignment will receive a major deduction. Why all the fuss? Because we have several hundred of these assignments to grade, and we use computer tools to automate as much of the process as possible. If you deviate from these instructions, our grading tools will not work.
Submission Instructions
Here are step-by-step instructions for submitting your homework properly:
-
Make sure you have the appropriate comment header block at the top of every source code file for this set. The header
block should include the following information at a minimum.
Be sure to fill in the appropriate information, including:/* CSCI 200: Assignment 6: A6 - SFML: Maze Runner
* * Author: XXXX (INSERT_NAME) * Resources used (Office Hours, Tutoring, Other Students, etc & in what capacity): * // list here any outside assistance you used/received while following the * // CS@Mines Collaboration Policy and the Mines Academic Code of Honor * * XXXXXXXX (MORE_COMPLETE_DESCRIPTION_HERE) */- Assignment number
- Assignment title
- Your name
- If you received any type of assistance (office hours - whose, tutoring - when), then list where/what/who gave you the assistance and describe the assistance received
- A description of the assignment task and what the code in this file accomplishes.
Additionally, update theMakefile
for A6 to generate a target executable namedA6
.
- File and folder names are extremely important in this process.
Please double-check carefully, to ensure things are named correctly.
- The top-level folder of your project must be named
Set6
- Inside
Set6
, create 4 sub-folders that are required for this Set. The name of each sub-folder is defined in that Set (e.g.L6A
,L6B
,L6C
, andA6
). - Copy your files into the subdirectories of
Set6
(steps 2-3), zip thisSet6
folder (steps 4-5), and then submit the zipped file (steps 6-11) to Canvas. - For example, when you zip/submit
Set6
, there will be 4 sub-folders calledL6A
,L6B
,L6C
, andA6
inside theSet6
folder, and each of these sub-folders will have the associated files.
- The top-level folder of your project must be named
- Using Windows Explorer (not to be confused with Internet Explorer), find the files
named
main.cpp, Makefile, *.hpp, *.h, *.cpp
.
STOP: Are you really sure you are viewing the correct assignment's folder? - Now, for A6, right click on
main.cpp, Makefile, *.hpp, *.h, *.cpp
to copy the files. Then, return to theSet6/A6
folder and right click to paste the files. In other words, put a copy of your homework'smain.cpp, Makefile, *.hpp, *.h, *.cpp
source code into theSet6/A6
folder.
Follow the same steps for each lab to put a copy of each lab's deliverable into theSet6/L6
folders. Do this process forSet6/L6A
(main.cpp, Makefile, List.hpp, Array.hpp, LinkedList.hpp
),Set6/L6B
(main.cpp, Makefile, List.hpp, Array.hpp, LinkedList.hpp
),Set6/L6C
(main.cpp, Makefile, *.h, *.cpp, *.hpp
).
STOP: Are you sure yourSet6
folder now has all your code to submit?
The structure of the submission is as follows:- Set6/
- A6/
- main.cpp
- Makefile
- *.hpp
- *.h
- *.cpp
- L6A/
- main.cpp
- Makefile
- List.hpp
- Array.hpp
- LinkedList.hpp
- L6B/
- main.cpp
- Makefile
- List.hpp
- Array.hpp
- LinkedList.hpp
- L6C/
- main.cpp
- Makefile
- *.h
- *.cpp
- *.hpp
- A6/
*
only if present and appropriate to the implementation.
- Set6/
- Now, right-click on the
"Set6"
folder.- In the pop-up menu that opens, move the mouse
"Send to..."
and expand the sub-menu. - In the sub-menu that opens, select
"Compressed (zipped) folder"
.
STOP: Are you really sure you are zipping aSet6
folder with sub-folders that each contain amain.cpp
file in it?
- In the pop-up menu that opens, move the mouse
- After the previous step, you should now see a
"Set6.zip"
file.
- Now visit the Canvas page for this course
and click the
"Assignments"
button in the sidebar.
- Find Set6, click on it, find the
"Submit Assignment"
area, and then click the"Choose File"
button.
- Find the
"Set6.zip"
file created earlier and click the"Open"
button.
STOP: Are you really sure you are selecting the right homework assignment? Are you double-sure?
- WAIT! There's one more super-important step. Click on the blue
"Submit Assignment"
button to submit your homework.
- No, really, make sure you click the
"Submit Assignment"
button to actually submit your homework. Clicking the"Choose File"
button in the previous step kind of makes it feel like you're done, but you must click the Submit button as well! And you must allow the file time to upload before you turn off your computer!
- Canvas should say "Submitted!". Click "Submission Details" and you can download the zip file you just submitted. In other words, verify you submitted what you think you submitted!
In summary, you must zip the "Set6"
folder
and only the "Set6"
folder, this zip folder must have several sub-folders, you must name all these folders correctly, you must submit the correct zip file for this
homework, and you must click the "Submit Assignment"
button. Not doing these steps is like bringing your
homework to class but forgetting to hand it in. No concessions will be made for
incorrectly submitted work. If you incorrectly submit your homework, we will not be able to
give you full credit. And that makes us unhappy.
→This assignment is due by Thursday, May 04, 2023, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
→ Do not forget to complete the following labs with this set: L6A,
L6B,
L6C
←
→ Do not forget to complete zyBooks Assignment 6 for this set.←