git @ Cat's Eye Technologies Jolverine / b0aefc4
Add Oerjan's truth-machine example, and update README. catseye 9 years ago
2 changed file(s) with 97 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
3737 There is an unbounded tape, with a single head which can be moved left
3838 and right. Each cell on the tape may contain one of the three values -1, 0,
3939 or 1. Initially, all tape cells contain 0. Addition and subtraction of these
40 values is always "mod 3 - 1": incrementing 1 yields -1 and decrementing -1
41 yields 1.
40 values is modulo 3, with the result considered to be in the range {-1, 0, 1}.
41 Incrementing 1 yields -1 and decrementing -1 yields 1.
4242
4343 Instruction Wheel
4444 -----------------
8383 of both dx and dy being zero. In this case, execution does not halt, but
8484 the same `*` will be executed again, and again, until dx or dy changes.
8585
86 Jolverine is a reversible language, although that was not at all on the
87 author's mind when it was created.
88
8689 Computational Class
8790 -------------------
8891
89 Jolverine may or may not be Turing-complete. If it is not, it is not because
90 it has insufficient storage, or no way to execute an instruction it has
91 previously executed; it will be because there is no way to predictably
92 execute the same series of instructions as was previously executed.
92 Jolverine was shown to be Turing-complete by Ørjan Johansen, shortly after
93 version 1.0 was released. You can read the full details of the construction
94 (which involves some rather large Jolverine programs) in the
95 [Jolverine Turing-completeness proof][] article on the esolangs wiki.
96
97 [Jolverine Turing-completeness proof]: http://esolangs.org/wiki/Jolverine_Turing-completeness_proof
9398
9499 Discussion
95100 ----------
96101
97 I have yet to write a proper loop in Jolverine. I have only attempted to
98 write an infinite loop, executing `adddx` and `adddy` alternately after
99 `rot`ing a cell on the tape. After a few iterations, you can guarantee
100 that `adddx` is at the top of the wheel, and `adddy` at the bottom, so you
101 can choose to execute the next one, as appropriate, and it will not change
102 the position of these instructions on the wheel (because they're already at
103 the top and bottom.) However, I suspect even this technique really requires
104 some number theory to do effectively -- probably finding the LCM of 7 (the
105 number of instructions on the wheel) and a couple of other numbers (the
106 amount you can change the x and y positions on each spin around the
107 playfield.)
102 While I have yet to write a proper loop in Jolverine, others have succeeded
103 at this. Some programming techniques that may come in useful for writing
104 Jolverine programs include:
105
106 * You can always add seven non-stars between a star and the next star to
107 be executed without changing the semantics of the second star. (The
108 wheel just does a full rotation, ending up where it was originally.)
109 * If you execute the instruction at the top of the wheel, and it is an
110 odd-numbered execution step (e.g. the first instruction executed in
111 the program, or the third, etc.), the position of that instruction on
112 the wheel will not change (it will be removed, but then re-inserted
113 exactly where it was.) The same goes for executing the instruction at
114 the bottom of the wheel on an even-numbered execution step.
115 * There are other techniques for executing an arbitrary instruction,
116 then getting the wheel back into the configuration it was in before
117 you started executing it; perhaps not surprisingly, these require
118 measures such as leaving every second cell of the tape free for
119 scratch space. See the [Jolverine article][] on the esolangs wiki, and
120 its talk page, for more information.
121
122 [Jolverine article]: http://esolangs.org/wiki/Jolverine
123
124 About this Distribution
125 -----------------------
126
127 This is the reference distribution for Jolverine, and as such, it contains
128 the reference implementation of Jolverine, written in Python, in the file
129 `script/jolverine`.
130
131 This implementation also handles a very simplistic variant of Jolverine
132 which I call "Jolverine Super Wimp Mode". This variant is not supposed to
133 be a real language, so much as an aid to writing Jolverine programs -- you
134 prototype them in Jolverine Super Wimp Mode first, then you figure out how to
135 convert them to Jolverine. In Jolverine Super Wimp Mode, there is no
136 wheel at all, and the characters `<`, `>`, `+`, `x`, `y`, `i`, and `o`
137 execute the seven above-listed instructions directly.
138
139 There are some example program in the `eg` directory; those with the file
140 extension `.jol` are in Jolverine, while those with the extension `.jolswm`
141 are in Jolverine Super Wimp Mode.
108142
109143 Happy wheel-mangling!
110144 Chris Pressey
0 .*.....*......*......*......*......*.....*...*...*......*.....*..*......*....
1 .
2 (Truth-machine in Jolverine, by Ørjan Johansen) .
3 .
4 .
5 *
6 .
7 .
8 .
9 .
10 .
11 .
12 *
13 .
14 .
15 .
16 .
17 .
18 .
19 *
20 .
21 .
22 .
23 .
24 .
25 .
26 .
27 .
28 .
29 .
30 .
31 *
32 . .
33 . .
34 . .
35 * *
36 . .
37 . .
38 * *
39 . .
40 . .
41 * *
42 . .
43 . .
44 . .
45 *