Skip to content

jdc88/Coin-Constrained-Path-Finder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coin-Constrained Path Finder

⟡ Project Statement

Coin-Constrained Path Finder is an interactive GUI application where users select a starting city, a destination, and a total number of available coins. Each path between cities has two associated values: distance and coin cost. We use the A* algorithm to find the shortest feasible path while respecting the coin constraint. The GUI visualizes the algorithm in real time, displays the paths explored, and highlights the optimal route generated by the AI.

⟡ Purpose of Files

main.py

  • Application entry point that initializes the graph, creates the GUI window, and starts the application.

gui.py

  • Creates the interactive game interface with a dual-panel layout.
  • Handles user input, click-to-move gameplay, real-time visualization of the graph, and displays comparisons between user paths and AI-generated optimal solutions.

nodes.py

  • Defines the City class representing individual nodes in the graph.
  • Each city stores its name, heuristic value, and connections to neighboring cities with their associated distance and coin costs.

graph.py

  • Manages the overall graph structure, storing all cities and their positions.
  • Provides methods to add cities, create connections, and includes factory functions to generate pre-configured graph layouts with different strategic trade-offs, taking into consideration distance and coin constraints.

pathfinder.py

  • Implements the A* search algorithm with coin constraints.
  • Finds the optimal path between nodes while respecting the coin budget, tracking visited nodes and explored paths for visualization purposes.

⟡ Tools Used

  • Python
  • Tkinter for building the graphical user interface

⟡ Algorithms Used

◌ Graphs (nodes with names, heuristics, and weighted connections)
◌ A* search algorithm adapted with coin constraints
◌ Priority queues (via heapq) for efficient node selection

⟡ Running the Project Locally

  1. Clone the project
git clone https://github.com/jdc88/Coin-Constrained-Path-Finder
  1. Run
python3 main.py

⟡ Check Demo here

Developed by Sama Ahmed, Josephine Choi, Karla Ramirez

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages