Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DFS-Based Reflex Agent Simulator (Pacman AI)

This project features the implementation of two distinct architectural strategies for a Depth-First Search (DFS) reflex agent designed to navigate and solve maze environments within the UC Berkeley Pacman AI framework.


Important System Requirement

Note: This framework is natively built using Python 2. Running the simulation using Python 3 will result in a SyntaxError: Missing parentheses in call to 'print'. Please ensure you have Python 2.7 installed on your machine to execute the agents successfully.


Core Implementations

1. Version A: Recursive DFS

  • Concept: Implements standard depth-limited DFS using pure recursion.
  • Mechanism: Tracks visited nodes and leverages the implicit system call stack to manage backtracking behaviors across maze branches.

2. Version B: Iterative (Stack-Based) DFS

  • Concept: Implements DFS using an explicit stack array.
  • Mechanism: Simulates recursion manually by managing an explicit Python list as a stack structure, allowing control over memory boundaries and deeper maze state evaluations.

3. Agent Integration

  • Both strategies are integrated into a unified agent execution loop.
  • A runtime toggle is supported via standard command-line arguments.

Evaluation & Metrics Summary

Both configurations were execution-tested 10 times across multiple maze topologies (open, medium, and tiny layouts) to benchmark:

  • Total visited nodes and routing paths.
  • Execution runtime efficiency.
  • System call stack depth vs. explicit memory footprint.

Installation

git clone [https://github.com/MariamAshraf25/recursive-vs-stack-dfs-reflex-agent.git](https://github.com/MariamAshraf25/recursive-vs-stack-dfs-reflex-agent.git)

Author

Mariam Ashraf | Computer Engineering Student | Faculty of Engineering - Capital University (Formerly Helwan)
LinkedIn Profile

About

Two implementations of a DFS-based reflex agent to explore search mazes (Recursive vs. Iterative/Stack-Based) within the UC Berkeley Pacman framework. Optimized for Python 2.7.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages