Objects In Mirror Are Heavier Than They Appear

From Esolang
Jump to navigation Jump to search

Objects In Mirror Are Heavier Than They Appear is a particle automaton by User:PythonshellDebugwindow.

Characters

Each character in the source represents an element.

Character Represents
' Object
! Stationary object
" Heavy object
- Path
| Path
v Path
^ Path
< Path
> Path
/ Path
\ Path
M Mirror boundary
O Black hole
(space) Air

The / and \ characters are not mirrors as in ><>, but are instead paths, so this code:

/-O
\--'

basically makes the object travel along a curve, but it isn't reflected.

If an object encounters a character not listed here, it starts moving in a random one of the eight possible directions (N, NE, E, SE, S, SW, W, NW).

Elements

Objects

Objects travel along paths. If two objects collide, both of them reverse direction. The program terminates when there are no objects or heavy objects.

Stationary objects

Stationary objects stay in one place. If an object and a stationary object collide, the object reverses direction.

Heavy objects

Heavy objects are like objects, but if an object and a heavy object collide, the object will be pushed in the heavy object's direction. If two heavy objects collide, both of them reverse direction.

Paths

Paths are what objects and heavy objects travel along.

Mirror boundaries

Mirror boundaries enclose mirrors. They allow objects and heavy objects to pass through them freely. See #Mirrors.

Black holes

Black holes are what allow programs to terminate. When an object or heavy object collides with a black hole, the object or heavy object is swallowed and removed.

Air

Air is basically just filler. If an object or heavy object hits air in direction D, it will keep going in direction D.

Object movement

Note: In this section, the term object is used to refer to both objects and heavy objects.

At the start of the program, each object chooses a random one of the paths adjacent (diagonally or orthogonally) to it. It then moves onto that path, and keeps moving in that direction. If there are no paths, it stays there until hit by another object.

Each tick, if an object has more than one path adjacent to it, it randomly chooses one of those paths to move to (excluding the one it was on last tick); if it has one path adjacent to it (the one it was on last tick), and came from direction D, then it will keep going in direction D, and staying in that direction until it either finds another path, a black hole, a stationary object, or another object (if the object is heavy and the object it finds isn't heavy, however, the heavy object keeps going in the same direction); and if it has no paths adjacent to it (and it never has), then it will stay still unless another object collides with it (if the object is heavy and the object that collides with it is not heavy, then the object that collides with it reverses direction and the object, which is heavy, does nothing). Heavy objects do this first, then non-heavy objects.

An object can be moving in one of eight directions at any one time: north, northeast, east, southeast, south, southwest, west, or northwest. The only way to start moving NE/SE/SW/NW is to either use / or \:

'-\  /-O
   \/

or you could use < or > (although this introduces some nondeterminism):

O-\
 '->
O-/

or a heavy object traveling NE/SE/SW/NW could push a non-heavy object (here, the heavy object would push the non-heavy object into the black hole and follow shortly):

"-\
 '---
    \
     O

Mirrors

Inside mirrors, objects become heavy objects and vice versa in a process known as mirroring. If an object or heavy object starts inside a mirror, however, it will be affected by mirroring when outside, instead of inside, of mirrors.

Nondeterminism in paths

Sometimes, an object can only take one path. Take, for example, the following program:

'---O

The object can only take the one path, so it does. But what about this program:

'---O
\--O

Here there are two paths, each of which can be selected, so one of them is selected at random.

'-v-O
  |
  O

Here, there are also two paths (because of the v). One of them is chosen at random.

   /--O
'--|
   \--O

Again, a random path is chosen. The examples above all end with the object deterministically entering a black hole, but this one has a 50% chance of halting and a 50% chance of entering an infinite loop:

  O
'-|    !
  \-   |
       !