This project is a Python program that represents a small world as a graph of ten towns, stored using an adjacency list. The user selects a start and end point, and the program traverses the graph to determine and highlight the path between them. It loads location descriptions from a file and uses Pygame to draw the nodes, edges, labels, and wagon sprite on the map. The project demonstrates core concepts such as graph traversal, file handling, functions, and basic 2D rendering in Pygame.
Languages Used:
Frameworks/Technologies Used:
Key Features:
Graph Representation & Adjacency Lists
-
The world map is modeled as a graph using a dictionary-based adjacency list to store connections between locations.
-
Path traversal is implemented using basic list-processing and lookup operations.
-
Nodes are displayed visually, and edges are drawn to reflect the structure of the graph.
File Handling for Location Descriptions
-
Location data is loaded from an external text file that maps indices to descriptions.
-
The program reads, parses, and displays the appropriate description when a location is reached.
-
Demonstrates fundamental file I/O and string processing in Python.
Structured Program Design
-
Key logic is organized into functions for reuse.
-
Variables, lists, and dictionaries are used to manage nodes, edges, positions, and display text.
-
A simple pipeline guides the user from input selection to path calculation and final rendering.
Pygame Rendering & User Display
-
Uses Pygame to render nodes, edges, labels, and a wagon sprite on top of a background map.
-
Handles basic event processing, updates, and drawing cycles.
-
Provides a simple visual representation of graph traversal outcomes.