Bitbot

From Esolang
Jump to navigation Jump to search
This article is a stub, which means that it is not detailed enough and needs to be expanded. Please help us by adding some more information.
This is still a work in progress. It may be changed in the future.

Bitbot is an esolang created on the 18th of June, 2021 by User:Toxinite.

Overview

Bitbot programs are used to control a data pointer in an infinite 2d grid of bits, starting all at 0. The data pointer also has access to a byte that is carried with it wherever it goes (starting at zero). Bitbot has more complex features too, such as advanced IO ,making your own functions and creating copies of the data pointer called bots[1].

IO Capabilities

There is a toggle-able camera with different zoom and position options, thus allowing graphical output such as basic pictures. Audio output is available too, letting you create simple songs, sound effects and likely more. When the program needs input, it can either wait for an answer or simply use any key that is pressed down.

Commands

Instruction set
Code Description Example code
flip(x) Flips the specified bit (n(x) can be implied)(multiple inputs flips them all) flip(0,1,2,cell)
n(x) Specifies a bit in the portable byte (cell is the cell the data pointer is on)(byte is the entire p-byte) if{n(6) != cell)}[swap(n(6),cell)]
if{x}[y] An if statement (else can be added with else[z])[2] if{cell = 1}[print]
(by:x){y}/(by:bd-x){y} Repeats code the specified amount. (bd-x){y} acts like n(x) and decrements the specific bit (by:6){move} or (by:bd-2){print}
swap(x,y) Swaps two values. Any more than two values is an error swap(n(0),n(1))
turn:l/r Turns the data pointer if{n(0) != 1}[turn:l]else[turn:r]
func{a(%b,{%c}...%n)}[x] Creates a function to make coding easier (definable anywhere and isn't run in the func{x}[y] code)({%c} is a piece of code) func{3in({%have},%any,%name)}[flip(%any,n(%name),cell),{%have}]
audio(x,y,z) Plays audio in which w and x decide if it's sine, square ect[3] and y is frequency in hertz audio(1,1,500)
camera(x,y) Camera in which x is zoom (default is 100) and y is camera movement (1 to follow pointer, 0 for stationary) camera(150,0)
halt(x) Pauses the program for x seconds (halt(input) will wait until there is input) halt(5.8)
input Any key currently pressed byte = input
sendbot{x}[y] Sends the specified bot code (func{x}[y] code can be sent without definition) sendbot{1,87}[print]
killbot(x) Deletes the specified bot (killbot(0) will work but is a bad idea as the data pointer will be deleted) killbot(2)
makebot Creates a new bot
move Moves the data pointer forwards
print Prints the p-byte as an ASCII character
camtoggle Toggles the camera on or off
stopsound(x,y) Stops sounds of the specified pure tone (see reference 3)
#x# Used as a multi-line comment

Small programs

Hello world:

byte = 01001000, print,
byte = 01100101, print,
byte = 01101100, print, print,
byte = 01101111, print,
byte = 00101100, print,
byte = 00100000, print,
byte = 01110111, print,
byte = 01101111, print,
byte = 01110010, print,
byte = 01101100, print,
byte = 01100100, print,
byte = 00100001, print,

Truth machine:

halt(input)
byte = input
if{byte = 00110000}[print],
if{byte = 00110001}[flip(cell), (by:bd-cell){print, flip(cell)}],

Cat:

flip(cell),
(by:bd-cell){byte = input, print, flip(cell)},

References

  1. Bots are like the data pointer (each having their own p-byte) but only runs code that is sent to it and only when it is sent. A bot's number is in order of when it was made (1 = 1st, 2 = 2nd ect) and the data pointer has the number 0, letting bots send instructions to the data pointer
  2. You can use (by:bd-x) with it to make a while loop
  3. Sine, square, triangle and sawtooth are 00, 01, 10 and 11 respectively