Bunnicula

From Esolang
Jump to navigation Jump to search

This is an unfinished article, as of 1:23 AM i am tired but i hope to finish this because i enjoy this idea

Bunnicula is a binary based programming language, that has no conditionals or loops. Bunnicula works on normally an 8 bit memory space. This is all the memory that is allocated and all instructions affect the whole thing. Bunnicula is created by User:RainbowDash to showcase that you don't need fancy stuff to compute a lot of functions. You only need a clever way of looking at a situation. The core base of bunnicula can be ran using only an ALU, 8 bits of memory, ROM and a program counter.

Bunnicula comes in 2 flavors. A single character per instruction approach or an assembly style program.

Command Character Description
> Rotate right
< Rotate left
+ Increment memory space
- Decrement memory space
. Output all of memory space
[ Input a character and store it in the cell at the pointer
[ This loads the given binary pattern into the LSBs
] This is an indicator to end, putting the binary pattern into memory.
( Takes in 2 args A,B and takes a slice out of memory space according to A,B and prints it
) Prints the slice as the 2 arguments demand in (.


Command Assembly Description
INC X Increments memory space by X
DEC X Decrements memory space by X
INVERT_ALL Inverts all bits
INVERT_BIT X Inverts bit X where 0 is the LSB and 1 is the bit to the left of that one, etc.
ROL X Rolls memory left by X
ROR X Rolls memory right by X
NOP No operation

The following page will continue with the assembly style but they can be used interchangeably.

Programming

Programming is mostly done with aid of a computer assistant to find programs based off of binary truth tables. Here is one such truth table computed, it is a rock paper scissors truth table

  ##################################################
  This is the truth table that is being computed
  00 = Rock     Tie = 00
  01 = Paper    Lose = 01
  10 = Scissors Win = 10
  Input          Output
  [0, 0, 0, 0] > [0, 0]  # Rock vs Rock > Tie
  [0, 0, 0, 1] > [0, 1]  # Rock vs Paper > Lose
  [0, 0, 1, 0] > [1, 0]  # Rock vs Scissors > Win
  [0, 1, 0, 0] > [1, 0]  # Paper vs Rock > Win
  [0, 1, 0, 1] > [0, 0]  # Paper vs Paper > Tie
  [0, 1, 1, 0] > [0, 1]  # Paper vs Scissors > Lose
  [1, 0, 0, 0] > [0, 1]  # Scissors vs Rock > Lose
  [1, 0, 0, 1] > [1, 0]  # Scissors vs Paper > Win
  [1, 0, 1, 0] > [0, 0]  # Scissors vs Scissors > Tie

  This program assumes that the input is already stored inside of the 4 LSBs and the output is in the 2  LSBs proceeding the 4 LSBs
  ##################################################

  01: INVERT_BIT 1
  02: INC 3
  03: INVERT_BIT 1
  04: INC 2
  05: INVERT_BIT 2
  06: INC 5
  07: INVERT_BIT 4
  08: INC 6

Now when we run the program with each of the inputs from the truth table we can see we get the output

Input Output
0000 0000 00 00 1000
0000 0001 00 01 1101
0000 0010 00 10 0010
0000 0100 00 10 0100
0000 0101 00 00 1001
0000 0110 00 01 1110
0000 1000 00 01 0000
0000 1001 00 10 0101
0000 1010 00 00 1010

Which lines up directly to our truth table. This computed the winner of a rock paper scissors match with no conditionals. But now what if you want to get the original inputs? Simply reverse the line order and swap all INCs with DECs, and all DECs with INCs and you reversed the program!

Name origin

Bunnicula is named after the 1979 children's novel Bunnicula: A Rabbit-Tale of Mystery, featuring a vampire rabbit who sucks the color from his food.

  1. It is a programming language that you must go back in order to retrieve data.
  2. "What do you call a line of rabbits hopping backwards?" - "A receding hare line"
  3. What is the name of a hare/bunny that reverses something in some way. "Bunnicula" it reverses the roles of a nice little guy to a EVIL messed up dude.

Author notes (to be removed)

I think this is a cool base for computing a lot with not a lot of things like maybe a marble computer. I also used Z3 to find the programs written in this. It's pretty cool you can compute stuff even though it's so limited. I think something a lot like Bunnicula has probably almost most definitely has already been done, but not to this extent showing its full power. Also I put "Reversible computing" but in the character instruction set you can plain and simply paste values into memory which isn't so reversible in the normal sense but most computation in this is reversible and it is also a main helping point when writing programs as I've seen. Don't go too hard on this page as I am tired.