From f1f969e84d5084ad3013444ec5dc8438e7592014 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Thu, 9 Feb 2023 23:46:16 -0500 Subject: [PATCH] Start work on algorithm document --- docs/ALGORITHM.adoc | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/docs/ALGORITHM.adoc b/docs/ALGORITHM.adoc index 61b67c6..5ae4c79 100644 --- a/docs/ALGORITHM.adoc +++ b/docs/ALGORITHM.adoc @@ -10,7 +10,75 @@ = Algorithm +== Data format + +[source] +---- +Example: Face 2, level 23 + +# Most significant 3 bits are for the face +face_number = 0b010 + +# This algorithm is always level 23 +data_bits = level * 2 = 23 * 2 = 46 + +# The bit after the data bits is always 1 +# All subsequent bits are always 0 + +Bit : 64 48 32 16 1 + : | | | | | + : 01001011101010001011100010010011 1001001100100l001100000000000000 +Face number : ^^^ +Data bits : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ +Bit after data bits (1) : ^ +All remaining bits (0) : ^^^^^^^^^^^^^^ +---- + +[source] +---- +All remaining bits (0) : vvvvvvvvvvvvvv +Bit after data bits (1) : v +Data bits : vvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvv +Face number : vvv +Bit : 64 48 32 16 1 + : | | | | | + : 01001011101010001011100010010011 1001001100100l001100000000000000 +Not represented : ^^^^^^^^^^^^^^^ +0000 (10 bits) : ^^^^^^^^^^ +WORD1 (13 bits) : ^^^^^^ ^^^^^^^ +WORD2 (13 bits) : ^^^^^^^^^^^^^ +WORD3 (13 bits) : ^^^^^^^^^^^^^ +---- + +Alternative format (generated using link:https://github.com/luismartingarcia/protocol[protocol^]) + +[source] +---- +./protocol 'Face:3,Data:46,1:1,0:14?bits=32' + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Face| Data | ++-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| |1| 0 | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +---- + +[source] +---- +./protocol 'WORD3:13,WORD2:13,WORD1:13,Number:10?bits=32' + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| WORD3 | WORD2 | | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| WORD1 | Number | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +---- + + == Encoding + [%header,cols="2m,5a"] |=== |Step |Code @@ -193,6 +261,8 @@ fn fij_to_cellid(f: u8, s: u32, t: u32) -> u64 { |=== +== Wordlist + ++++