Among Us

From Esolang
Jump to navigation Jump to search

Among Us is an esoteric programming language created by User:Zero player rodent. It is based on the popular game known as Among Us. The programs consist of colours followed by the word "SUS". "SUS" executes the command associated with the colour.

Commands

Command Outcome
SUS Execute command associated with colour.

Colours

Colour Command
RED Increment the accumulator.
BLUE Push the value in the accumulator to the top of the stack.
PURPLE Pop the value at the top of the stack off of the stack.
GREEN Output the ASCII character associated with the number at the top of the stack.
YELLOW Push a byte of input to the top of the stack.
CYAN Pop the value off of the top of the stack a random amount of times, the highest possible amount of times is equal to the value in the accumulator.
BLACK Output the value at the top of the stack.
WHITE Decrement the accumulator.
BROWN Set the value in the accumulator to the value at the top of the stack.
LIME Adds the value at the top of the stack to the value at the top of the stack.
PINK Set the value in the accumulator to 0.
ORANGE Output "AMONG US".
WHO? Go past the next "WHERE?" if the value at the top of the stack is equal to 0.
WHERE? Go to last "WHO?" if the value at the top of the stack is higher than 0.

Code Examples

Cat program.

RED SUS BLUE SUS WHO? YELLOW SUS GREEN SUS WHERE?

Slot machine game. Match 3 numbers to win.

RED SUS BLUE SUS RED SUS BLUE SUS RED SUS BLUE SUS CYAN SUS BLACK SUS PINK SUS RED SUS BLUE SUS RED SUS BLUE SUS RED SUS BLUE SUS CYAN SUS BLACK SUS PINK SUS RED SUS BLUE SUS RED SUS BLUE SUS RED SUS BLUE SUS CYAN SUS BLACK SUS PINK SUS 

Interpreter

Source code. (Written in Ruby)

eval '$m=Hash.new(p=0); $n=Hash.new(b=0); $h=Hash.new(z=0); $d=Hash.new(q=0);'+gets.chomp.gsub(/[A-Z][A-Z0-9]*|./,

     'SUS' => 'z+=1 if b==1; p+=1 if b==2; $m[p]=z if b==2; $m[p]=0 if b==3; p-=1 if b==3; putc $m[p] if b==4; p+=1 if b==5; $m[p]=STDIN.getbyte if b==5 and !STDIN.eof; p-=rand(z) if b==6; print $m[p] if b==7; z-=1 if b==8; z=$m[p] if b==9; z+=z if b==10; z=0 if b==11; print "AMONG US" if b>11;',
     'RED' => 'b=1;',
     'BLUE' => 'b=2;',
     'PURPLE' => 'b=3;',
     'GREEN' => 'b=4;',
     'YELLOW' => 'b=5;',
     'CYAN' => 'b=6;',
     'BLACK' => 'b=7;',
     'WHITE' => 'b=8;',
     'BROWN' => 'b=9;',
     'LIME' => 'b=10;',
     'PINK' => 'b=11;',
     'ORANGE' => 'b=12;',
     'WHO' => '(',
     'WHERE' => ')while(($m[p]&=255)!=0);')
puts""