Apgcode: Difference between revisions

From LifeWiki
Jump to navigation Jump to search
m fmt
→Limitations: New section.
Line 104: Line 104:
* Character set: it only uses digits, lowercase letters and the underscore, so can be safely used in filenames and URLs.
* Character set: it only uses digits, lowercase letters and the underscore, so can be safely used in filenames and URLs.
* Human-readability: the prefix means that we can instantly see whether a particular object is a still-life (and if so, what size), oscillator (and if so, what period) or spaceship (and if so, what period). It also means that the string is instantly recognised as being an encoding of an object ('<tt>xp2_7</tt>' is obviously a [[blinker]], whereas the digit 7 on its own with no extra context is ambiguous).
* Human-readability: the prefix means that we can instantly see whether a particular object is a still-life (and if so, what size), oscillator (and if so, what period) or spaceship (and if so, what period). It also means that the string is instantly recognised as being an encoding of an object ('<tt>xp2_7</tt>' is obviously a [[blinker]], whereas the digit 7 on its own with no extra context is ambiguous).
==Limitations==
apgcodes can be ambiguous if a rule is neither specified nor implicitly assumed, with the same code being assigned to different patterns evolving differently. For example, the code <tt>xp2_2a54</tt> describes at least three different period-2 oscillators:
{| style="margin-left: auto; margin-right: auto;" class="wikitable"
|+ Evolution of xp2_2a54 across different rules
|-
| align="center" | [[File:Xp2 2a54 b3s23.gif]]
| align="center" | [[File:Xp2 2a54 b34s.gif]]
| align="center" | [[File:Xp2 2a54 b4s1.gif]]
|-
| B3/S3 to B35678/S02345678
| B34/S to B345678/S0245678
| B4/S1 to B45678/S01245678
|}


[[Category:Everything else]][[Category:File formats]]
[[Category:Everything else]][[Category:File formats]]
{{DISPLAYTITLE:apgcode}}
{{DISPLAYTITLE:apgcode}}

Revision as of 17:28, 2 October 2016

apgsearch and the search results database, Catagolue, use apgcodes to classify and denote patterns as follows. Most objects are stored as two alphanumeric strings separated by an underscore. The 'prefix' refers to everything before the underscore and may begin with:

Oversize still lifes, oscillators, and spaceships, larger than 40 by 40, have a prefix beginning with ov_s, ov_p, or ov_q, respectively.

These are followed by a number. For still lifes (xs or ov_s) this is the population of the still life, while for the others it is the period of the object.

The codes for xs, xp, and xq are followed by an underscore, then a string which is a representation of the object in Extended Wechsler Format, described below. Codes for yl are followed by an underscore and additional information encoding higher-order periods of the pattern.

Objects which apgsearch cannot classify as above are denoted by one of:

  • zz_EXPLOSIVE
  • zz_LINEAR
  • zz_QUADRATIC
  • zz_REPLICATOR
  • PATHOLOGICAL (e.g. high-period oscillators)

Extended Wechsler Format

This is an extension of a pattern notation developed by Allan Wechsler in 1992. A string of n characters in the set {0, 1, 2, ..., 8, 9, a, b, ..., v} denotes a strip of five rows, n columns wide. Each character denotes five cells in a vertical column corresponding to the bitstrings {'00000', '00001', '00010', ..., '01000', '01001', '01010', '01011', ... '11111'}. For instance, xq4_27deee6 corresponds to a HWSS:

27deee6
.**....
**.****
.******
..****.
.......

The character 'z' separates contiguous five-row strips. For example, xs31_0ca178b96z69d1d96 is:

0ca178b96
...**.**.
..*.*.*.*
.*..*...*
.**..***.
.........

69d1d96
.*****.
*.....*
*.*.*.*
.**.**.
.......

The characters 'w' and 'x' are used to abbreviate '00' and '000', respectively. So xp30_w33z8kqrqk8zzzx33 is the trans-queen-bee-shuttle:

0033
..**
..**
....
....
....

8kqrqk8
...*...
..***..
.*...*.
*.***.*
.*****.

[10 blank rows omitted]

00033
...**
...**
.....
.....
.....

Note that extraneous '0's at the ends of strips are not included.

Finally, the symbols {'y0', 'y1', y2', ..., 'yx', 'yy', 'yz'} correspond to runs of between 4 and 39 consecutive '0's. A good example is the quadpole on ship, xp2_31a08zy0123cko:

31a08
**...
*.*..
.....
..*.*
.....

0000123cko
....*.*...
.....**...
.......**.
.......*.*
........**

Canonical form

In order to enforce a canonical form, there are further rules regarding encoding:

  • The leftmost column and uppermost row must each contain at least one live cell. (This gives a canonical position.)
  • Any '0's on the ends of strips are ignored, and {'00', '000', '0000', '00000', ...} are always replaced with {'w', 'x', 'y0', 'y1', 'y2', ...}. (Theoretically, runs of more than 39 zeroes should be replaced by 'yz' followed by the coding for the remaining zeroes. At the moment apgsearch labels everything larger than 40-by-40 as 'oversized' and refuses to process it.)
  • A canonical orientation and phase must be determined. For example, with the caterer (p3 oscillator with no symmetry), there are three phases and eight orientations, so we have 24 possible encodings. A total order on these encodings is defined as follows:
    • Shorter representations are preferred to longer representations;
    • For representations of the same length, lexicographical ASCII ordering is applied (and preference given to earlier strings).

This gives, for any still-life, oscillator or spaceship, an unambiguous canonical code to represent the patern. It has several desirable properties:

  • Compression: it is much more compact than RLE or SOF for storing very small patterns, and often even beats the common name ('xp15_4r4z4r4' is shorter than 'pentadecathlon')!
  • Character set: it only uses digits, lowercase letters and the underscore, so can be safely used in filenames and URLs.
  • Human-readability: the prefix means that we can instantly see whether a particular object is a still-life (and if so, what size), oscillator (and if so, what period) or spaceship (and if so, what period). It also means that the string is instantly recognised as being an encoding of an object ('xp2_7' is obviously a blinker, whereas the digit 7 on its own with no extra context is ambiguous).

Limitations

apgcodes can be ambiguous if a rule is neither specified nor implicitly assumed, with the same code being assigned to different patterns evolving differently. For example, the code xp2_2a54 describes at least three different period-2 oscillators:

Evolution of xp2_2a54 across different rules
B3/S3 to B35678/S02345678 B34/S to B345678/S0245678 B4/S1 to B45678/S01245678