-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworking.c
More file actions
164 lines (164 loc) · 4.61 KB
/
working.c
File metadata and controls
164 lines (164 loc) · 4.61 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// #include <stdio.h>
// #include <stdlib.h>
// #include <stdbool.h>
// #include <math.h>
// #include <string.h>
// #include <windows.h>
// #define RED "\033[31m"
// #define GREEN "\033[32m"
// #define YELLOW "\033[33m"
// #define BLUE "\033[34m"
// #define MAGENTA "\033[35m"
// #define RESET "\033[0m"
// #define SIZE 24
// #define tw "\n\033[1B\033[1D"
// #define kw "\033[1B\033[1D"
// char arr[SIZE][SIZE]={0};
// bool state[SIZE+1][SIZE+1]={0};
// void init()
// {
// printf(GREEN
// " _________ _____ _____ _____ ____ ____ _________ \n"
// " | _ _ | |_ _||_ _| |_ _| |_ _||_ _| | _ _ | \n"
// " |_/ | | \\_| | | /\\ | | | | \\ \\ / / |_/ | | \\_| \n"
// " | | | |/ \\| | | | > `' < | | \n"
// " _| |_ | /\\ | _| |_ _/ /'`\\ \\_ _| |_ \n"
// " |_____| |__/ \\__| |_____| |____||____| |_____| \n"RESET
// );
// printf("\n");
// printf("Player \033[1;94mO\033[0m: Connect " RED "LEFT" RESET " to " BLUE "RIGHT" RESET "\n");
// printf("Player \033[1;94mX\033[0m: Connect " GREEN "TOP" RESET " to " MAGENTA "BOTTOM" RESET "\n");
// printf("\n\nPlayer \033[1;94mO\033[0m goes first\npress Enter to begin the game\n ");
// getchar();
// char(*ptr)[] = arr;
// memset(arr,'.',sizeof(arr));
// return;
// }
// void print(char* s)
// {
// for(int i=0;i<SIZE-1;i++)
// {
// printf("%c ",s[i]);
// }
// printf("%c",s[SIZE-1]);
// return;
// }
// void display()
// {
// system("cls");
// printf(" ");
// for(int i=0;i<SIZE;i++)printf("%d%s",i,i<10?" ":" ");
// printf("\n");
// for (int i = 0; i < SIZE; i++)
// {
// printf("%d%s",i,i<10?" ":" ");
// print(arr[i]);
// printf("\n\n");
// }
// return;
// }
// int pin(char z)
// {
// int x,y;
// printf("Player :%c, please enter row and comumn of your move in format:\"row column\"\n\033[2K",z);
// if(scanf(" %d %d",&x,&y)!=2)return -10;
// if((x<0||x>=SIZE) || (y<0||y>=SIZE))
// {
// printf("\0337");
// printf("\0338");
// printf("\033[3A");
// printf("out of bounds\n");
// return -2;
// }
// if(arr[x][y]=='.')
// {
// arr[x][y]=z;
// printf("\0337");
// printf("\033[r\033[H");
// printf("\033[%d;%dH", 2*x+2,4+y*4);
// printf("%c",z);
// fflush(stdout);
// printf("\0338");
// printf("\033[2A");
// return (x)*SIZE + (y);
// }
// else
// {
// printf("\033[2A");
// return -1;
// }
// }
// void block(int x,int y,int dx,int dy)
// {
// if(abs(dx)==1)state[x+(dx>0)][y+(dy>0)]=state[x+(dx>0)][y+(dy>0)+dy/2]=1;
// else if(abs(dx)==2)state[x+(dx>0)-(dx<0)][y+(dy>0)]=state[x+(dx>0)*dx][y+(dy>0)]=1;
// return;
// }
// bool check(int x,int y,int dx,int dy)
// {
// if(abs(dx)==1)
// {
// if(state[x+(dx>0)][y+(dy>0)] || state[x+(dx>0)][y+(dy>0)+dy/2])
// {
// return 0;
// }
// }
// else if(abs(dx)==2)
// {
// if(state[x+(dx>0)-(dx<0)][y+(dy>0)] || state[x+(dx>0)*dx][y+(dy>0)])
// {
// return 0;
// }
// }
// block(x, y, dx, dy);
// return true;
// }
// void viable(int x,int y)
// {
// char a[8][2]={{x+2,y+1},{x+1,y+2},{x+2,y-1},{x+1,y-2},{x-1,y-2},{x-2,y-1},{x-2,y+1},{x-1,y+2}};
// for(int i=0;i<8;i++)
// {
// char x1=a[i][0];
// char y1=a[i][1];
// int dx=x1-x,dy=y1-y;
// char z= dx*dy>0?'\\':'/';
// if(arr[x][y]!=arr[x1][y1])continue;
// if(!check(x,y,dx,dy))continue;
// if(fabs(dx)==1)
// {
// printf("\0337");
// printf("\033[%d;%dH", (x+x1)+2,1+(y+y1)*2);
// printf("%c-----%c",z,z);
// fflush(stdout);
// printf("\0338");
// }
// else
// {
// printf("\0337");
// printf("\033[%d;%dH", (x+x1),4+(y+y1)*2);
// printf("%c"kw"|"kw"|"kw"|"kw"%c",z,z);
// fflush(stdout);
// printf("\0338");
// }
// }
// return;
// }
// int main()
// {
// init();
// bool x=0;
// int i=10;
// display();
// while(i--)
// {
// int t=-1;
// while(t==-1)
// {
// t=pin(x?'X':'O');
// if(t==-10)return 0;
// }
// x=!x;
// viable(t/SIZE,t%SIZE);
// }
// return 0;
// }