CSCI 200 - Summer 2023
Foundational Programming Concepts & Design

Lab 6C - SFML: Maze Drawer

This lab is due by Thursday, May 04, 2023, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.

The process of determing if a maze can be solved will be done in two phases. First, we will read in and visualize the maze. Then we will look for a path from start to end (if one exists).


Maze Files


A maze pack has been provided with many sample mazes. The format of the maze file is:

R C
#####
#S#E#
#...#
#####

The first line specifies the size of the maze as R rows and C columns. Next, an RxC 2D array of characters follow. The following properties describe the makeup of the character array:


Loading the Maze


Begin by checking if a command line argument was specified with the filename. If not, prompt the user to enter a file containing the maze. As you read the file, create a 2D list of characters that matches the size of the maze. Read the maze contents into your 2D list. Be sure to note what location the S character is in to start your upcoming search.


Drawing the Maze


Each space in our maze will be a 15x15 rectangle. Create an SFML window that has a width of 15*C and height of 15*R. Inside of the draw loop, loop over every row & column in the maze array. Create a RectangleShape that is sized and positioned accordingly. Color the rectangle based on the value in the maze at that position:

The visualization of Maze 1 is shown below:

Maze 1

The visualization of Maze 4 is shown below:

Maze 4

Lab Submission


Submit your main.cpp, Makefile, *.h, *.cpp, *.hpp file(s).

You will submit your solution to this lab with the rest of Set6. Detailed instructions for doing this are posted in Assignment 6.


This lab is due by Thursday, May 04, 2023, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.