Stack Overflow Code Challenge

Problem Statement

Devise a mechanism for encoding secret messages of at least 8 characters in the board state of a board game of your choice.

Requirements:

  • Must encode messages ≥8 characters using a board game state
  • Can use any board game (chess, checkers, tic-tac-toe, etc.)
  • Can use sequential board states for games with limited states
  • Board states don't need to be legal game positions
  • Should include both encoding and decoding mechanisms

Evaluation Criteria:

  • Creativity in cipher design
  • Implementation completeness
  • Code quality and readability
  • User interface (if applicable)
  • Originality of the solution

Our Solution: Tic-Tac-Cipher

We've created an advanced cipher that uses Tic-Tac-Toe board states to encode messages with multiple encoding modes and optional encryption.

Key Features:

  • Multiple Encoding Modes: Basic, Positional, and Alternating Player
  • XOR Encryption: Optional encryption with a secret key
  • Visual Board Display: See the encoded boards
  • Auto-Detection: Decoder can detect encoding mode
  • Responsive Design: Works on all devices
  • Complete Implementation: Full encoder/decoder in one page
Hifza Khalid

Team

Developed by Hifza Khalid for the Stack Overflow Code Challenge

Technical Details

Encoding Process
Decoding Process
Security

Message Encoding Steps:

  1. Message is optionally encrypted with XOR cipher if key is provided
  2. Convert message to binary (UTF-8 encoding)
  3. Split binary into 9-bit chunks (one per Tic-Tac-Toe board)
  4. Apply selected encoding mode:
    • Basic: X=1, O=0
    • Positional: Bit position determines board position
    • Alternating: Changes starting player each board
  5. Generate visual board representation
  6. Output board states as text

Message Decoding Steps:

  1. Parse input board states (one per line)
  2. Detect or select encoding mode
  3. Convert each board back to binary:
    • Basic: X→1, O→0
    • Positional: Board position determines bit position
    • Alternating: Starting player determines bit value
  4. Combine all bits and split into 8-bit bytes
  5. Convert bytes to characters (UTF-8)
  6. Decrypt with XOR cipher if key was used

Security Considerations:

  • Basic mode is simple and easy to detect
  • Positional encoding makes patterns harder to recognize
  • Alternating player adds variability between boards
  • XOR encryption provides basic security when a key is used
  • For stronger security, combine positional encoding with encryption
  • Not suitable for high-security applications without additional layers

Encoder

Settings

Encoded Boards

Encoded Output

Decoder

Settings

Decoded Message