-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunicode_test.c
More file actions
133 lines (105 loc) · 3.67 KB
/
unicode_test.c
File metadata and controls
133 lines (105 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include <wchar.h>
#include <locale.h>
#include <string.h>
void borderMaker(char *border, char *leftCorner, char *rightCorner, char *line, int difficulty);
void boardPrinter(int difficulty);
void upDownBorderSquareMaker(char *border, char *doubleVertical, char *simpleLeftCorner, char *simpleHorizontal, char *simpleRightCorner, char *space);
void sideSquareMaker(char *border,char *doubleVertical,char *simpleVertical,char *space, char *underscore);
int main()
{
int difficulty = 4;
boardPrinter(difficulty);
return 0;
}
void boardPrinter(int difficulty)
{
int i;
setlocale(LC_ALL, "");
char underscore[] = "_";
char doubleHorizontal[] = "\u2550";
char doubleVertical[] = "\u2551";
char doubleDownRightCorner[] = "\u2554";
char doubleDownLeftCorner[] = "\u2557";
char doubleUpRightCorner[] = "\u255A";
char doubleUpLeftCorner[] = "\u255D";
char simpleHorizontal[] = "\u2500";
char simpleVertical[] = "\u2502";
char simpleDownRightCorner[] = "\u250C";
char simpleDownLeftCorner[] = "\u2510";
char simpleUpRightCorner[] = "\u2514";
char simpleUpLeftCorner[] = "\u2518";
char space[] = "\u00A0";
char upBorder[1000] = {0};
char downBorder[1000] = {0};
char upSquareBorder[8][1000] = {0};
char downSquareBorder[8][1000] = {0};
char sideSquareBorder[8][1000] = {0};
char emplyLine[1000] = {0};
borderMaker(upBorder, doubleDownRightCorner, doubleDownLeftCorner, doubleHorizontal, (8*difficulty+2));
for (i = 0; i < 8; ++i)
{
upDownBorderSquareMaker(upSquareBorder[i], doubleVertical, simpleDownRightCorner, simpleHorizontal, simpleDownLeftCorner, space);
sideSquareMaker(sideSquareBorder[i], doubleVertical, simpleVertical, space, underscore);
upDownBorderSquareMaker(downSquareBorder[i], doubleVertical, simpleUpRightCorner, simpleHorizontal, simpleUpLeftCorner, space);
}
borderMaker(downBorder, doubleUpRightCorner, doubleUpLeftCorner, doubleHorizontal, (8*difficulty+2));
wprintf(L"%s\n", upBorder);
for (i = 0; i < 8; ++i)
{
wprintf(L"%s\n", upSquareBorder[i]);
wprintf(L"%s\n", sideSquareBorder[i]);
wprintf(L"%s\n", downSquareBorder[i]);
}
wprintf(L"%s\n", downBorder);
}
void borderMaker(char *border, char *leftCorner, char *rightCorner, char *line, int lineNumber)
{
int i;
strcat(border, leftCorner);
for (i = 0; i < lineNumber; ++i)
{
strcat(border, line);
}
strcat(border, rightCorner);
}
void upDownBorderSquareMaker(char *border, char *doubleVertical, char *simpleLeftCorner, char *simpleHorizontal, char *simpleRightCorner, char *space)
{
int i, j;
strcat(border, doubleVertical);
strcat(border, space);
for (int i = 0; i < 4; ++i)
{
borderMaker(border, simpleLeftCorner, simpleRightCorner, simpleHorizontal, 3);
strcat(border, space);
}
for (int i = 0; i < 9; ++i)
{
strcat(border, space);
}
strcat(border, doubleVertical);
}
void sideSquareMaker(char *border,char *doubleVertical,char *simpleVertical,char *space, char *underscore)
{
int i, j;
strcat(border, doubleVertical);
strcat(border, space);
for (i = 0; i < 4; ++i)
{
strcat(border, simpleVertical);
for (j = 0; j < 3; ++j)
{
strcat(border, space);
}
strcat(border, simpleVertical);
strcat(border, space);
}
for (int i = 0; i < 4; ++i)
{
strcat(border, space);
strcat(border, underscore);
}
strcat(border, space);
strcat(border, doubleVertical);
}
//gcc -std=c99 unicode_test -o test
//https://en.wikipedia.org/wiki/Box-drawing_character#Unicode