Bitwise Cyclic Teap
Jump to navigation
Jump to search
Bitwise Cyclic Teap (BCTp) is an esolang invented by User:None1, it is a derivative of BCT where data is stored in a heap (a.k.a: priority queue) instead of a queue.
Commands
| Command | Execution |
|---|---|
| 0 | Delete the smallest data-bit. |
| 1 | Goto the next command (say x). If the smallest data-bit is 1, insert x into the data-heap. |
Example
Code: 00111 Data-string: 101 IP: 0 Data-heap: 011 IP: 1 Data-heap: 11 IP: 2 Data-heap: 1 IP: 4 Data-heap: 11 IP: 1 Data-heap: 011 IP: 2 Data-heap: 11 IP: 4 Data-heap: 111 IP: 1 Data-heap: 0111 IP: 2 Data-heap: 111 IP: 4 Data-heap: 1111 IP: 1 Data-heap: 01111 IP: 2 Data-heap: 1111
Interpreter
Python
from time import sleep
from heapq import *
class CyclicList(list):
def __getitem__(self, x):
return super().__getitem__(x % self.__len__())
code = CyclicList(map(int, input("Code: ")))
data = list(map(int, input("Data-string: ")))
heapify(data)
ip = 0
while 1:
print(f'IP: {ip%len(code)}\t Data-heap: {"".join(map(str,sorted(data)))}')
if not code or not data:
print("Halt!")
break
op = code[ip]
if op:
if data[0]:
heappush(data,code[ip+1])
ip += 2
else:
heappop(data)
ip += 1
sleep(0.2)
Computational class
Unknown, but probably very limited.
See also
- Bitwise Cyclic Tag (BCT)
- Bitwise Cyclic Tack (BCTk)