Drive-In Window

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

Drive-In Window is an esoteric programming language created by User:JWinslow23 in 2013. The layout is similar to what someone would order at a restaurant.

Drive-In Window: Like Chef, except you're ordering the recipe!

Commands and Syntax

Pre-program declarations

A Drive-In Window program always starts with a greeting and a menu declaration.

The menu contains values you want the variables (people) to have. The menu items can be named anything you want, but these foods will have the same value throughout the program. The menu must have multiples of 10 as values.

The program will also have sides, which you can add or subtract to the main food items to get values you want. Sides are not necessary, but encouraged.

Immediately afterwards is the program start declaration, "May I take your order?"

An example of a menu and side menu:

Hi, welcome to Name_of_restaurant. Here is a menu.

Tootsie Rolls: $30
Rice Krispie Treats: $40
Cookies: $70
Chocolate: $90
Ice Cream: $110

Here are your sides.

Sprinkles: $1
Chocolate Chips: $2
Crushed Oreo: $3
Chocolate Sauce: $4
Caramel: $5

May I take your order?

Now you are ready to order.

In-program commands

All people start out with a value of 0. With commands, you can change their value throughout the program. They can't be under 0 or over 255, it wraps around.

Below is a table of commands and their syntax.

Code Meaning
Person N would like menu_item (with side_item). Assign menu_item price (plus side_item) to person N (there can be as many people as needed).

If you say "would also like", then it just adds the value to person N.

Person N would like menu_item, hold the side_item. Assign menu_item price minus side_item to person N.

If you say "would not like", then it just subtracts the value from person N.

Person N will pay for his order! Output person N's value as an ASCII character.
OK, what should Person N get? Input ASCII character and save its value into person N.
OK, how much money should Person N have? Input number from 0 to 255 and save into person N.
Let's just do this until Person N has no more money! Loop the following code until person N is 0.
Person N has no more money! End of loop.
Person N needs X dollars more/less for his order! Add (or subtract) X from person N.
Person N would like what Person X has. Copies the value of person X to person N.

If you say "would also like", then it just adds person X's value to person N.

Just wait while we decide... Pause until a key is pressed.

End of program

At the end of the program, you have to say the following, with any dollar amount.

OK, that will be $1.95. Thanks for coming!

Example programs

Cat program

Hi, welcome to The_Cats_Meow. Here is a menu.

Cat Food: $10

May I take your order?

Person 1 would like the Cat Food.
Let's just do this until Person 1 has no more money!
OK, what should Person 1 get?
Person 1 will pay for his order!
Person 1 has no more money!

OK, that will be $39.95. Thanks for coming!

This copies input directly to output. Person 1 got the $10 Cat Food to make him go into the loop. Then he asks for input, and outputs it. It keeps going until ASCII code 0 is inputted, or an EOF is reached, or you terminate the program.

Truth Machine

Hi, welcome to Spill_The_Beans. Here is a menu.

Vodka: $50

Here are your sides.

Truth Serum: $2

May I take your order?

OK, how much money should Person 1 have?
Let's just do this until Person 1 has no more money!
Person 1 would also like the Vodka, hold the Truth Serum.
Let's just do this until Person 1 has no more money!
Person 1 will pay for his order!
Person 1 has no more money!
Person 1 has no more money!
Person 1 would also like the Vodka, hold the Truth Serum.
Person 1 will pay for his order!
Just wait while we decide...

OK, that will be $48. Thanks for coming!

Hello, World!

The classic example, now in short order!

Hi, welcome to Hello_World_Buffet. Here is a menu.

Rice Krispie Treat: $10
Ice Cream: $30
Cookies: $70

Here are your sides.

Whipped Cream: $1
Chocolate: $2
Caramel: $3

May I take your order?

Person 1 would like the Cookies with Chocolate.
Person 1 will pay for his order!
Person 2 would like the Ice Cream, hold the Whipped Cream.
Person 2 would also like what Person 1 has.
Person 2 will pay for his order!
Person 2 needs 7 dollars more for his order!
Person 2 will pay for his order!
Person 2 will pay for his order!
Person 2 needs 3 dollars more for his order!
Person 2 will pay for his order!
Person 3 would like the Ice Cream with Chocolate.
Person 3 will pay for his order!
Person 1 would also like the Rice Krispie Treat with Caramel.
Person 1 needs 2 more dollars for his order!
Person 1 will pay for his order!
Person 2 will pay for his order!
Person 2 needs 3 dollars more for his order!
Person 2 will pay for his order!
Person 2 needs 6 dollars less for his order!
Person 2 will pay for his order!
Person 2 needs 8 dollars less for his order!
Person 2 will pay for his order!
Person 3 needs 1 dollar more for his order!
Person 3 will pay for his order!
Just wait while we decide...

OK, that will be $1.14. Thanks for coming!

Computational class

Drive-In Window is a bounded-storage machine, since a program doesn't have access to more bytes than the number of persons in it.

Interpreter

  • A Python 2.7 interpreter was created in 2019 by user User:3snoW. (Link to code)
  • A Drive-In Window TC (backwards compatible with Drive-In Window programs) interpreter in Python 3 based on 3snoW's interpreter is available here.

See also

  • Drive-In Window extended - Slightly different syntax, features to transfer variables and have non-zero exit codes
  • Drive-In Window TC - 2 extra commands that make it Turing-complete, along with comments
  • Drive-In Window JSON - The semantics of Drive-In Window and Drive-In Window TC in JSON format, with a high focus on extensibility
  • WindowGolf - Drive-In Window as a golfing language

External link

Online interpreter