blob: 233c1d65b4191089549c52ccba85cc061ad0ec53 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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>
|