Skip to main content

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()

An example state where the agent looks right along a corridor towards the goal.

To display the entire motion up to this point, use the draw_trace() function.

my_state.draw_trace()

An example trace where the agent took a step to the right, then turned left, and then turned right again, such that the agent ended up in the state displayed above.

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


Download files

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

Source Distribution

starcode_labyrinth-0.2.1.tar.gz (20.5 kB view details)

Uploaded Source

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

Hashes for starcode_labyrinth-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2f758c51fad9366d23b5a720fc4d53a274bc1e32156e7e7db1c90458e2beed14
MD5 458772bf4050929ff5cfeefb3b20bdc5
BLAKE2b-256 5f26a2d90568fa45b04e6cea85fff7024598c8f0d28f4cbf04dce9d1300b3a04

See more details on using hashes here.

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