Welcome To...

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Welcome To... is an esolang by User:PythonshellDebugwindow based on the game of the same name.

Memory

Programs in Welcome To... use an arbitrary-length stack of unsigned integers.

Program format

Each program in Welcome To... is made up of two files, the setup file and the board file. The setup file contains vital information for the program, and the board file contains the actual code.

Setup file

The setup file contains the card decks. Each card has a number from 1 to 15 and a special power that can be either POOL, PARK, FENCE, ESTATE, TEMP, or BIS. There are N cards in this file, where N is a multiple of three and is greater than zero, split into three groups at runtime. For any card C with number N and power P, the 0-base ASCII code of character representing that card is 32 + N + (powers.zeroBaseIndexOf(P) * 15) for a range of 33-122, so to represent 2-FENCE, 11-BIS, and 6-ESTATE in that order, you would write:

@vS

Again, the file is expected to contain N cards, where N is a positive nonzero multiple of three following, this pattern; any other characters throw an error, ending the code entire program, meaning the board file will be completely ignored. After these cards, a newline is expected, followed by a series of space-separated base-36 numbers, with no preceding whitespace other than the aforementioned newline and no succeeding whitespace at all. These numbers specify the number of houses in each street, and also the number of streets (which is the number of base-36 numbers).

Board file

The board file contains the actual code. Each line (turn) contains three base-10 numbers. The first one specifies which card is being played (one-indexed) and is referred here to as B, the second specifies which house to fill in and is referred to as H, and the third one specifies where (and if) to use the card's power and is referred to as W. After every turn, the top card of each pile is popped and then pushed to the bottom of its pile.

Power Effect
POOL Pop from the stack and push to the output queue
PARK Push the card's number to the stack
FENCE If the card's number is equal to 0, then jump past the matching TEMP
ESTATE Add the card's number to the top of the stack, then mod the top of the stack by 15
TEMP If the card's number is nonzero, then jump back to the matching FENCE
BIS Duplicate the top of the stack

Output queue

The output queue is where number are sent to be output. When the output queue first receives a number X, it waits for another number Y, and when it receives it, it outputs the ASCII character of (X - 1) + ((Y - 1) * 15) and waits for more numbers. X and Y can be any numbers. If the output queue has only 1 number at the end of the program, a 0 will be sent to the output stream.

Program end

If one of the three cards cannot be played, or if the chosen card cannot be played, then its effect will be skipped and a building violation will be gained. Once 3 violations are reached, the program will end, but with a warning message printed after any output. The program will also end if all houses are filled in, but with no warning message.