[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
computer-go: GMP Redux
Can someone explain to me the format of the start byte in a GMP packet?
I have looked at the specs, and have tried to understand by inspection
the code from Nemesis, ManyFaces, Jago, and cgoban 1, but I guess I must
be stupid, because I just don't get it.
I understand what the two lower-order bits, the "sequence bits", are
_supposed_ to convey, I just don't see _how_ they do this. And I don't
think I understand the purpose of the higher-order bits at all.
The specs say:
The sequence bits determine if his incoming command is old
or new, and whether he has seen or not seen your most recent
command sent to him.
Really? How? Which bit does what? Does this mean that, for the "twos"
bit -- defined as "his" -- old=0 and new=1? If so, what is the purpose
of his ever sending an "old" command? If not, just what _does_ it mean?
And how do I know whether he has seen or not seen my most recent send?
Surely he is not sending me a switch saying "No, I have not seen it".
I know that these questions must seem incredibly stupid to someone who
already gets it, but I am missing something fundamental about GMP.
As for the higher order bits, the specs say, "THE FIRST MESSAGE EVER
SENT
WILL HAVE A START BYTE OF 0100 0001, which says foe's last message was
0,
and my new sequence value is 1." That's pretty emphatic, so I guess I
believe you, but... Huh? Now I am _really_ confused.
It's tautological that "my new sequence value is 1", because the
lowest-order bit is defined as my sequence value, and it is set to 1.
But what does that _mean_?
"The foe's last message was 0." Ummm... O.K., so the next-higher-order
bit ("his") is zero? Fine, so am I telling him that I have not seen his
previous message when this bit is zero?
What is really confusing to me is the higher-order bit that's set in
0100 0001. In Bruce Wilcox's code, there is a test for a "talk
character":
if (c > 3) && c < 128)
Now 0100 0001 is 0x41, or decimal 65. It seems as if that should be
interpreted as a "talk character" instead of a start byte. What is the
purpose, then, of having that higher-order bit set in the first message
ever sent? What am I missing here?
Back to the sequence bits.
There seem to be four possibilities for states of the two lower-order
bits.
What is the meaning when both bits are set? What is the meaning when my
bit
is set, and his clear? What is the meaning when my bit is clear and his
is
set? What is the meaning when both bits are clear?
I guess I am just embarrassingly dense, but can someone please explain?
The specs also say, "Your sequence ID is incremented before creating a
new
non-OK message, and is incorporated into the message." Now, if my
sequence
ID is a single bit, am I safe in assuming that "incremented" here means
the same thing as "toggled"? Or are we really _counting_ messages, and
I am just too dumb to understand how and where?
Thanks for any illumination that anyone can provide.
--
Richard L. Brown Office of Information Services
Unix Guy University of Wisconsin System Administration
780 Regent St., Rm. 246
rbrown@xxxxxxxxxxxxxxxxx Madison, WI 53715