← Back to Projects

Grid Pointer Maze

Explored pointer-based data structures and memory debugging by navigating a dynamically linked maze in C++

GDBC++PointersMemory ManagementDebugging

About This Project

This project focused on building and exploring a pointer-based maze implemented using dynamic memory allocation in C++. I first implemented a templated two-dimensional Grid abstraction backed by heap-allocated arrays and proper constructors and destructors. This grid abstraction was then used to represent a labyrinth of interconnected rooms, where each room was linked via directional pointers. Using GDB, I manually traced memory addresses to map out the maze, identify walls, and locate key items. The maze is considered solved only when a valid path collects the Spellbook, Potion, and Wand. Changing the maze key regenerates the pointer layout. Additionally if the virtual environment is reset the memory adress may change but the maze has the same shape.

Key Features

  • Created a digital maze game with C++, This project involves the user to debug the created maze utilizing GDB to find a path which collects the Wand, Spellbook and Potion
  • Created the mazes to be unique with a string the user can change, when tested in GDB the addresses are going to be different than the previous version allowing the user to trace through the maze again to find their path out of the maze
  • Developed a grid.h and maze.h which I utilized throughout the project as it was the backbone for my regular maze and twisty maze
  • Utilized if-else statements to make sure the user is inputting only valid moves based on the maze

Technologies Used

  • IDE: zyBooks
  • C++
  • Debugger: GDB
  • Pointers & Dynamic Memory
  • Memory Adress

Challenges & Learnings

Challenges:

This was my first experience working extensively with GDB and low-level pointer debugging. Tracing memory addresses, understanding segmentation faults, and mapping pointer relationships required patience and careful reasoning.

What I Learned:

This project gave me a strong understanding of pointer-based data structures, dynamic memory management, and debugging at the memory level. I learned how constructors and destructors control object lifecycles, how pointer errors lead to segmentation faults, and how powerful debugging tools like GDB are for diagnosing complex systems-level issues.

This project was created in November 2024