Skip to main content

bishopviz

Drunken Bishop algorithm implementation for random ASCII art generation from md5 hashes, and for data visualization from generated art.

demo

Installation

(Recommended) If you have pipx installed:

pipx install bishopviz

Otherwise:

pip install bishopviz

Or, to use the web version, go to https://bishopviz.streamlit.app

Try it

Web App

The web app is the same algorithm, but shows some data visualizations about it. Go to the website, type anything into the text area, and then do ctrl+Enter.

CLI

A quick demo of the colors and animation:

bishopviz -a 0.1 -C

To specify a file to generate randomart for, add the -f flag and then specify a file path.

To see all of the options of the CLI, run:

bishopviz --help

Features

  • md5 hash from a random string or a file
  • Implementation of the drunken bishop algorithm to generate randomart
  • Various character sets (like texture packs!) for the final graph
  • Visualize the algorithm over time via animations and generation count
  • (CLI) Graph with colors representing the visit frequency
  • (Webapp) Web App with data visualizations from the algorithm

CLI Help Menu

Usage: bishopviz [OPTIONS]

  Drunken Bishop algorithm implementation for random ASCII art generation from
  md5 hashes.

Options:
  -f, --file-feed TEXT  Use the contents of any file as the input.
  -a, --animate FLOAT   Display the algorithm's progress as an animation, with
                        the specified number of seconds as the interval
                        between frames.
  -c, --charset TEXT    Use a different character set for the graph. Options:
                        ascii, ascii_alt, emoji, emoji2, emoji3, emoji4,
                        greek, cyrillic, katakana, math, blocks, faces, cars,
                        plants  [default: ascii]
  -C, --colors          Whether to colorize the output.
  -d, --data            Open a Streamlit app to run the algorithm and
                        visualize data.
  --no-start-end        Don't show the start and end positions on the graph.
  -h, --help            Show this message and exit.

How It Works

For a better explanation, check out this awesome paper on the topic.

First, an md5 hash is generated from the input (this can be text, an image, video, etc.). This hash is then encoded into 128 bits, and then split into 64 pairs of 2 bits each.

The algorithm generates a 2-dimensional 17x9 matrix and then tracks the position of a "bishop", which starts off in the middle of the matrix.

It will iterate over the byte pairs and move in a certain direction depending on the pair:

Bit Direction
00 Up, Left
01 Up, Right
10 Down, Left
11 Down, Right

My program, while iterating over the pairs, will track certain variables to then create data visualizations using Streamlit and Plotly.

Technologies/Libraries Used

Download files

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

Source Distribution

bishopviz-1.0.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

bishopviz-1.0.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file bishopviz-1.0.1.tar.gz.

File metadata

  • Download URL: bishopviz-1.0.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for bishopviz-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c49d238752f44970777eaafd0ee81d10ab95dcfe411b3fb3b52fe1be5fce325f
MD5 07effb5c163e7c39d48a49dd49f12746
BLAKE2b-256 d8bf4dff5a482aa5b876d181606c377be803812effb16764d88507c0591f2f67

See more details on using hashes here.

File details

Details for the file bishopviz-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: bishopviz-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for bishopviz-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8897819e85297c0c913e9d450e3887a728542c7e3eb52f39f09f6698b6def07
MD5 4903ba81a22e96149dc8e7bb54d9b6b4
BLAKE2b-256 edf6d2b56e26447ce40c765068339ad6f3acebf3d10c2d3f26734bcc35babd33

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page