diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-06-07 15:20:02 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-06-07 15:20:02 +0200 |
commit | 022c088d8664af9dee9dec0cac473a3f7eb7c265 (patch) | |
tree | 36a5e17fef1baeaff3b2ad13a20e1ab736f4a1af | |
parent | caf14e45390a81f6fa9e1202f32655693fd027d7 (diff) | |
download | ttfe-022c088d8664af9dee9dec0cac473a3f7eb7c265.tar.xz |
Use box drawing characters
-rw-r--r-- | main.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -399,23 +399,36 @@ void merge_west(board *b) { } } -void print_sep() { - printf("||--------------------------------------------------------------||\n"); +void print_sep(const char *left, const char *right, const char *cross, const char *line) +{ + printf("%s", left); + for(int i = 0; i < 4; i++) { + for(int j = 0; j < 4; j++) + printf("%s", line); + if(i == 3) + printf("%s", right); + else + printf("%s", cross); + } + printf("\n"); } void print_board_line(board *b, int l) { - printf("||\t%u\t|\t%u\t|\t%u\t|\t%u\t||\n", b->x[0][l], b->x[1][l], b->x[2][l], b->x[3][l]); - print_sep(); + printf("\u2503%4u\u2502%4u\u2502%4u\u2502%4u\u2503\n", b->x[0][l], b->x[1][l], b->x[2][l], b->x[3][l]); + + if(l == 3) + print_sep("\u2517", "\u251B", "\u2537", "\u2501"); + else + print_sep("\u2520", "\u2528", "\u253C", "\u2500"); } void print_board(board *b) { printf("\e[2J\e[0;0H"); printf("Score: %u\n", b->points); - print_sep(); + print_sep("\u250F", "\u2513", "\u252F", "\u2501"); for(int i = 0; i < 4; ++i) { print_board_line(b, i); } - printf("\n"); } void print_score(board *b) { |