A Gray code is a binary code that is designed to avoid "Hamming cliffs". In the standard binary code, 7 is represented as 0111 and 8 is represented as 1000. These numbers are adjacent, yet the Hamming distance from 0111 to 1000 is large. In a Gray code, adjacent numbers are represented with binary codes that have small Hamming distances. This tends to improve the performance of a genetic algorithm (Grefenstette, 1986).