o
odinpkg.dev
packages / library / Odin_Bonsai

Odin_Bonsai

6d44e23library

This is a port to Odin of the procedure generated ASCII art bonsai tree generator PyBonsai by Ben-Edwards44.

No license · updated 8 months ago

Odin Bonsai

This is a port to Odin of the procedure generated ASCII art bonsai tree generator PyBonsai by Ben-Edwards44.

Description

  • Procedurally generates ASCII art trees in your terminal
  • Multiple tree types : Classic, Fibonacci, Offset Fibonacci, and Random Offset Fibonacci
  • Animated drawing with adjustable speed
  • Colorful output using ANSI escape codes
  • Customizable tree parameters

Tree images

./tree_images/tree_001.png

./tree_images/tree_002.png

./tree_images/tree_003.png

./tree_images/tree_004.png

Building

Make sure you have the Odin compiler installed.

make

Usage

./odin_bonsai [OPTIONS]

Options

  • -h, --help - Display help
  • --version - Display version
  • -s, --seed - Seed for the random number generator
  • -i, --instant - Instant mode: display finished tree immediately
  • -w, --wait - Time delay between drawing characters (default: 0)
  • -c, --branch-chars - String of chars randomly chosen for branches (default: "~;:=")
  • -C, --leaf-chars - String of chars randomly chosen for leaves (default: "&%#@")
  • -x, --width - Maximum width of the tree (default: 80)
  • -y, --height - Maximum height of the tree (default: 25)
  • -t, --type - Tree type: integer between 0 and 3 inclusive (default: random)
    • 0: Classic Tree
    • 1: Fibonacci Tree
    • 2: Offset Fibonacci Tree
    • 3: Random Offset Fibonacci Tree
  • -S, --start-len - Length of the root branch (default: 15)
  • -L, --leaf-len - Length of each leaf (default: 4)
  • -l, --layers - Number of branch layers (default: 8)
  • -a, --angle - Mean angle of branches to their parent, in degrees (default: 40)
  • -f, --fixed-window - Do not allow window height to increase

Examples

Generate a tree with instant display:

./odinbonsai -i

Generate a tree with animation:

./odinbonsai -w 0.01

Generate a specific tree type with custom parameters:

./odinbonsai -t 2 -l 10 -a 30 -i

Generate a reproducible tree with a seed:

./odinbonsai -s 12345 -i

Attribution

Ported from PyBonsai Ben-Edwards44
https://github.com/Ben-Edwards44/PyBonsai.

Original quote:

I speak for the trees, for the trees have no voice.

  • The Lorax, 1971

License

License MIT Open source

Have fun

Best regards,
Joao Carvalho