Drive-In Window TC

From Esolang
Jump to navigation Jump to search

Drive-In Window TC is an esolang by User:BoundedBeans. It is based on Drive-In Window, but Turing-complete.

Commands

All of the commands in Drive-In Window plus:

Person N would like to get takeout. Pushes the value of Person N to their own stack.
Person N would like to bring in food. Pops the value of Person N's stack to their value.
Person N is leaving a review: [anything not containing a period]. Comment/no-op.

Computational class

Drive-In Window TC is Turing-complete, by simulation of P'' with cells 0-1. This construction uses Person 1 and Person 2's stacks to form a tape. Person 1's value is at the pointer, Person 1's stack is right of the pointer, Person 2's stack is left of the pointer, and Person 2's value is garbage and is only used to push Person 1's value to Person 2's stack.

P Command/Section Drive-In Window TC code Notes
Start
Hi, welcome to PDoublePrime. Here is a menu.

Prime Rib: $0

Here are your sides.

Pop Tart: $2
Peas: $1

May I take your order?

Person 1 would like the Prime Rib with Pop Tart.
Person 2 would like the Prime Rib with Pop Tart.
Person 1 would like to get takeout.
Person 2 would like to get takeout.
Person 1 would not like the Prime Rib with Pop Tart.
Person 1 and Person 2 are given 2 (the value for the end of the tape). They are both put in the stack and Person 1 is given a new value of 0 for the first element on the tape.
End

OK, that will be $13.37. Thanks for coming!
R
Person 2 would like what Person 1 has.
Person 2 would like to get takeout.
Person 1 would like to bring in food.
The pointer is moved one to the left by taking the value of Person 1 and pushing it to Person 2's stack, then popping from Person 1's stack. Note that trying to go past the right edge is not checked and will break the program. P'' programs should account for this anyway, though.
λ
Let's just do this until Person 3 has no more money!
  Person 3 would not like the Prime Rib with Peas.
Person 3 has no more money!
Person 3 would like the Prime Rib with Peas.
Let's just do this until Person 1 has no more money!
  Person 3 would not like the Prime Rib with Peas.
  Person 1 would not like the Prime Rib with Peas.
Person 1 has no more money!
Person 1 would like what Person 3 has.
Person 2 would like to bring in food.
Person 1 would like to get takeout.
Person 1 would like what Person 2 has.
Person 3 would like what Person 1 has.
Let's just do this until Person 1 has no more money!
  Person 1 would not like the Prime Rib with Peas.
  Let's just do this until Person 1 has no more money!
    Person 1 would not like the Prime Rib with Peas.
    Person 2 would like to get takeout.
  Person 1 has no more money!
Person 1 has no more money!
Person 1 would like what Person 3 has.
The value of Person 3 is reset, then set to 1 if Person 1 is 0, or 0 if Person 1 is 1. Person 1 is then set to Person 3, accomplishing the flip part of the λ command of P''. The values are then moved one to the left through the opposite method of R above, but this time, Person 1 is checked for the value of 2, indicating that another element should be added to the tape.
({Commands})
Let's just do this until Person 1 has no more money!
  {Commands}
Person 1 has no more money!
Simple loop, not much extra work needed here.

Implementation

  • Python 3 implementation by BoundedBeans based on 3snoW's Python 2 implementation of the original Drive-In Window: [1]