Skip to content

Commit

Permalink
Initial import of Jolverine 1.0 sources.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpressey committed Sep 11, 2012
0 parents commit 83dd851
Show file tree
Hide file tree
Showing 8 changed files with 433 additions and 0 deletions.
113 changes: 113 additions & 0 deletions README.markdown
@@ -0,0 +1,113 @@
Jolverine
=========

Language version 1.0

The Jolverine language was devised as a conscious attempt to expand the
genre of turning tarpit by adding the feature of modifying the instruction
wheel during execution. It is not dissimilar to Wunnel, and was influenced
slightly by Half-Broken Car in Heavy Traffic.

The name is either a portmanteau of "jolly wolverine" (where "jolly" is a
euphemism for "drunk",) which is an attempt to capture, in a noun phrase, the
language's vicious, erratic nature.

Program Structure
-----------------

A Jolverine program consists of a two-dimensional grid of symbols. An
instruction pointer (IP) traverses the grid, starting in the upper-left
corner (x=0, y=0) travelling right (dx=1, dy=0). dx and dy have only
three possible values, -1, 0, and 1, like values on the tape (see below.)

Execution
---------

On each tick, if the symbol under the IP is a `*`, the current instruction on
the instruction wheel is executed. The instruction wheel is then advanced to
the next instruction, regardless of what the symbols under the IP contains.
(All symbols that are not `*` have the same meaning, that is to say, no
meaning besides taking up space.) The IP is then advanced to the next
position in the playfield, and the next tick begins. Execution halts when
the IP travels beyond the extent of the playfield (i.e. when it can be proved
that, in its direction of travel, it will never again hit a `*`.)

Storage
-------

There is an unbounded tape, with a single head which can be moved left
and right. Each cell on the tape may contain one of the three values -1, 0,
or 1. Initially, all tape cells contain 0. Addition and subtraction of these
values is always "mod 3 - 1": incrementing 1 yields -1 and decrementing -1
yields 1.

Instruction Wheel
-----------------

The instruction wheel contains seven instructions. Initially, the wheel looks
like this:

left <--
right
rot
adddx
adddy
input
output

The arrow indicates the current instruction on the wheel. Each time the
wheel is advanced, the arrow moves down one row, wrapping around back
to the top once it advances past the bottom of the wheel.

Each time an instruction is executed from the wheel, it is removed from the
wheel and re-inserted at a different position. The first time this happens, it
is re-inserted at the top of the wheel; the second time, it is re-inserted at
the bottom; the third time, at the top again; the fourth time, at the bottom
again; and so forth.

Instructions
------------

* `left`: moves the tape head left one tape cell.
* `right`: moves the tape head right one tape cell.
* `rot`: increments the current tape cell.
* `adddx`: adds the contents of the current tape cell to the IP's dx.
* `adddy`: adds the contents of the current tape cell to the IP's dy.
* `input`: inputs a single bit (I/O is bitwise, and implementation-defined.)
* `output`: if the current tape cell is 0, output a 0; if the current tape
cell is 1, output a 1; otherwise RESERVED for future expansion.

Notes
-----

It is entirely possible for `*` to execute `adddx` or `adddy` with the result
of both dx and dy being zero. In this case, execution does not halt, but
the same `*` will be executed again, and again, until dx or dy changes.

Computational Class
-------------------

Jolverine may or may not be Turing-complete. If it is not, it is not because
it has insufficient storage, or no way to execute an instruction it has
previously executed; it will be because there is no way to predictably
execute the same series of instructions as was previously executed.

Discussion
----------

I have yet to write a proper loop in Jolverine. I have only attempted to
write an infinite loop, executing `adddx` and `adddy` alternately after
`rot`ing a cell on the tape. After a few iterations, you can guarantee
that `adddx` is at the top of the wheel, and `adddy` at the bottom, so you
can choose to execute the next one, as appropriate, and it will not change
the position of these instructions on the wheel (because they're already at
the top and bottom.) However, I suspect even this technique really requires
some number theory to do effectively -- probably finding the LCM of 7 (the
number of instructions on the wheel) and a couple of other numbers (the
amount you can change the x and y positions on each spin around the
playfield.)

Happy wheel-mangling!
Chris Pressey
September 11, 2012
Montréal, Québec
24 changes: 24 additions & 0 deletions UNLICENSE
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>
10 changes: 10 additions & 0 deletions eg/invert-one-bit.jol
@@ -0,0 +1,10 @@
--*-*
\
\
\ *
\ /
\ /
\ /
* /
\ /
*-*---*
31 changes: 31 additions & 0 deletions eg/loop-attempt-1.jol
@@ -0,0 +1,31 @@
--*----------------------*
\
* *------------*\
| \\
| \\
| \\
| \*
| /\
| / \
| / \
| / *
| / /
| / /
| / /
| / /
| / /
| / /
| / /
| / /
| / /
| | / /
| | / /
* * / /
\ * /
\ /
\ /
\ /
\ /
\ /
\ /
*
31 changes: 31 additions & 0 deletions eg/loop-attempt-2.jol
@@ -0,0 +1,31 @@
--*----------------------*
\
*------------*\
| \\
| \\
| \\
| \*
| /\
| / \
| / *
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
* /
*







32 changes: 32 additions & 0 deletions eg/loop-attempt-3.jol
@@ -0,0 +1,32 @@
--*----------------------*
\
*------------*\
*------------* \\
|*---------* \ \\
* / | \ \ \\
/ /| | \ \ \*
/ * | | \ \ /\
* | | | \ \ / \
| | | | * \/ \
| | | | / /\ *
| | | | / / * /
| | | | / / / /
| * | | / / / /
* | | | / / / /
| | | | / / / /
| | | | / / / /
| | | | / / / /
| | | | / / / /
| | | |/ / / /
| * | | / / /
* | | /| / / /
| * | / * / / /
* \* / * / /
\ \* / /
\ \ / /
\ \ / /
\ \ / /
\ X /
\ / \ /
\ / *
*
32 changes: 32 additions & 0 deletions eg/loop-attempt-4.jol
@@ -0,0 +1,32 @@
--*----------------------*
\
\
\
*--* \
/ \ \
/ \ *
* \ /
| \ /
| * /
| / /
| / /
| / /
* / /
| / /
| / /
| / /
| / /
| * /
| | /
* | /
| /
* /
*








0 comments on commit 83dd851

Please sign in to comment.