- 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
--- In [email protected], "Steve" <stephen.ryan@3...> wrote:
>
> Alexis-
>
> Nice going! Amazing - I had no idea that this type of sequence had
> been previously studied, and it turns out to be something useful
to
> boot. I feel better now that you have finally identified it as
> the "Gray Code"... and what a cool name, too. When I discovered
the
> first cyclic trinary cell and then plugged one cell into another
cell
> to create multiple trits, I found it confusing at first, and knew
> that it was a little weird since only one digit changed at a time,
> but I have always just attributed the reading of the digits as
having
> a dependency on the other digits ("digit dependency"). This is
true,
> of course, but nonspecific and I never thought to study it
further.
> However, I still find it amazing that changing the digits one at a
> time can cycle throught the same number of states as a binary or
> decimal type counter.
>
> Also, I guess, it's no accident that LT counters use the gray
code,
> since they are virtual mechanical devices:
> "Definition: An ordering of 2n binary numbers such that only one
bit
> changes from one entry to the next...
> ...Note: Gray codes are particularly useful in mechanical encoders
> since a slight change in position only affects one bit."
> (http://www.nist.gov/dads/HTML/graycode.html)
>
> So, there is a gray encoded number for every n-ary number, for
> example in binary:
> "Decimal / Gray code / Binary
> 0 0000 0000
> 1 0001 0001
> 2 0011 0010
> 3 0010 0011
> 4 0110 0100
> 5 0111 0101
> 6 0101 0110
> 7 0100 0111
> 8 1100 1000
> 9 1101 1001
> 10 1111 1010
> 11 1110 1011
> 12 1010 1100
> 13 1011 1101
> 14 1001 1110
> 15 1000 1111"
> (http://yagni.com/graycode/)
> there's a discussion at the end that talks about the "digit
> dependency" in reading gray code and conversion to and from binary.
>
> -Steve