Your Pong May Minsky

Category:LanguagesCategory:2018Category:Declarative paradigmCategory:Turing completeCategory:Multi-dimensional languagesCategory:No IO
Your Pong May Minsky is an esoteric programming language designed by Chris Pressey, mostly on June 16 2018
and mostly for aesthetic purposes, which is clearly derived from The Waterfall Model and closely related to it.
===Description===
Each Your Pong May Minsky program exists in a certain finite, non-negative number of
dimensions, d, specified by the program and fixed for the duration of the program's execution.
The state of a Your Pong May Minsky program consists of
* a ball, and
* a finite set of wall queues.
The ball is a point with a position and a velocity, both real-valued vectors in d-space.
The initial point and velocity are specified in the program as d-tuples of rational numbers.
A wall queue is a queue of walls. Only the frontmost wall in any queue is considered "active".
A wall queue can be "rotated", meaning the active wall is dequeued from the front and
re-enqueued at the rear; when this happens, a new wall in the queue becomes the active
wall (unless the length of the queue is 1.)
A wall is a triple of a half-space, a velocity, and a boolean.
* The half-space is defined by a linear inequality of the form X >= k or X <= k, where X is a coordinate variable and is one of the allowable dimensions in d-space, and k is a constant rational value. Thus the half-space is (a) orthogonal to the co-ordinate system, and (b) its boundary is closed. A given point is said to be inside (resp. outside) the wall if the linear inequality is true (resp. false) for the coordinates of that point.
* The velocity is called the wall's collision velocity and it is a real-valued vector in d-space.
* The boolean is called the wall's halt flag.
===Syntax===
There is no strongly-set syntax for a Your Pong May Minsky program, but as an example
of what its syntax could look like if it had one, here is a 3-dimensional program:
 ball (0, 0, 5) (1, 1, -1)
 wall queue {
 wall (x >= 0) (-2, 0, 0)
 wall (y >= 0) (0, -2, 0)
 }
 wall queue {
 wall (z <= 0) (0, 0, 0) halt
 }
Since you might want to have more than 3 dimensions, you can also call them d0, d1, d2, d3, ... etc.
===Execution===
During execution of the program, the position of the ball
evolves continuously based on the elapsed execution time (which is considered to be real-valued
and which need not correspond with wall-clock time) and the velocity of the ball.
The instant at which the ball, due to its motion, transitions from being outside an active wall to
being inside that wall a collision with that wall is said to take place.
A collision with more than one wall can occur at the same instant; thus at
any given instant there is a set of walls being collided with, W, which
may be empty or non-empty.
When a collision takes place (non-empty W), the following things occur for
each wall w in W:
* the collision velocity of w is added to the ball's velocity.
* the wall queue that w is in is rotated.
* If w has a halt flag which is true, the program halts.
(Since only one wall may be active in any given queue, a single collision
will never result in the same wall queue being rotated more than once.)
Note that nothing special happens when the ball transitions from being
inside an active wall to being outside that wall.
Note also that if a wall appears due to newly becoming active (i.e.
due to a wall queue being rotated), and the ball happens to be inside that
wall, that is not considered a collision (because it is not due to the
ball's motion.)
===Computational class===
Your Pong May Minsky is Turing-complete if The Waterfall Model is,
because a The Waterfall Model program can be translated to a Your Pong May Minsky
program in the following semantics-preserving manner:
The program should have n dimensions, where n is the number of waterclocks.
The initial position of the ball is a vector comprising the initial water levels of the waterclocks.
The initial velocity of the ball is (-1, -1, ... -1), corresponding to all
waterclocks draining at the same constant rate.
For every zeroing trigger, there is a wall queue containing two walls.
One wall has, as its half-space, X <= 0, (where X is the appropriate
dimension coordinate for this waterclock) and as its collision velocity, a
vector composed of the amounts of the zeroing trigger, with (1, 1, ... 1)
added to it to offset for the constant drain rate.
The other wall has, as its half-space, X >= m, where m is the amount
that zeroing trigger tops up its own waterclock, and the collision
velocity is -1 times the collision velocity of the first wall, such that
when this velocity is added to the ball's velocity, the effect is to
cancel out the first collision velocity, returning to the constant drain rate.
Finally a halting waterclock simply translates to a wall with a
true halt flag.
===Discussion===
Where The Waterfall Model has instantaneous "top ups", all motion of the
ball in Your Pong May Minsky is continuous. The equivalent of a top-up
is, as described above, to change the velocity of the ball (the
rates of change of its coordinates) for a time, then change it back.
This is equivalent because, at the end of this process, the coordinates
have changed the same amount as they would have if it were an instantaneous
"top up".
To change the velocity and then change it back involves two walls,
but it seems hazardous to allow both walls to co-exist at all times in the
program - maybe some other wall's collision velocity is going to make
the ball travel through this wall's associated "counteracting wall" at
some point? This situation can't happen with instantaneous top-ups,
but I also haven't thought through the implications of it, so arranging
walls into wall queues where only one wall is active at any time and they
cycle through, seemed like the way to play it safe.
Whether the language is still Turing-complete even if all wall queues
are restricted to length 1 (effectively: if wall queues are removed
from the design), is not known.
This design, with its singleton moving ball, also emphasises that the claim
that The Waterfall Model "has no instruction pointer" is somewhat a matter
of perspective.