Removing files from data analysis directory
[ou-summer-of-code-2017.git] / 05-display-board / instructions.md
1 # Laser display boards
2
3 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.
4
5 Given your l33t haxor skilz, it will be no problem to recreate the messages on the display boards.
6
7 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:
8
9 * `top A B` 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.
10 * `left A B` is similar, but works on the left edge, toggling the state of pixels in the leftmost column in rows A to B inclusive.
11 * `rotate column A B` rotates column A by B spaces down. Pixels that are moved beyond the bottom edge "wrap around" to the top edge.
12 * `rotate row A B` rotates row A by B spaces to the right. Pixels that are moved beyond the right edge "wrap around" to the left edge.
13
14 You can assume all numbers are integers, the row and column values are always valid, and `A` $\le$ `B` in the `left` and `top` commands.
15
16 For instance, with a smaller grid that is 10 pixels wide and 4 tall, this is what a sample sequence of instructions would do.
17
18 * `top 1 6` turns on the first six pixels on the top row.
19 ```
20 ******....
21 ..........
22 ..........
23 ..........
24 ```
25
26 * `rotate column 2 3` moves the lit pixel on the second column to the bottom row.
27 ```
28 *.****....
29 ..........
30 ..........
31 .*........
32 ```
33
34 * `top 3 10` turns off the pixels in columns 4, 5, and 6, and turns on the pixels in columns 7 to 10.
35
36 ```
37 *.....****
38 ..........
39 ..........
40 .*........
41 ```
42
43 * `rotate column 8 5` 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.
44 ```
45 *.....*.**
46 .......*..
47 ..........
48 .*........
49 ```
50
51 * `rotate row 2 6` moves that pixel off the right edge of the display, to it wraps around to appear in column 4.
52 ```
53 *.....*.**
54 ...*......
55 ..........
56 .*........
57 ```
58
59 * `left 1 3` 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.
60 ```
61 ......*.**
62 *..*......
63 *.........
64 .*........
65 ```
66