## ~shreyasminocha/kaleidoscope

Tools for recording Kaleidoscope Classic puzzles and solutions

f0ba1db `Fix typo`

1 year, 7 months ago

6a19e76 `Add license`

1 year, 7 months ago

## #Kaleidoscope Classic Representation Specification

18 pieces. 8×8 grid.

This document specifies a concise, human-readable, machine-parsable representation of KC puzzles and KC solutions.

Note: the BNFs here specify a superset of the valid representations. In other words, a representation deemed valid by the BNF may or may not actually be valid. However, a representation deemed invalid by the BNF is necessarily invalid.

### #Puzzles

Symbol Colour
`K` Black
`R` Red
`B` Blue
`Y` Yellow
```Square ::= 'K' | 'R' | 'B' | 'Y'
PuzzleRow ::= (Square){8}
Puzzle ::= (PuzzleRow '\n'){8}
```

Example:

``````KYKBKYKB
YKRKRKRK
KRKRKRKY
BKRKRKRK
KRKRKRKB
YKRKRKRK
KRKRKRKY
BKYKBKYK
``````

### #Solutions

A puzzle representation followed by a description of the arrangement of the pieces.

Map each of the eighteen pieces to a unique, alphanumeric (`a-zA-Z0-9`) character. Next, for each piece, represent every squared occupied by the piece with its designated character.

```PieceComponent ::= [a-zA-Z0-9]
ArrangementRow ::= (PieceComponent){8}
Arrangement ::= (ArrangementRow '\n'){8}
Solution ::= Puzzle '\n'+ Arrangement
```

Example:

``````KYKBKYKB
YKRKRKRK
KRKRKRKY
BKRKRKRK
KRKRKRKB
YKRKRKRK
KRKRKRKY
BKYKBKYK

aeedjklr
afeejllr
bffjjmmq
bgfiinnp
bgghinnp
bghhhopp
cccccccc
``````

### #Implementation Concerns

```[
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>,
<piece>
]
```
```{
[name]: [ // red-black
[], // row
[], // row
[], // row
],
[name.toUppercase()]: [ // black-blue-yellow
[], // row
[], // row
[], // row
]
}
```