Removing files from data analysis directory
[ou-summer-of-code-2017.git] / 05-display-board / instructions.html
1 <h1 id="laser-display-boards">Laser display boards</h1>
2 <p>You're off on your first sightseening trip of your holiday and you need to catch the right llama-rickshaw to get there. You arrive all keen at the llama-rickshaw station, only to find a scene of chaos. The bad news is that there are lots of llama-rickshaws heading to different places. The good news is that above each bay is a display board that shows where that llama-rickshaw is heading. The bad news is that all the display boards have gone down. The good news is that the station staff are handing out the machine-code instructions to generate the messages on the board.</p>
3 <p>Given your l33t haxor skilz, it will be no problem to recreate the messages on the display boards.</p>
4 <p>The board is grid, 80 pixels wide and 8 pixels tall, with row 1 being the top row and column 1 being the left column. The pixels are changed with these commands:</p>
5 <ul>
6 <li><code>top A B</code> switches the state of the pixels in the topmost row from columns A to B inclusive. If a pixel was lit, it becomes dark; if it was dark, it becomes lit.</li>
7 <li><code>left A B</code> is similar, but works on the left edge, toggling the state of pixels in the leftmost column in rows A to B inclusive.</li>
8 <li><code>rotate column A B</code> rotates column A by B spaces down. Pixels that are moved beyond the bottom edge &quot;wrap around&quot; to the top edge.</li>
9 <li><code>rotate row A B</code> rotates row A by B spaces to the right. Pixels that are moved beyond the right edge &quot;wrap around&quot; to the left edge.</li>
10 </ul>
11 <p>You can assume all numbers are integers, the row and column values are always valid, and <code>A</code> <span class="math inline"></span> <code>B</code> in the <code>left</code> and <code>top</code> commands.</p>
12 <p>For instance, with a smaller grid that is 10 pixels wide and 4 tall, this is what a sample sequence of instructions would do.</p>
13 <ul>
14 <li><p><code>top 1 6</code> turns on the first six pixels on the top row.</p>
15 <pre><code>******....
16 ..........
17 ..........
18 ..........</code></pre></li>
19 <li><p><code>rotate column 2 3</code> moves the lit pixel on the second column to the bottom row.</p>
20 <pre><code>*.****....
21 ..........
22 ..........
23 .*........</code></pre></li>
24 <li><p><code>top 3 10</code> turns off the pixels in columns 4, 5, and 6, and turns on the pixels in columns 7 to 10.</p></li>
25 </ul>
26 <pre><code>*.....****
27 ..........
28 ..........
29 .*........</code></pre>
30 <ul>
31 <li><p><code>rotate column 8 5</code> moves the one lit pixel in column 8 down five rows, wrapping it all the way around the display and leaving the board with one lit pixel in that column one row lower.</p>
32 <pre><code>*.....*.**
33 .......*..
34 ..........
35 .*........</code></pre></li>
36 <li><p><code>rotate row 2 6</code> moves that pixel off the right edge of the display, to it wraps around to appear in column 4.</p>
37 <pre><code>*.....*.**
38 ...*......
39 ..........
40 .*........</code></pre></li>
41 <li><p><code>left 1 3</code> toggles the pixels in rows 1, 2, and 3 of the first column. The top left pixel (previously on) turns off, while the pixels in rows 2 and 3 come on.</p>
42 <pre><code>......*.**
43 *..*......
44 *.........
45 .*........</code></pre></li>
46 </ul>