Skip to main content

A python library for generating random turtles using a hash seed (and for generating seeds/colors)

Project description

SeededTurtle

SeededTurtle is a Python library that allows you to generate random turtles with various properties. It's a fun and creative way to explore the world of programming with Python's turtle graphics. The idea is that the randTurtle function takes a seed as input and produces a resulting "randomized" turtle graphic when you run the program.

The turtle graphic randomization is reproducable based on what the seed is, so if you enter in "iloveturtles" as the seed two seperate times, it will return the same turtle. The library also provides support for randomizing this seed, so you can call the function to get a random seed and use that as the seed for generating a random turtle.

Installation

To install RandTurtle, you can use pip:

pip install randturtle

Usage

The main function in the RandTurtle library is generateRandomTurtle(). This function generates a turtle with random properties based on the provided seed.

Here is an example of how to use it:

from randturtle import generateRandomTurtle

# Generate a random turtle
turtle = generateRandomTurtle("your_seed_here")

The generateRandomTurtle() function takes the following parameters:

  • seed: A string of 16 or more alphanumeric characters or special characters (!@#$%^&*()). This is used to seed the random number generator for the turtle's properties.

  • time (optional): The time in seconds that the turtle will be displayed for before doing anything else. Defaults to 0.

  • fill (optional): The fill color of the turtle. Can be "none", "random", or a string of three comma-separated integers in the format "R,G,B". Defaults to "none".

  • color (optional): The color of the turtle. Can be "random" or a string of three comma-separated integers in the format "R,G,B". Defaults to "random".

If invalid parameters are passed in, the function will raise a RandomTurtleValueError.

For seed randomization as well, simply do:

import seededturtle.randturtle as rt

# Generate a random turtle using a random seed
turtle = generateRandomTurtle(rt.generateRandomSeed())

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Known Issues

The fill

Notes from the creator

This was my second python library deployed (I also created chainhashing), so I still have lots to learn. I know there are probably a few issues with the library/optimizations that could be made, but hopefully people looking to use this library still find use out of it! I've run many test and my conclusion is that there are no functionality errors with this library, but I wouldn't be suprised if someone runs into issues. Any advice/change recommendations are greatly appreciated; feel free to email me at rt.kellar@gmail.com or open an issue on the GitHub page for this library, https://github.com/Ruxton07/SeededTurtle. Enjoy!

License

MIT

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

seededturtle-1.0.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seededturtle-1.0.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file seededturtle-1.0.0.tar.gz.

File metadata

  • Download URL: seededturtle-1.0.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for seededturtle-1.0.0.tar.gz
Algorithm Hash digest
SHA256 568e9d36764312eea8505576328a82d30b28eca1d7783bc082c8dd6952057f02
MD5 3b65f6a8904d52ec8bb68a86ced1f7d4
BLAKE2b-256 9abb3b5c167953d418ea733a09f71b0dc93b00cd1b524f1ad8d20c268a3eec65

See more details on using hashes here.

File details

Details for the file seededturtle-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: seededturtle-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for seededturtle-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9823e09cf9b342834898c9d512315ea01a4cfeea3e6a3811aa6cda78be9a4615
MD5 2a8d7312a91603fe687e5135fe72bf1c
BLAKE2b-256 a5c33fc1f26adbe95c45ad36ac78e63711650aa9cfb0c2277b4b7b2043babae0

See more details on using hashes here.

Supported by

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