Gray Code
Gray code, also known as reflected binary code, is a way of representing counting numbers. This coding of numbers is derived from the ordinary positional system of base two numerals which we usually refer to as binary numbers. Counting in binary leads to many carries between digits: 0 zero, 1 one, 10 two, 11 three, 100 four, 101 five, 110 six, 111 seven, 1000 eight, 1001 nine, 1010 ten, 1011 eleven, 1100 twelve, 1101 thirteen, 1110 fourteen, 1111 fifteen, 10000 sixteen, and so on.
Binary is a great representation of numbers for doing arithmetic computations but is less than ideal for showing a simple countdown. Gray coding abandons easy arithmetic for elegance in counting. With Gray code no two consecutive numbers can vary in more than a single digit position: 0 zero, 1 one, 11 two, 10 three, 110 four, 111 five, 101 six, 100 seven, 1100 eight, 1101 nine, 1111 ten, 1110 eleven, 1010 twelve, 1011 thirteen, 1001 fourteen, 1000 fifteen, 11000 sixteen, and so on.
Gray code has been widely used in mechanical and electomechanical shaft encoders which robustly converts a rotary knob input with multiple detents through a system of on/off switches by avoiding concurrent switching at the transitions. This same robustness makes it ideal for representing a countdown via visual signals which are difficult to switch simultaneously.
Gray Code Countdown
In our Gray code signalling system we have four heights of flags which correspond to the digit positions. The leftmost, most-significant digit becomes the highest flag and the rightmost, least-significant digit flag becomes the lowest flag. Where the Gray code is the digit 1 our flag will be displayed — where the Gray code is the digit 0 our flag will be hidden.
- The highest most-significant digit changes slowly. For this position we use code flag F — or, after a postponement, general recall or abandonment, the corresponding signal flag — for whatever role it plays we will call this the attention flag.
- The second most-significant digit also changes slowly. For this position we use the class flag.
- The next most-significant digit and the second lowest flag changes more rapidly and in the full countdown the same signal flag will be displayed and removed twice in succession. For this position we use the preparatory flag, be it code flag P, I, Z, Z with I, U, or the black flag.
- The least-significant digit and the lowest flag changes most rapidly of all in the full countdown. It is the end-of-the-line orange flag whose state changes every two minutes. This will be the most precisely timed flag.
For a Race Committee vessel displaying these flags in a fifteen minute countdown only one flag need be changed every minute and a competitor will be able to tell at a glance where they are in the countdown precise to the minute.
In the countdown, sounds signals occur at fifteen minutes-to-go, ten minutes-to-go, seven minutes-to-go, five minutes-to-go, one minute-to-go and at the start itself. The interval between sounds is five minutes, three minutes, two minutes, four minutes and one minute making the countdown identifiable by the time between sound signals as well as by visual signals. So we don’t need a long sound to distinguish a specific sound signal within the sequence. However, having the one-minute signal be one long sound avoids having to override the rule RRS Race Signals for Preparatory Signals. This is less elegant but more straightforward for an easy-to-understand sailing instruction.
Practical Limitations
Using the Orange Flag as a Countdown Flag
Using the orange flag as a countdown flag doesn’t present a problem for competitors as the line becomes precisely visible two minutes before the start and any one-minute I, Z, Z with I, U, or the black flag restrictions don’t come into effect for another minute. The line loses its visible precision at the starting signal when the orange flag is removed — but this is a benefit as any boats over-early can then judge themselves relative to the Race Committee’s line spotter and his X flag. This is the effective requirement to starting properly as the line spotter can not always be in line with the orange flag but can more easily align themselves to the X flag which is often handheld.
Beginning the Countdown
Fifteen minutes is a long countdown. This may desirable for a first start in a race but not necessarily for subsequent starts on the same course. The only way to begin a countdown sequence by displaying a single flag is when the minutes-to-go equals a power of two minus one — fifteen minutes-to-go with four heights of flags, seven minutes-to-go with three heights of flags, three minutes-to-go with two heights of flags and one minute-to-go with a single flag. We discard the three and one minute and focus on the seven minutes-to-go option as the shorter alternative to a fifteen minute countdown.
By raising the class flag at seven minutes to the start we can begin a countdown without needing an attention signal. This may be desirable when starting classes in succession. When starting boats at ten minute intervals we can leave three minutes after the starting signal of the preceding class before beginning the countdown for the following class. This works extremely well when classes start in a known sequence. It is easy on a Race Committee but still highly informative to competitors. The one disadvantage to this scheme, as far as the competitor is concerned, is that the clock effectively begins anew every ten minutes without being necessarily synchronized between starts.
Eliding Starts
Another option, when starting classes in succession, is by eliding the beginning of the countdown for subsequent classes with the start of the preceding class. In this scenario the clock never stops but wraps around to a new countdown. The opportunity to raise a single flag at the starting signal of the preceding class occurs at fourteen minutes-to-go, six minutes-to-go and two minutes-to-go. We must reject the two minute option and find little to recommend the fourteen minute alternative. Six minutes is our Goldilocks solution which elides the warning signal for the succeeding class with start for the preceding class.
Beginning a Countdown with All Flags Flying
Beginning a countdown with multiple simultaneous flags is harder on the Race Committee but may be friendlier to the competitor by making the signal which sets the clock and begins the countdown more obvious. All-flags-flying opportunities occurs at ten minutes-to-go with four flags, five minutes-to-go with three flags, two minutes-to-go with two flags and one minute-to-go with one flag. After discarding the two and one minute options we are left with an admirable ten minute option and an only slightly problematic five minute option. The five minute option requires eliding the warning signal which would normally occur at six minutes-to-go in the countdown with the preparatory signal at five minutes to go; this is inelegant but not a showstopper; indeed, this was very common under the older starting systems. And there is no sound associated with the warning signal in this system so we don’t lose a sound signal in the process.
Precisely Timing a Countdown with Multiple Flags
It might be desirable to begin the countdown at any point, five minutes or longer, by raising the specific set of flags to represent that stage in the countdown. With code flag F There is no possibility of ambiguity in doing so, but there is still the difficulty in precise timing of simultaneous flag raisings. When displaying flags simultaneously the rule should be simple enough, the lowest or least-significant flag displayed should be the first and most precisely timed flag — this may be the hardest to see but it is the easiest for the Race Committee to time precisely — higher flags should follow from lowest to highest as quickly as possible.
When eliding into the countdown of a previous start it may be necessary to lower the orange flag before raising the others; clearly precise timing should then be taken from the lowering of the orange and flag raising should then follow as noted before. When the orange should remain flying it will stay undisturbed and precise timing should be taken from the next least-significant flag to be raised.
After a Postponement, General Recall or Abandonment
Considering code flags AP, 1st Sub and N as attention flags in our timed countdown has three slight problems associated with it. When the postponement, general recall or abandonment is first signalled other flags may be flying which are not intended to be interpreted as being part of the countdown. These flags need to be lowered while giving the Race Committee time to collect their thoughts. Giving the Race Committee a minute to do so is only sensible. And, having lowered the offending flags, the Race Committee may not wish to immediately begin a countdown so the single code flags AP, 1st Sub and N flying shouldn’t be interpreted as between fifteen and fourteen minutes until the start but rather as an indeterminate delay. Finally, after that untimed delay the Race Committee may not be willing to wait fourteen minutes until the next start.
Beginning the Countdown
Opportunities to raise a single flag to set the clock running occurs at fourteen minutes, twelve minutes and eight minutes before the start. Note that, after the countdown is begun, the lowering of the attention flag at seven minutes to go with one sound is consistent with the requirements of the rule book for removing the code flags AP, 1st Sub and N flags one minute before the warning signal.
With Dinghies: Lowering AP, 1st Sub or N Before Setting the Clock Running
Lowering the code flags AP, 1st Sub and N flags one minute before beginning the Gray code countdown at the warning signal at either six minutes before the start or with an elided warning and preparatory signal at five minutes-to-go is one way to interpret the Gray code rule which is consistent with the rule book and our defined Gray code countdown; nevertheless, it is against the spirit of the rule and should be disallowed when using a four level Gray code which includes code flag F. If code flag F is never used then such an understanding may be acceptable for a dinghy race where short notice is the normal practice.
With Larger Boats: Lowering AP, 1st Sub or N After Setting the Clock Running
But lowering the attention flag simultaneously with beginning the Gray code countdown at seven minutes-to-go leads to a conflict in precise timing rules between the rule book ordained lowering of the code flags AP, 1st Sub and N flags and the Gray code’s rule that the least-significant flag determines the precise timing. This leaves us eight minutes before the start as being the earliest opportunity to start the clock with the full four-level Gray code starting system. The raising of the class flag to start in eight minutes seems sensible. In this case there is no sound signal when the clock is set running; the first sound signal after beginning the countdown will occur at the seven-minute signal which coincides with the removal of the code flag AP, 1st Sub or N flag.
For longer countdowns the Race Committee can raise simultaneous flags using the precise timing rules already elucidated — of the alternatives to setting the clock running at fourteen, twelve or eight minutes-to-go, setting the clock running at ten minutes-to-go with all flags flying and one sound is the only one which seems desirable.
Sample Text of a Rule RRS 26 Substitute
We will throw together a sample rule using a simple countdown where the race committee need never change more than one flag at a time. We have two alternative formulations of the same rule. The wording of these rules are designed to be short and unambiguous but not to give the best sense of how the countdown works.
-
The title of sailing instruction 26, its preamble and the first subinstruction 26.1 are common to both alternatives.
-
By not stating the transitions but simply what flags should be flying after a given point in the countdown, we can simplify the statement of different cases. This is the first alternative.
-
In the second alternative, flag transitions are documented but the state of the displayed flags as being bits in the Gray code is left undocumented. Only stating transitions in the rule leads to somewhat lengthy wording when the countdown is set running at a time different from the beginning of the table.
Common Sample Text
SI 26 STARTING RACES USING A GRAY CODE COUNTDOWN
Races shall be started by using the following signals. Times shall be taken from the visual signals; the absence of a sound signal shall be disregarded.
26.1. The Hierarchy of Visual Signals
Visual signals are arranged in a four level hierarchy, top-to-bottom:
Level in hierarchy | Height | Flag |
---|---|---|
Attention flag | Topmost | F, AP, 1st Sub or N |
Class flag | Second from top | |
Preparatory flag | Second from bottom | P, I, Z, Z with I, U, or black flag |
Line flag | Bottommost | Orange flag |
When code flag X is displayed it shall be the end of the line as far as boats restarting are concerned. The orange flag will be the end of the line for succeeding classes. This changes RRS Race Signals for code flag X and the orange flag.
The First Alternative: Sample Text for Subinstructions
26.2. Beginning a Countdown at Fifteen or Seven Minutes to Go
For a scheduled start the countdown shall begin at fifteen minutes to go. For subsequent starts in the absence of a postponement, general recall or abandonment, the countdown table may be short-circuited to begin at seven minutes-to-go.
A fifteen or seven minute countdown for each succeeding class may begin at any time after, but not with, the starting signal of the preceding class.
The attention flag for a fifteen minute countdown will be code flag F.
26.3. The Countdown Table
min | Flags showing after signal | Sound signal | Means | |||
---|---|---|---|---|---|---|
Attn. | Class | Prep. | Line | |||
15 | ✓ | One sound | Attention | |||
14 | ✓ | ✓ | ||||
13 | ✓ | ✓ | ✓ | |||
12 | ✓ | ✓ | ||||
11 | ✓ | ✓ | ✓ | |||
10 | ✓ | ✓ | ✓ | ✓ | One sound | Ten minute |
9 | ✓ | ✓ | ✓ | |||
8 | ✓ | ✓ | ||||
7 | ✓ | One sound | Seven minute | |||
6 | ✓ | ✓ | Warning signal | |||
5 | ✓ | ✓ | ✓ | One sound | Preparatory signal | |
4 | ✓ | ✓ | ||||
3 | ✓ | |||||
2 | ✓ | ✓ | ||||
1 | ✓ | One long sound | One minute | |||
0 | One sound | Starting signal |
At each signal either one more flag is displayed or one flag is removed to be consistent with the table above. However,
-
Eliding the Countdown for Succeeding Classes for Starts at Six Minute Intervals
the warning signal for a succeeding class may be made with the starting signal of the preceding class by leaving the line flag displayed and displaying the next class flag.
26.4. Beginning a Countdown After a Postponement, General Recall or Abandonment
When such an attention flag is flying and all lingering class, preparatory and line flags have been removed, a countdown may be begun. With no sound signal and leaving the attention flag displayed the countdown should begin:
- at fourteen minutes-to-go,
- at twelve minutes-to-go or
- at eight minutes-to-go.
When a start is to follow, the attention flag shall not be removed without having first begun a countdown.
The Second Alternative: Sample Text for Subinstructions
26.2. The Countdown Table
min | Visual signal | Sound signal | Means | |
---|---|---|---|---|
15 | Attn. | flag displayed | One sound | Attention |
14 | Line | flag displayed | ||
13 | Prep. | flag displayed | ||
12 | Line | flag removed | ||
11 | Class | flag displayed | ||
10 | Line | flag displayed | One sound | Ten minute |
9 | Prep. | flag removed | ||
8 | Line | flag removed | ||
7 | Attn. | flag removed | One sound | Seven minute |
6 | Line | flag displayed | Warning signal | |
5 | Prep. | flag displayed | One sound | Preparatory signal |
4 | Line | flag removed | ||
3 | Class | flag removed | ||
2 | Line | flag displayed | ||
1 | Prep. | flag removed | One long sound | One minute |
0 | Line | flag removed | One sound | Starting signal |
26.3. A Regular Countdown
The attention flag for a fifteen minute countdown will be code flag F.
For a scheduled start the countdown shall begin at fifteen minutes to go. For subsequent starts in the absence of a postponement, general recall or abandonment, the countdown table may be short-circuited to begin at seven minutes-to-go by:
min | Visual signal | Sound signal | Means | |
---|---|---|---|---|
7 | Class flag displayed | One sound | Seven minute | |
6 … | as per the minutes-to-go countdown table above … |
A fifteen or seven minute countdown for each succeeding class may begin at any time after, but not with, the starting signal of the preceding class.
26.4. Eliding the Countdown for Succeeding Classes for Starts at Six Minute Intervals
The warning signal for a succeeding class may be made with the starting signal of the preceding class by leaving the line flag displayed and:
min | Visual signal | Sound signal | Means | |
---|---|---|---|---|
0 & 6 | Class flag displayed | One sound | Start and warning | |
5 … | as per the minutes-to-go countdown table above … |
26.5. Beginning a Countdown After a Postponement, General Recall or Abandonment
When such an attention flag is flying and all lingering class, preparatory and line flags have been removed, a countdown may be begun, with no sound signal, by leaving the attention flag displayed and:
a) at fourteen minutes-to-go by displaying the line flag:
min | Visual signal | Sound signal | Means | |
---|---|---|---|---|
14 … | as per the minutes-to-go countdown table above … |
b) at twelve minutes-to-go by:
min | Visual signal | Sound signal | Means | |
---|---|---|---|---|
12 | Prep. flag displayed | |||
11 … | as per the minutes-to-go countdown table above … |
c) at eight minutes-to-go:
min | Visual signal | Sound signal | Means | |
---|---|---|---|---|
8 | Class flag displayed | |||
7 … | as per the minutes-to-go countdown table above … |
When a start is to follow, the attention flag shall not be removed without having first begun a countdown.