A module to draw labyrinth maps and navigate through them. This is intended for teaching.
Project description
Starcode Labyrinth
Copyright (C) 2022 - Benjamin Paassen
starcode
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/.
Introduction
This module provides functions to draw labyrinth maps and execute agents in form of finite state machines on them. This module is intended for teaching, in particular during the courses of starcode.
Overview
The key concept for this module is that of an agent which navigates a labyrinth. To initialize a new agent, you need to initialize a new game state as follows:
from starcode_labyrinth import state
my_state = state.State(level = 0)
The state object receives a level as input. Our package offers several standard levels which are part of the didactic concept of starcode. You can also provide your own levels, if you wish. Please refer to the source code documentation for more details.
Once you have initialized your game state, you can tell the agent
to move()
, turn_left()
, or turn_right()
.
my_state.move()
my_state.turn_left()
my_state.turn_right()
To display the agent's current state, use the draw_state()
function.
my_state.draw_state()
To display the entire motion up to this point, use the draw_trace()
function.
my_state.draw_trace()
As additional functions, we provide is_free()
which returns True
if and only if the agent could move ahead, and is_goal()
if and only if the agent is currently located at a goal position (the orange star in the pictures).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file starcode_labyrinth-0.2.1.tar.gz
.
File metadata
- Download URL: starcode_labyrinth-0.2.1.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f758c51fad9366d23b5a720fc4d53a274bc1e32156e7e7db1c90458e2beed14 |
|
MD5 | 458772bf4050929ff5cfeefb3b20bdc5 |
|
BLAKE2b-256 | 5f26a2d90568fa45b04e6cea85fff7024598c8f0d28f4cbf04dce9d1300b3a04 |