Color-Encoded Information Protocol (CEIP) for LEGO
Version 1.1
Table of Contents
- Introduction
- Objectives
- Rationale
- Color Term Choices
- Ordering of Color Index
- Use of ASCII Characters for Keys
- Use of Numbers for Values
- Key/Value Pair Representation
- Color to Number Mapping
- Protocol Description
- Encoding
- Decoding
- Special Commands and Message Buffering
- Use Cases
- Future Work and Recommendations
1. Introduction
The Color-Encoded Information Protocol (CEIP) aims to provide a standardized way of representing digital information using LEGO bricks of specific colors. With the integration of 12 distinctive colors, this protocol offers a medium to encode and decode key/value pairs, where the key is an ASCII character, and the value is a number between 0 and 143.
2. Objectives
- Encode key/value pairs where the key is a printable ASCII character, and the value is a number between 0-143.
- Support a buffer for message data.
- Ensure the protocol is human-readable and interpretable.
- Allow the storage of various types of data, including game states and object attributes.
3. Rationale
3.1 Color Term Choices
The protocol utilizes 12 easily distinguishable colors that are universally recognizable and available in LEGO sets.
3.2 Ordering of Color Index
Colors are indexed from 0 to 11 in alphabetical order for ease of standardization and recollection.
3.3 Use of ASCII Characters for Keys
ASCII characters in the printable range (32-126) are used for the keys to ensure wide compatibility and ease of use. They are globally recognized and accommodate a rich variety of symbols and letters.
3.4 Use of Numbers for Values
The values range from 0 to 143. This is intentionally designed to match the 12×12 combinations that can be formed using the 12 unique colors (12 * 12 = 144, ranging from 0 to 143).
3.5 Key/Value Pair Representation
Each key/value pair is represented as a set of four LEGO bricks of specific colors. The first two bricks represent the ASCII character key, and the next two represent the value as a number between 0 and 143. This ensures each key/value pair can be consistently encoded and decoded using four LEGO bricks.
4. Color to Number Mapping
The core of the CEIP lies in its predefined mapping of colors to numbers:
- “Aqua”: 0,
- “Black”: 1,
- “Blue”: 2,
- “Brown”: 3,
- “Gray”: 4,
- “Green”: 5,
- “Orange”: 6,
- “Pink”: 7,
- “Purple”: 8,
- “Red”: 9,
- “White”: 10,
- “Yellow”: 11,
5. Protocol Description
5.1 Encoding
Encoding of key/value pairs follows the predefined mappings, using four bricks per pair. The first two bricks encode the ASCII key, while the next two encode the value between 0 and 143.
5.2 Decoding
Decoding reverses the encoding process, translating each set of four bricks back into a key/value pair.
6. Special Commands and Message Buffering
If two bricks at the beginning of a row appear in sequence as Aqua followed by Blue (which decodes to the ASCII code point for ␂ or Start of Text), this signals the start of a message buffer. The buffer continues until another ␂ character is encountered or the row ends.
7. Use Cases
- Storing game states
- Embedding attributes in physical objects
- Encoding messages or notes
- Educational implementations
8. Future Work and Recommendations
- Validation and error-correction features
- Protocol optimizations
- Compatibility extensions
This updated document is designed to address potential areas of confusion, particularly around the constraints of the key/value pairs. By adhering to these updated specifications, you ensure a standardized and reliable encoding and decoding of data.