the values {0, 1, 2}. The (n,k)-Gray
code is the n-ary Gray code with k
digits. Therefore, the sequence of
elements in the (3,3)-Gray code is:
000 ~ 0
001 ~ 1
002 ~ 2
012 ~ 5
011 ~ 4
010 ~ 3
020 ~ 6
021 ~ 7
022 ~ 8
122 ~ 17
121 ~ 16
120 ~ 15
110 ~ 12
111 ~ 13
112 ~ 14
102 ~ 11
101 ~ 10
100 ~ 9
200 ~ 18
201 ~ 19
202 ~ 20
212 ~ 23
211 ~ 22
210 ~ 21
220 ~ 24
221 ~ 25
222 ~ 26
Unfortunately, for odd "n" the code has
no cyclic property. (From "222" to "000"
needs three digits change.)
Horst Lepeddle's Ternary Counter is also
a special Gray code, but it's more
complicated. If one cell represents one
digit, the cell has four possible states
{0,1,2,3} (= the orientation of the
rotary mirror). To complicate the
matter, there are two different
anti-tank shots {L,R}.
The sequence of the elements is:
{000L, 001R, 002L, 012R, 013L, 010R,
020L, 021R, 022L, 122R, 123L, 120R,
130L, 131R, 132L, 102R, 103L, 100R,
200L, 201R, 202L, 212R, 213L, 210R,
220L, 221R, 222L, etc.}
(Notice that some combinations of mirror
orientations are never happened.)
Knowing an element and the rules, the
next element can easily be generated.
Its decimal equivalent can be determined
too.
Bye,
Suyono
prokofiev022000 wrote:
>
> To summarize there are two types of
> counters in LT:
>
> - The "Natural n-ary counters": they
> count the numbers in their natural
> order but require several moves/shots
> per iteration. (see levels 295, 396,
> 398, 410 and 411 in "Special-I.lvl"
> and Donald's latest counters in
> "Special-no-LPB.lvl").
>
> - The "Gray n-ary counters" : They
> require only one move/shot per
> iteration but count in the Gray code.
> (see levels 400 to 407 and the trinary
> and quinary levels in
> "special-no-LPB.lvl").
>
> It should be interresting to identify
> them like that in the future levels.
>
> By the way, how does the trinary
> counter count ?
> In the gray code base 3, of course ;-)
> Here is how it goes (compared to
> natural and gray base2):
> natural gray gray
> base 3 base 2
> ------ ------- ------
> 0 0 0
> 1 1 1
> 2 2 3
> 3 5 2
> 4 3 6
> 5 4 7
> 6 7 5
> 7 8 4
> 8 6 12
> 9 15 13
> 10 16 15
> 11 17 14
> 12 11 10
> 13 9 11
> 14 10 9
> 15 13 8
> 16 14 24
> 17 12 25
> 18 21 27
> 19 22 26
> 20 23 30
> 21 26 31
> 22 24 29
> 23 25 28
> 24 19 20
> 25 20 21
> 26 18 23
> 27 45 22
>
> and what about the quinary ?
>
> Alexis Monnerot
>