Skip to main content

A toy module to generate a map and find the shortest path from two points on the map

Project description

kiri-pathfinding

PythonVersion PyPi

A toy module to generate a map and find the shortest path from two points on the map

Usage

from matplotlib import pyplot as plt
from kiri_pathfinding.map_generator import generate_map, draw_map
from kiri_pathfinding.pathfinding import PathFinding, draw_path

# genetate a map and find shortest path
data_map = generate_map(20, 20)
pathfinding = PathFinding(data_map)
path = pathfinding.find((0, 0), (19, 19))

# visualize
fig, ax = plt.subplots()
draw_map(data_map, ax)
draw_path(path, ax)

Example

example

The image above visualizes the generated map and the found path from point (0, 0) to point (19, 19).

Different colors on the map mean different terrains. Specifically, the green is grassland and the gray means roads, providing a lower movement cost. The brown and blue denote mud and river respectively, which are harder to pass.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kiri_pathfinding-1.2.0.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

kiri_pathfinding-1.2.0-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page