diff options
Diffstat (limited to 'html/kgame/index.html')
-rw-r--r-- | html/kgame/index.html | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/html/kgame/index.html b/html/kgame/index.html new file mode 100644 index 0000000..233c1d6 --- /dev/null +++ b/html/kgame/index.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>K-Grid Painter</title> + <link rel="stylesheet" href="style.css"> +</head> +<body> + <h1>K-Grid Painter</h1> + <p>Control the 50x50 grid below using simplified K-like commands.</p> + <p>The grid state is represented by the variable <code>G</code> (a list of 2500 integers, 0 or 1).</p> + <p>Example commands:</p> + <ul> + <li><code>G : 0</code> (Clear grid)</li> + <li><code>G : 1</code> (Fill grid)</li> + + <li><strong>Basic Operations:</strong></li> + <li><code>G @ 0 : 1</code> (Turn on cell at index 0)</li> + <li><code>G @ (!10) : 1</code> (Turn on first 10 cells - demonstrates ! operator)</li> + <li><code>G @ (100 + !50) : 1</code> (Turn on cells 100-149 - demonstrates + operator)</li> + <li><code>G @ (50 * !50) : 1</code> (Turn on first column - demonstrates * operator)</li> + <li><code>G @ (!2500) : (!2500) % 2</code> (Alternating vertical columns - demonstrates % operator)</li> + + <li><strong>Comparison Operators:</strong></li> + <li><code>G @ (!2500) : ((!2500) % 50) < 25</code> (Left half filled - demonstrates < operator)</li> + <li><code>G @ (!2500) : ((!2500) % 50) > 25</code> (Right half filled - demonstrates > operator)</li> + <li><code>G @ (!2500) : ((!2500) % 50) = 25</code> (Middle column - demonstrates = operator)</li> + + <li><strong>Complex Patterns:</strong></li> + <li><code>G @ (50 * !50 + 25) : 1</code> (Vertical line in middle - demonstrates row/col math)</li> + <li><code>G @ (!50 + 25 * 50) : 1</code> (Horizontal line in middle - demonstrates row/col math)</li> + <li><code>G @ (50 * !50 + !50) : 1</code> (Diagonal line from top-left - demonstrates row/col math)</li> + <li><code>G @ (50 * !50 + (49 - !50)) : 1</code> (Diagonal line from top-right - demonstrates - operator)</li> + <li><code>G @ (!2500) : ((!2500) / 50 + (!2500) % 50) % 2</code> (Checkerboard pattern - demonstrates / and % operators)</li> + + <li><strong>Unary Operators:</strong></li> + <li><code>G @ (!25) : ~(!25)</code> (First cell 1, rest 0 - demonstrates ~ not operator)</li> + <li><code>G @ (!25) : |(!25)</code> (Reverse sequence - demonstrates | reverse operator)</li> + <li><code>G @ (!25) : $(!25)</code> (Rotate sequence - demonstrates $ rotate operator)</li> + <li><code>G @ (!25) : #(!25)</code> (Reshape sequence - demonstrates # reshape operator)</li> + + <li><strong>Operator Composition:</strong></li> + <li><code>G @ (!25) : ~((!25) / 5 + (!25) % 5) % 2</code> (Inverted checkerboard - demonstrates ~ with math)</li> + <li><code>G @ (!25) : |((!25) / 5 + (!25) % 5) % 2</code> (Flipped checkerboard - demonstrates | with math)</li> + <li><code>G @ (!25) : $((!25) / 5 + (!25) % 5) % 2</code> (Rotated checkerboard - demonstrates $ with math)</li> + <li><code>G @ (!25) : #((!25) % 2)</code> (Alternating columns reshaped - demonstrates # with math)</li> + </ul> + + <canvas id="gridCanvas"></canvas> + <div class="input-area"> + <input type="text" id="kInput" placeholder="Enter K-like code (e.g., G @ !10 : 1)" size="60"> + <button id="runButton">Run</button> + </div> + <pre id="output"></pre> + + <script src="script.js"></script> +</body> +</html> \ No newline at end of file |