Display a Connect Four game
Vim, 34 bytes

@wO-&lt;Esc&gt;&lt;C-V&gt;(d@hpqq&lt;C-O&gt;+D@"G+bs&lt;C-R&gt;=!@.&lt;CR&gt;&lt;Esc&gt;@qq@q

Input is width in the "w register, height in the "h register, and the 1-indexed moves in the buffer, one per line. Output is a transposed grid with - as blank, 1 as player 1, and 0 as player 2 (with a bunch of newlines at the end).

To clarify, if you want Height 6, Width 7: type qh6qqw7q before starting.


@wO-&lt;Esc&gt;&lt;C-V&gt;(d@hp: Use the height and width in the registers to make a transposed grid of -s. Note that ( is run from the last line of the grid, one above the moves. This sets up the jump list.
&lt;C-O&gt;+D@"G: The &lt;C-O&gt; uses the jump list to move back to before the last G, always to the line above the next number. @"G moves to the line number indicated by the deleted text. + not only moves the cursor, but it's the failure point; when it runs on the last line, the macro dies.
+b: This maneuver goes to the first - in the line, even if it's the first character. (f- would go to the second character if the line was still all -s.)
s&lt;C-R&gt;=!@.: Replaces a - with the last insert @., but NOTted. First time through, the previous insert of - will NOT to 1 because that's the way Vim is. After that, it will alternate between 0 and 1.


Example

Start with the moves in the buffer:

4
4
5
5
6
7
3


Make sure you're on line 1 with gg, clear "q with qqq, set up the registers for width 7, height 6 with qw7qqh6q. Then run the solution above and get the following output (with newlines at the end):

------
------
1-----
10----
10----
1-----
0-----