+ int w = state->w, h = state->h, r, c;
+ int cw = 4, ch = 2, gw = cw*w + 2, gh = ch * h + 1, len = gw * gh;
+ char *board = snewn(len + 1, char);
+
+ memset(board, ' ', len);
+
+ for (r = 0; r < h; ++r) {
+ for (c = 0; c < w; ++c) {
+ int cell = r*ch*gw + cw*c, center = cell + gw*ch/2 + cw/2;
+ int i = r*w + c, num = state->numbers->numbers[i];
+
+ if (num < 100) {
+ board[center] = '0' + num % 10;
+ if (num >= 10) board[center - 1] = '0' + num / 10;
+ } else {
+ board[center+1] = '0' + num % 10;
+ board[center] = '0' + num / 10 % 10;
+ board[center-1] = '0' + num / 100;
+ }
+
+ if (state->edges[i] & EDGE_L) board[center - cw/2] = '|';
+ if (state->edges[i] & EDGE_R) board[center + cw/2] = '|';
+ if (state->edges[i] & EDGE_T) board[center - gw] = '-';
+ if (state->edges[i] & EDGE_B) board[center + gw] = '-';
+
+ if (state->grid[i] == i) continue; /* no domino pairing */
+ if (state->grid[i] < i) continue; /* already done */
+ assert (state->grid[i] == i + 1 || state->grid[i] == i + w);
+ if (state->grid[i] == i + 1)
+ draw_domino(board, cell, '+', gw, ch, '|', +1, 2*cw, '-');
+ else if (state->grid[i] == i + w)
+ draw_domino(board, cell, '+', +1, cw, '-', gw, 2*ch, '|');
+ }
+ board[r*ch*gw + gw - 1] = '\n';
+ board[r*ch*gw + gw + gw - 1] = '\n';
+ }
+ board[len - 1] = '\n';
+ board[len] = '\0';
+ return board;
+}
+
+struct game_ui {
+ int cur_x, cur_y, cur_visible, highlight_1, highlight_2;
+};
+
+static game_ui *new_ui(const game_state *state)
+{
+ game_ui *ui = snew(game_ui);
+ ui->cur_x = ui->cur_y = 0;
+ ui->cur_visible = 0;
+ ui->highlight_1 = ui->highlight_2 = -1;
+ return ui;