FISH WALKING 🚢

From Esolang
Jump to navigation Jump to search

FISH WALKING 🚢 is a joke esolang made by User:MathR with a FISH WALKING 🚢.

Commands

OMG FISH WITH LEGS πŸ‘£    Initialize program
FISH WALKING 🚢          Increment cell pointer
WHO WILL IT EAT DOE πŸ€”   Inputs number of food in the cell
FISH HUNGRY WHEN <NUMBER> FOOD 🍴 Sets the hunger threshold to <NUMBER>
FISH DIE πŸ’€              Interprets Deadfish
FISH GET FOOD πŸ˜‹         Increment number of food in the cell
FISH UNGET FOOD πŸ˜”       Decrement number of food in the cell
FISH SWIMMING NOOOOO 🏊  Decrement cell pointer
FISH FLY TO <LINE> πŸ›«     Jumps to line <LINE>
FISH TOO HUNGRY TO DO NEXT LINE LOL 🀣 Skips the next line if the number of food in the cell < the hunger threshold
FISH SHOW HIS FOOD COLLECTION πŸ‘€ Outputs the number of food

Why?

FISH WALKING 🚢 is based on a drawing made by User:Iamn00b. Link to the image


Example programs

OMG FISH WITH LEGS πŸ‘£
FISH DIE πŸ’€

Deadfish interpreter

OMG FISH WITH LEGS πŸ‘£
FISH HUNGRY WHEN 1 FOOD 🍴
WHO WILL IT EAT DOE πŸ€”
FISH SHOW HIS FOOD COLLECTION πŸ‘€
FISH TOO HUNGRY TO DO NEXT LINE LOL 🀣
FISH FLY TO 4 πŸ›«

Truth-machine

Python interpreter

import re

with open(input("Filename: ")) as file:
  program = file.readlines()

program_started = False
hunger_threshold = 5

TAPE_SIZE = 255
cell_pointer = 0
tape = [0] * TAPE_SIZE

line_index = 0
while line_index < len(program):
   line = program[line_index]
   if program_started:
      if line == "FISH WALKING 🚢\n":
         cell_pointer = (cell_pointer + 1) % TAPE_SIZE
      elif line == "FISH SWIMMING NOOOOO 🏊\n":
         cell_pointer = (cell_pointer - 1) % TAPE_SIZE
      elif re.match(r'^FISH HUNGRY WHEN [0-9]+ FOOD 🍴$', line):
         hunger_threshold = int(line[16:-8])
      elif line == "FISH TOO HUNGRY TO DO NEXT LINE LOL 🀣\n":
         if tape[cell_pointer] < hunger_threshold: line_index += 1
      elif line == "FISH GET FOOD πŸ˜‹\n":
         tape[cell_pointer] += 1
      elif line == "FISH UNGET FOOD πŸ˜”\n":
         tape[cell_pointer] -= 1
      elif line == "WHO WILL IT EAT DOE πŸ€”\n":
         tape[cell_pointer] = int(input())
      elif line == "FISH SHOW HIS FOOD COLLECTION πŸ‘€\n":
         print(tape[cell_pointer])
      elif re.match(r'^FISH FLY TO [0-9]+ πŸ›«$', line):
         line_index = int(line[11:-2]) - 2
      elif line == "FISH DIE πŸ’€\n":
         value = 0
         while 1:
            commands = input(">> ")
            for command in commands:
               if command == 'i':
                  value += 1
               elif command == 'd':
                  value -= 1
               elif command == 'o':
                  print(value)
               elif command == 's':
                  value *= value
               if value == -1 or value == 256:
                  value = 0
   elif line == "OMG FISH WITH LEGS πŸ‘£\n":
      program_started = True
   line_index += 1