Bawkbawk²
Bawkbawk² is a variant of Bawkbawk that is much easier to read and looks more "in the language of the chickens", but on text. It is made by User:Lilchiky.
Designed by | User:Lilchiky |
---|---|
Appeared in | 2023 |
Computational class | Turing Complete |
Reference implementation | https://replit.com/@lilchiky/Bawkbawk2 |
File extension(s) | .bawksq |
Syntax and Overview
Bawkbawk² has (not so) similar syntax as Bawkbawk, but it has many more features.
One of the major differences is that Bawkbawk² no longer has a limit on the amount loops available.
Chickens
Bawkbawk² has a data type called a 'chicken'. A chicken has a single character as an identifier and
can store Bawkbawk² code, there can be unlimited chickens; however, you may only append one character
at a time to the chicken. You can now append to the chicken in bulk with code grouping!
A chicken's scripts can be ran using the √
command, followed by the identifier,
and it will concurrently run along the main chicken.
Commands
Even though Bawkbawk² still has one cell of memoryBawkbawk² now has unbounded memory and the mathematical operations now work on
base-15 numbers instead of binary numbers. The value of the cell is still in decimal.
The (modified, new and removed) commands are:
Command | Bawkbawk equivalent | Function |
---|---|---|
° | theeggcamefirst |
Multiply |
/ | rationtheworms |
Divide and truncate |
^ | flyoverthehouse |
Jump to the specified command |
> | chirp |
Outputs the current cell's value |
~ | forage |
See here |
∆ | dig |
User input |
Π | None | Get raw user input (only accepts base-15) |
∅ | emptypocket |
Skip the next command if cell = 0 |
¼ | None | Skip the next command if cell >= 1 |
v | peck |
Decrement the cell |
! | feed |
Increment the cell |
« | retrace |
Jump to the beginning |
Removed | happy |
Binary 1 |
Removed | sad |
Binary 0 |
' | think /endthink |
Start/end of comment |
% | None | Modulo |
§ | None | Print the value of the cell without conversion to characters |
¶ | feed forage sad sad sad sad happy sad happy sad theeggcamefirst chirp |
Print a newline |
• | forage sad theeggcamefirst |
Set the cell to 0 |
¿ | None | Increase the accumulator by a random number between 1 and 0 |
↑ | None | Terminate the program |
< | None | Creates a chicken |
√ | None | Executes a chicken |
( | None | Code grouping, see here |
) | None | Code grouping |
¡ | None | Increase the pointer |
← | None | Decrease the pointer |
♪ | None | Switch between axis (x and y) |
Newlines are ignored.
Memory
Bawkbawk² has unbounded memory of a 2-dimensional plane along positive-x and positive-y, and the pointer begins at (0, 0)
(meaning x and y cannot be below 0). The pointer travels along the x-axis by default and can be changed via ♪
.
Code grouping
Code can be grouped with (
and )
, which can used to append code to a chicken in bulk, like this:
[identifier] ( [code] )
<
and √
A chicken can be created with <
and executed with √
.
The syntax for <
is as follows:
[code (a single command)] < [identifier]
[code]
is a single command that will be appended to the chicken with the mentioned [identifier]
.
A chicken is ran as follows:
√ [identifier]
~ (forage)
The ~
command may be hard to understand at first. Its usage is as follows:
~ [pentadecimal number] [suffix]
[pentadecimal number]
can be any base-15 number, like a5
or 3d9
.
[suffix]
can be any of the following commands:
- °
- /
- ^
- %
Example for all 4 of them:
° (theeggcamefirst)
!~483° §
Does 1 * 1023
.
/ (rationtheworms)
!~400° ~30/ §
Does 900 / 45
% (modulo)
!~400° ~2d% §
Does 900 % 43
^ (flyoverthehouse)
!§¶°1^
Counts.
Examples
Hello, World!
!~4c°>•!~6b°>•!~73°>>•!~76°>• !~2e°>•!~22°>• !~7e°>•!~76°>•!~79°>•!~73°>•!~6a°>• !~23°>
99 bottles of beer
!~69° b( §¡•!~22°>•!~68°>•!~76°>•!~7b°>•!~7b°>•!~73°>•!~6b°> •!~7a°>•!~22°>•!~76°>•!~6c°>•!~22°>•!~68°>•!~6b°> •!~6b°>•!~79°>•!~22°>•!~76°>•!~75°>•!~22°>•!~7b°> •!~6e°>•!~6b°>•!~22°>•!~7e°>•!~67°>•!~73°>•!~73°> •!~2e°>•!~a°>¶← §¡•!~22°>•!~68°>•!~76°>•!~7b°>•!~7b°>•!~73°>•!~6b°> •!~7a°>•!~22°>•!~76°>•!~6c°>•!~22°>•!~68°>•!~6b°> •!~6b°>•!~79°>•!~31°>← •!~a°>•!~59°>•!~67°>•!~72°>•!~6b°>•!~22°>•!~76°>•!~75°>•!~6b°>•!~22°>•!~6a°> •!~76°>•!~7e°>•!~75°>•!~22°>•!~67°>•!~75°>•!~6a°>•!~22°>•!~77°>•!~67°>•!~7a°> •!~7a°>•!~22°>•!~70°>•!~7b°>•!~22°>•!~67°>•!~79°>•!~76°>•!~7c°>•!~75°>•!~6a°> •!~2e°>•!~a°>←v §¡•!~22°>•!~68°>•!~76°>•!~7b°>•!~7b°>•!~73°>•!~6b°> •!~7a°>•!~22°>•!~76°>•!~6c°>•!~22°>•!~68°>•!~6b°> •!~6b°>•!~79°>•!~31°>¶¶←∅« ) √b
Displays '0 bottles on the wall' at the end.
(This program was generated with this script.)
Convert base-15 into decimal
Π§
Π
automatically converts its input into decimal if possible.
Cat program
∆>¶«
Truth machine
Π§¼↑§~5^
Or, preferably, an unoptimized version that makes use of chickens:
§<c«<cΠ§¼↑√c
Or you could do this:
c(§«)Π§¼↑√c
Text to Bawkbawk²
Converting text to Bawkbawk² is really easy.
To convert text to Bawkbawk², you get the ASCII code for each character, then convert it into pentadecimal and add on
•!~[pentadecimal]°>
then add it together, like so:
h — 104 e — 101 l — 108 l — 108 o — 111 104 -> •!~6e°> 101 -> •!~6b°> 108 -> •!~73°> 108 -> •!~73°> 111 -> •!~76°> hello = •!~6e°>•!~6b°>•!~73°>•!~73°>•!~76°>
Converter in Python
def text_to_bawkbawk(string): result = '' for char in string: ascii_ = ord(char) pentadecimal = "" while ascii_ > 0: dig = int(ascii_%15) if dig < 10: pentadecimal += str(dig) else: pentadecimal += chr(ord('a')+dig-10) ascii_ //= 15 pentadecimal = pentadecimal[::-1] result += f'•!~{pentadecimal}°>' return result
Computational class
Bawkbawk² is (probably) Turing-complete.
This can be proved by translating a Minsky machine to Bawkbawk². In a Minsky machine, there are two instructions available:
- Increment the register and move to the next
- Decrement the register and move to the next; unless it is 0, then skip to another instruction.
Checking for a 0
in a register could be done like this:
∅√a
assuming the chicken named a
contains the code that is needed to run if the register is 0.
From here it is (at least it should be) straightforward to convert any Minsky machine into Bawkbawk². Since the set of Minsky machines is Turing-complete, Bawkbawk² should also be Turing Complete.
Implementations
This is the original implementation.