2017-04-08 20:58:11 -06:00
|
|
|
#include <stdio.h>
|
2017-04-22 10:33:53 -06:00
|
|
|
#include "holes.h"
|
2017-04-08 20:58:11 -06:00
|
|
|
|
2017-04-16 14:40:25 -06:00
|
|
|
#define NORMAL 0x80
|
|
|
|
#define BLINK 0x40
|
|
|
|
|
2017-04-08 20:58:11 -06:00
|
|
|
int main()
|
|
|
|
{
|
2017-04-16 14:40:25 -06:00
|
|
|
char c;
|
2017-04-16 13:57:04 -06:00
|
|
|
int i, j, k, line = 0;
|
2017-04-08 20:58:11 -06:00
|
|
|
unsigned char screen[24][40];
|
|
|
|
|
2017-04-16 14:02:54 -06:00
|
|
|
// clear screen (just in case < 40x24)
|
2017-04-16 10:38:06 -06:00
|
|
|
for (i = 0; i < 24; i++)
|
|
|
|
for (j = 0; j < 40; j++)
|
2017-04-16 14:40:25 -06:00
|
|
|
screen[i][j] = ' ' | NORMAL;
|
2017-04-08 20:58:11 -06:00
|
|
|
|
2017-04-16 13:57:04 -06:00
|
|
|
i = j = 0;
|
2017-04-16 10:38:06 -06:00
|
|
|
while ((c = getchar()) != EOF) {
|
|
|
|
if (c == '\r') // windows trash
|
2017-04-08 20:58:11 -06:00
|
|
|
continue;
|
2017-04-16 10:38:06 -06:00
|
|
|
if (c == '\n') { // end of line
|
2017-04-16 13:57:04 -06:00
|
|
|
j = 0;
|
|
|
|
i++;
|
|
|
|
line = 3 * (i % 8) + i / 8;
|
2017-04-08 20:58:11 -06:00
|
|
|
continue;
|
|
|
|
}
|
2017-04-16 13:57:04 -06:00
|
|
|
if (j > 39) // user didn't read the docs
|
2017-04-15 21:24:44 -06:00
|
|
|
continue;
|
2017-04-16 13:57:04 -06:00
|
|
|
if (i > 23) // ditto
|
2017-04-15 21:24:44 -06:00
|
|
|
break;
|
2017-04-08 20:58:11 -06:00
|
|
|
|
2017-04-16 14:40:25 -06:00
|
|
|
screen[line][j++] = c | NORMAL;
|
2017-04-08 20:58:11 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// dump to stdout
|
2017-04-16 10:38:06 -06:00
|
|
|
for (i = 0; i < 24; i++) {
|
|
|
|
for (j = 0; j < 40; j++)
|
2017-04-08 20:58:11 -06:00
|
|
|
putchar(screen[i][j]);
|
2017-04-16 13:57:04 -06:00
|
|
|
if (i % 3 == 2)
|
2017-04-16 10:38:06 -06:00
|
|
|
for (k = 0; k < 8; k++)
|
|
|
|
putchar(holes[(i / 3) * 8 + k]);
|
2017-04-08 20:58:11 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|