Skip to main content

Beatnik

This python package contains functions for stack-based esoteric programming language: Beatnik

Description

Beatink is a stack-based esoteric programming language created by Cliff L. Biffle. This package contains each ACTION functions by the rules of beatnik, and build a stack to calculate the resulted output from the given text.

Scrabble letter values
--- ABCDEFGHIJKLMNOPQRSTUVWXYZ ---
 1: A---E---I--L-NO--RSTU-----
 2: ---D--G-------------------
 3: -BC---------M--P----------
 4: -----F-H-------------VW-Y-
 5: ----------K---------------
 6: --------------------------
 7: --------------------------
 8: ---------J-------------X--
 9: --------------------------
10: ----------------Q--------Z
--- ABCDEFGHIJKLMNOPQRSTUVWXYZ ---

Action list

The following table describes the meaning of the ACTIONS (see above).

Score Pseudo-Code Description
<5 NOOP Does nothing. The Beatnik Interpreter may mock you for your poor scoring, at its discretion.
5 n push(n) Finds the score of the next word and push it onto the stack.
the actual word with 5 is then skipped.
6 pop(n) Pops the top number off the stack and discards it.
7 push(pop()+pop()) Adds the top two values on the stack together
8 push(input()) Input a character from the user and push its value on the stack. Waits for a keypress.
9 print(pop()) Pop a number off the stack and output the corresponding ASCII character to the screen.
10 push(pop()-pop()) Pop two numbers from the stack, subtract the first one popped from the second one popped, and push the result.
11 a = pop(); b = pop(); push(a); push(b) Swap the top two values on the stack.
12 a = pop(); push(a); push(a) Duplicate the top value and pushes the value on top of the stack.
13 n if(top()==0) jump(+n) Pop a number from the stack, and figure out the score of the next word.
If the number from the stack is zero, skip ahead by n words, where n is the score of the next word.
(The skipping is actually n+1 words, because the word scored to give us n is also skipped.)
14 n if(top()!=0) jump(+n) Same as above, except skip if the value on the stack isn't zero.
15 if(top()==0) jump(-n) Skip back n words, if the value on the stack is zero.
16 if(top()!=0) jump(-n) Skip back if it's not zero.
17 exit() Stop the program.
18-23 NOOP Does nothing. However, the score is high enough that the Beatnik Interpreter will not mock you, unless it's had a really bad day.
>23 Generates "Beatnik applause" for the programmer.

Installation

The Blend Modes package can be installed through pip:

pip install beatnik

Import

from beatnik import beatnik_simple
from beatnik import beatnik_stack

Use the example file beatnik_interact


Simple usage of this library

text = "this is a line of text"
beatnik.beatnik_simple(text,debug=True)

Step-by-step

preprocess text

text = "this is a line of text"
words = beatnik.preprocess(text)

scrabbling word

VALUE = []
  for i in word:
      value = beatnik.scrabble(i)
      VALUE.append(value)

words are list of words that before scrabble

running stack machine

beatnik.stack(words,VALUE,debug=False)

License

The Beatnik package is distributed under the MIT License (MIT). Please also take note of the licenses of the dependencies.

Release files for beatnik 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beatnik 1.0
File Size Uploaded
beatnik-1.0.tar.gz 5.7 kB Details

Release files / beatnik-1.0.tar.gz

Download URL beatnik-1.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
63add26bf0df584e35b30da9c30b9788cd345aad2634a593decd235b78db15af
BLAKE2b-256 checksum
How to use checksums
0d92be9af39d795a88d961f7730fb4502b45c9c2cdcb9f91d6208f386269514c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

0.794

1 release file

0.793

1 release file

0.792

1 release file

0.791

1 release file

0.91

1 release file

0.82

1 release file

0.81

1 release file

0.79

1 release file

0.78

1 release file

0.77

1 release file

0.76

1 release file

0.75

1 release file

0.74

1 release file

0.73

1 release file

0.72

1 release file

0.71

1 release file

0.62

1 release file

0.61

1 release file

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

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