(0123456789!

From Esolang
Jump to navigation Jump to search

Welcome to (0123456789!?.), the language I made because I was bored.

Don't ask me why the domain is "(0123456789!".

Explanation

Every character in the title is a command in the language, and it can basically do anything because it has get requests.

Commands:

Commands
Command Function
0 Sets cursor position to 0.
1 Increments cursor position.
2 Decrement cursor position.
3 Increments where the cursor is pointing.
4 Increases where the cursor is pointing by 10.
5 Decrements where the cursor is pointing.
6 Prints where the cursor is pointing.
7 Prints out data (ascii -> text), excluding 0s.
8 Prints out data, excluding 0s.
9 Assigns where the cursor is pointing to user input.
( Clears data.
) Gets the whole data (ascii -> text) and GET requests it.
! Converts where the cursor is pointing text to ascii.
? If where the cursor is pointing, it is under 1, skip the next line.
. Sets where the cursor is pointing to 0.

Basically, the language (123456789!?.) uses a memory list of 50 length, along with a cursor that goes from 0-49 and points to the memory list with `stuff[cursor]` which you can read (kinda) and write to.

Other Stuff

Stuff I Made

coming soon

My (bad) Implementation

Here's my probably bad and un-optimized implementation of this esolang, in python.

# (0123456789!?)

import requests
import re

stuffamt = 50
stuff = [0 for i in range(stuffamt)]
cursor = 0

skipln = False

def run(fname="numberesolang/input.txt"):
  global cursor, stuff, stuffamt, skipln
  with open(fname, "r") as file:
    lines = file.readlines()
    for i in lines:
      if skipln:
        skipln = False
        continue
      for j in i.strip():
        if j == "0":
          cursor = 0
        if j == "1":
          if cursor >= stuffamt-1:
            print(f"CursorError: cursor value {cursor} exceeds maximum {stuffamt}")
            break
          cursor += 1
        if j == "2":
          if cursor <= 0:
            print(f"CursorError: cursor value {cursor} is less than 0")
            break
          cursor -= 1
        if j == "3":
          stuff[cursor] += 1
        if j == "4":
          stuff[cursor] += 10
        if j == "5":
          stuff[cursor] -= 1
        if j == "6":
          print(stuff[cursor])
        if j == "7":
          astr = ""
          for k in stuff:
            if k != 0:
              astr += chr(k)
          print(astr)
        if j == "8":
          for k in stuff:
            if k != 0:
              print(k)
        if j == "9":
          inp = input(" > ")
          if re.search(r"[^0-9]", inp):
            for k in inp:
              stuff[cursor] = ord(k)
              cursor += 1
          else:
            stuff[cursor] = int(inp)
        if j == "(":
          stuff = [0 for i in range(stuffamt)]
        if j == ")":
          astr = ""
          for k in stuff:
            if k != 0:
              astr += chr(int(k))
          res = requests.get(astr)
          stuff[cursor] = res.text
        if j == "!":
          stuff[cursor] = ord(str(stuff[cursor]))
        if j == "?":
          if stuff[cursor] <= 0:
            skipln = True
        if j == ".":
          stuff[cursor] = 0

run()