BASICER

From Esolang
Jump to navigation Jump to search

Beginners' All-purpose Symbolic Instruction Code, Esoteric Revision, also named BASICER is an esoteric programming language designed by User:Rdococ.

Specification

BASICER programs have a 100x100 graphical screen on which to draw things as well as a textual terminal to print text. There are 5 instructions.

Instruction Description
CLEAR Clears the console and the screen.
PLOT X Y #RRGGBB Gives point (X, Y) on the screen the hexadecimal colour #RRGGBB. X and Y can range from 0-99.
PRINT ABC Prints ABC.
PAUSE Pauses the program. User must press a button to continue.
GOTO 9 8 If there is only one line number specified, go to that line. But if there is more than one number specified, allow the user to choose. The user isn't told what the line numbers are, and must type 1 for the first choice, 2 for the second choice, and so on. If the line number does not exist, the program halts.

Line Numbers

BASICER permits you to write a line number either before every instruction, or omit them. If line numbers are only placed before some instructions, the program will not run.

Examples

This is a very, very simple RPG written in BASICER.

10 CLEAR
20 PRINT You wake up in a dark room! What do you do?
30 PRINT 1) Go to the door towards the south
40 PRINT 2) Go to the door towards the north
50 GOTO 60 110
60 CLEAR
70 PRINT The door closes behind you, and all of a sudden,
80 PRINT you fall asleep on the most comfortable bed ever.
90 PAUSE
100 GOTO 10
110 CLEAR
120 PRINT You have escaped the room and are now outside!
130 PRINT Press any key to play again.
140 PAUSE
150 GOTO 10

This program adds two binary numbers if they are fed in an alternating pattern from least significant to most significant (A0, B0, A1, B1 etc). When providing input, `1` translates to `0` and `2` translates to `1`.

10 PRINT First digit please! (1 = 0, 2 = 1, 3 = exit)
20 GOTO 50 70 200
30 PRINT First digit please! (1 = 0, 2 = 1, 3 = exit)
40 GOTO 70 90 190
50 PRINT Second digit please! (1 = 0, 2 = 1)
60 GOTO 110 130
70 PRINT Second digit please! (1 = 0, 2 = 1)
80 GOTO 130 150
90 PRINT Second digit please! (1 = 0, 2 = 1)
100 GOTO 150 170
110 PRINT 0
120 GOTO 10
130 PRINT 1
140 GOTO 10
150 PRINT 0
160 GOTO 30
170 PRINT 1
180 GOTO 30
190 PRINT 1

Other interesting examples of programs that can be written in BASICER include tic-tac-toe with perfect AI, a C interpreter, and The Stanley Parable.

Computational Class

BASICER programs translate straightforwardly into FSMs with output.