目前C语言小白,刚接触C语言半年,最近借着学校课程设计的机会写了一个小游戏,打算分享出来。
PS:由于本人代码水平很差,所以600行代码中有很多重复代码,程序的结构也不是太合理,如果有哪位大神感兴趣给我的代码提供修改意见,我不胜感激!!!
/*
规则:
1.一共56张牌,有四种水果牌(香蕉、草莓、樱桃、柠檬)。每张牌上有1 - 5个同类水果。
2.其中,一个水果5张牌,两个和三个水果各3张牌,四个水果2张牌,五个水果1张牌,共14张牌。
3.四个玩家A、B、C、D,56张牌平均分给四个玩家,背面朝上置于玩家面前。
4.出牌阶段,按照A、B、C、D的顺序依次从自己牌堆中抽出一张牌置于牌堆前摊开。
5.若牌面上显示的某一种水果数目加起来等于5或者5的整数倍则按响铃铛,第一个按铃铛的有效。
6.如果玩家判断正确则将其选中的牌收入自己的牌堆并且重新洗牌。
7如果玩家判断错误则需要给场上的每位玩家(出局玩家不算)一张牌。
8.之后进入下一轮发牌。如果没人按响铃铛也进入下一轮。下一轮打出的牌与上一轮平行放置。
9.若某玩家面前牌堆以及摊开的牌堆均没有牌则该玩家出局。剩下两名玩家时,牌数多的胜利。
按键:
0——出牌
q——a玩家按铃铛
p——b玩家按铃铛
z——c玩家按铃铛
m——d玩家按铃铛
备注:
1.输入姓名长度:汉字请尽量不要超过3,英文请尽量不要超过7。
2.在没人按铃铛的出牌局需要一名玩家按下0进入下一轮出牌。
3.当非D玩家出局之后,D玩家调皮地占据出局玩家的位置,之后的局数D玩家按该出局玩家的按键
(事实上,程序中有出局后置换玩家数据的命令,这样代码写起来较为容易,考虑到不怎么影响游戏性,我没有处理这个问题)。
*/
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
#include<string.h>
#include<Windows.h>
void setcolor(short); //自定义函根据参数改变颜色
void init(char**, char**); //初始化函数
void shuffle(char**, char**, int); //洗牌
void del(char**, char**, int); //删除一张指定的牌
int count(char**); //统计某位玩家剩余牌数
int judge(void); //判断玩家按铃是否正确
void attach(int *, int); //judge和reward的附属函数,用于统计明牌区某种水果牌总数
void reward(char**, char**); //玩家按铃正确,奖励牌
void give(char**, char**, int); //reward附属函数,用于将明牌区某种水果牌交给一位玩家
void attach_g(char**, char**, char**, char**, int); //give附属函数,简化代码
void punish(int, int); //玩家按铃错误,惩罚牌
void give_p(char**, char**, char**, char**); //punish附属函数,用于将待罚玩家的牌交给其他玩家
void give_t(char**, char**, char**, char**); //punish附属函数,明牌区存储空间最后一组数据在窗口未输出前就有数据,处理该情况
int situation(void); //一位玩家手牌数目为0时,某些循环不能以“color_show_a[i] != NULL”为判断条件,处理该情况
void print(char**, int); //输出函数
char colors[][5] = { "香蕉","草莓","樱桃","柠檬" };
char numbers[][2] = { "1","1","1","1","1","2","2","2","3","3","3","4","4","5" };
char *color_a[56], *color_b[56], *color_c[56], *color_d[56];
char *number_a[56], *number_b[56], *number_c[56], *number_d[56];
char *color_show_a[56], *color_show_b[56], *color_show_c[56], *color_show_d[56];
char *number_show_a[56], *number_show_b[56], *number_show_c[56], *number_show_d[56];
char name1[11], name2[11], name3[11], name4[11];
int i, j, k; //循环控制变量
int playernumbers = 4; //存储玩家个数
int cnt1; //用于各种判断
int cnt = 0; // 指示明牌区存储数组下标
int main()
{
//提示语句
printf("更改字体为楷体,字号为22号,效果更佳!\n\n");
char *direction0[16] = { "X","X","X","完","成","于","2","0","1","8","年","6","月","2","6","日" };
char *direction1[5] = { "游","戏","开","始","!" };
char *direction2[8] = { "判","断","正","确","!","已","奖","励" };
char *direction3[5] = { "判","断","错","误","!" };
char *direction4[10] = { "您","手","上","的","牌","不","足","以","惩","罚" };
char *direction5[3] = { "已","惩","罚" };
char *direction6[14] = { "一","轮","出","牌","结","束",",","开","使","下","一","轮","出","牌" };
char *direction7[5] = { "游","戏","结","束","!" };
char *direction8[14] = { "所","有","人","的","牌","出","完","了",",","无","人","胜","利","。" };
system("color 70");
//嘻嘻嘻
Sleep(1000);
setcolor(1); print(direction0, 16); printf("\n\n\n");
Sleep(3000);
//输入玩家姓名
setcolor(4);
printf("请输入A玩家的名字:");
scanf("%s", name1);
printf("请输入B玩家的名字:");
scanf("%s", name2);
printf("请输入C玩家的名字:");
scanf("%s", name3);
printf("请输入D玩家的名字:");
scanf("%s", name4);
printf("\n"); print(direction1, 5); printf("\n\n");
setcolor(16);
Sleep(500);
int remove;
while ((remove = getchar()) != '\n' && remove != EOF); //清楚缓冲区中的字符
char *color[56];
char *number[56];
int i, j;
srand((unsigned int)time(0));
//初始化扑克牌
for (i = 0; i<4; i++)
{
for (j = 0; j<14; j++)
{
color[i * 14 + j] = colors[i];
number[i * 14 + j] = numbers[j];
}
}
int card_number = 56;
//洗牌
shuffle(number, color, card_number);
//初始化牌堆存储空间
init(color_a, number_a);
init(color_b, number_b);
init(color_c, number_c);
init(color_d, number_d);
init(color_show_a, number_show_a);
init(color_show_b, number_show_b);
init(color_show_c, number_show_c);
init(color_show_d, number_show_d);
//1-14张牌发给A玩家,15-28张牌发给B玩家,以此类推
for (i = 0; i<14; i++)
{
color_a[i] = color[i];
number_a[i] = number[i];
color_b[i] = color[14 + i];
number_b[i] = number[14 + i];
color_c[i] = color[28 + i];
number_c[i] = number[28 + i];
color_d[i] = color[42 + i];
number_d[i] = number[42 + i];
}
int f1 = 0, f2 = 0; //判断是否输出出局的提示语句
int cardnum_a, cardnum_b, cardnum_c, cardnum_d;
for (k = 0; k<100; k++)
{
cnt1 = k % playernumbers;
//明牌区存储玩家本轮将要打出的牌
if (cnt1 == 0)
{
color_show_a[cnt] = color_a[0];
number_show_a[cnt] = number_a[0];
del(color_a, number_a, 0);
color_show_b[cnt] = color_b[0];
number_show_b[cnt] = number_b[0];
del(color_b, number_b, 0);
color_show_c[cnt] = color_c[0];
number_show_c[cnt] = number_c[0];
del(color_c, number_c, 0);
color_show_d[cnt] = color_d[0];
number_show_d[cnt] = number_d[0];
del(color_d, number_d, 0);
cnt++;
}
destination1:
//出牌提示,“if (color_show_a[cnt - 1] != NULL)”处理玩家手上没牌可出的情况,下面出现该代码都是同样作用
switch (cnt1)
{
case 0:printf("请%s输入0出牌:", name1); break;
case 1:printf("请%s输入0出牌:", name2); break;
case 2:printf("请%s输入0出牌:", name3); break;
case 3:printf("请%s输入0出牌:", name4); break;
}
//出牌
char judge_out, judge_take;
scanf("%c", &judge_out);
while ((remove = getchar()) != '\n' && remove != EOF); //清楚缓冲区中其他玩家输入的字符
Sleep(1000);
//判断是否输出无牌可出提示语句
setcolor(4);
if (color_show_a[cnt - 1] == NULL)
if (cnt1 == 0) { printf("\n嘿嘿!您手上没牌了哦。\n\n"); Sleep(1000); }
if (color_show_b[cnt - 1] == NULL)
if (cnt1 == 1) { printf("\n嘿嘿!您手上没牌了哦。\n\n"); Sleep(1000); }
if (color_show_c[cnt - 1] == NULL)
if (cnt1 == 2) { printf("\n嘿嘿!您手上没牌了哦。\n\n"); Sleep(1000); }
if (color_show_d[cnt - 1] == NULL)
if (cnt1 == 3) { printf("\n嘿嘿!您手上没牌了哦。\n\n"); Sleep(1000); }
setcolor(16);
if (judge_out == '0')
{
printf("%s\t\t%s\t\t%s\t\t", name1, name2, name3);
if (playernumbers == 4) printf("%s\t\t", name4);
printf("\n\n");
//显示明牌区中玩家本轮之前打出的牌
int temp; //临时变量,用于控制输出循环次数
temp = cnt - 1;
for (i = 0; i < temp; i++)
{
if (color_show_a[i] != NULL) printf("%s%s\t\t", color_show_a[i], number_show_a[i]);
else printf("\t\t");
if (color_show_b[i] != NULL) printf("%s%s\t\t", color_show_b[i], number_show_b[i]);
else printf("\t\t");
if (color_show_c[i] != NULL) printf("%s%s\t\t", color_show_c[i], number_show_c[i]);
else printf("\t\t");
if (playernumbers == 4) //处理一名玩家淘汰的情况
{
if (color_show_d[i] != NULL) printf("%s%s\t\t", color_show_d[i], number_show_d[i]);
else printf("\t\t");
}
printf("\n\n");
}
//显示玩家本轮打出的牌
if (cnt1 >= 0)
{
if (color_show_a[cnt - 1] != NULL)
printf("%s%s\t\t", color_show_a[cnt - 1], number_show_a[cnt - 1]);
else printf("\t\t");
}
if (cnt1 >= 1)
{
if (color_show_b[cnt - 1] != NULL)
printf("%s%s\t\t", color_show_b[cnt - 1], number_show_b[cnt - 1]);
else printf("\t\t");
}
if (cnt1 >= 2)
{
if (color_show_c[cnt - 1] != NULL)
printf("%s%s\t\t", color_show_c[cnt - 1], number_show_c[cnt - 1]);
else printf("\t\t");
}
if (cnt1 >= 3)
{
if (color_show_d[cnt - 1] != NULL)
printf("%s%s\t\t", color_show_d[cnt - 1], number_show_d[cnt - 1]);
else printf("\t\t");
}
}
else
{
setcolor(4);
printf("\n\n\n\n请输入正确的按键!\n\n");
setcolor(16);
goto destination1;
}
printf("\n\n");
destination2:
setcolor(4); printf("\n\n请按铃:"); setcolor(16);
scanf("%c", &judge_take); //按铃铛
while ((remove = getchar()) != '\n' && remove != EOF); //清楚缓冲区中其他玩家输入的字符
int flag1 = 0, flag2 = 0; //判断是否输出奖励或惩罚的提示语句
switch (judge_take)
{
case'0': break;
case'q':
if (judge())
{
reward(color_a, number_a);
shuffle(color_a, number_a, count(color_a));
flag1++;
}
else { punish(0, playernumbers); flag2++; } break;
case'p':
if (judge())
{
reward(color_b, number_b);
shuffle(color_b, number_b, count(color_b));
flag1++;
}
else { punish(1, playernumbers); flag2++; } break;
case'z':
if (judge())
{
reward(color_c, number_c);
shuffle(color_c, number_c, count(color_c));
flag1++;
}
else { punish(2, playernumbers); flag2++; } break;
case'm':
if (judge())
{
reward(color_d, number_d);
shuffle(color_d, number_d, count(color_d));
flag1++;
}
else { punish(3, playernumbers); flag2++; } break;
default:
setcolor(4); printf("\n\n\n\n请输入正确的按键!"); setcolor(16);
goto destination2; break;
}
//清除窗口中全部为空的一行(当明牌区的牌成为奖励时,该牌所在位置显示为空)
for (i = 0; i < situation(); i++)
{
int temp1 = color_show_a[i] == " ";
int temp2 = color_show_b[i] == " ";
int temp3 = color_show_c[i] == " ";
int temp4 = color_show_d[i] == " ";
if (playernumbers != 4) temp4 = 1;
//处理某些玩家手牌为0的情况
if (color_show_a[i] == NULL) temp1 = 1;
if (color_show_b[i] == NULL) temp2 = 1;
if (color_show_c[i] == NULL) temp3 = 1;
if (color_show_d[i] == NULL) temp4 = 1;
if (temp1&&temp2&&temp3&&temp4)
{
del(color_show_a, number_show_a, i);
del(color_show_b, number_show_b, i);
del(color_show_c, number_show_c, i);
if (playernumbers == 4)
del(color_show_d, number_show_d, i);
cnt--;
i--;
}
}
setcolor(4);
if (flag1)
{
printf("\n\n\n"); print(direction2, 8); printf("\n");
}
if (flag2)
{
printf("\n\n\n");
print(direction3, 5);
if (color_a[0] == NULL && judge_take == 'q')
print(direction4, 10);
else if (color_b[0] == NULL && judge_take == 'p')
print(direction4, 10);
else if (color_c[0] == NULL && judge_take == 'z')
print(direction4, 10);
else if (color_d[0] == NULL && judge_take == 'm')
print(direction4, 10);
else print(direction5, 3);
printf("\n");
}
//统计剩余牌数
cardnum_a = count(color_a) + count(color_show_a);
cardnum_b = count(color_b) + count(color_show_b);
cardnum_c = count(color_c) + count(color_show_c);
cardnum_d = count(color_d) + count(color_show_d);
if (cnt1 == playernumbers - 1)
{
printf("\n");
if (cardnum_a) printf("%s剩余的牌数:%d ", name1, cardnum_a);
if (cardnum_b) printf("%s剩余的牌数:%d ", name2, cardnum_b);
if (cardnum_c) printf("%s剩余的牌数:%d ", name3, cardnum_c);
if (cardnum_d) printf("%s剩余的牌数:%d", name4, cardnum_d);
Sleep(1000);
printf("\n\n");
print(direction6, 14);
}
//判断是否出局
if (cardnum_a == 0 && f1 == 0) { printf("\n%s出局!", name1); f1 = 1; }
if (cardnum_b == 0 && f1 == 0) { printf("\n%s出局!", name2); f1 = 1; }
if (cardnum_c == 0 && f1 == 0) { printf("\n%s出局!", name3); f1 = 1; }
if (cardnum_d == 0 && f1 == 0) { printf("\n%s出局!", name4); f1 = 1; }
if (cardnum_a == 0 && f1 == 0 && f2 == 0) { printf("\n%s出局!", name1); f2 = 1; }
if (cardnum_b == 0 && f1 == 0 && f2 == 0) { printf("\n%s出局!", name2); f2 = 1; }
if (cardnum_c == 0 && f1 == 0 && f2 == 0) { printf("\n%s出局!", name3); f2 = 1; }
//当非D玩家出局时,该玩家数据与D玩家交换
if (cardnum_a == 0 && playernumbers >= 3 && cnt1 == playernumbers - 1)
{
playernumbers--;
Sleep(1000);
for (i = 0; i<56 && playernumbers == 3; i++)
{
color_a[i] = color_d[i]; number_a[i] = number_d[i];
color_show_a[i] = color_show_d[i]; number_show_a[i] = number_show_d[i];
}
for (i = 0; i < 11; i++) name1[i] = name4[i];
k = (k / playernumbers + 1)*(playernumbers - 1);
}
if (cardnum_b == 0 && playernumbers >= 3 && cnt1 == playernumbers - 1)
{
playernumbers--;
Sleep(1000);
for (i = 0; i<56 && playernumbers == 3; i++)
{
color_b[i] = color_d[i]; number_b[i] = number_d[i];
color_show_b[i] = color_show_d[i]; number_show_b[i] = number_show_d[i];
}
for (i = 0; i < 11; i++) name2[i] = name4[i];
k = (k / playernumbers + 1)*(playernumbers - 1);
}
if (cardnum_c == 0 && playernumbers >= 3 && cnt1 == playernumbers - 1)
{
playernumbers--;
Sleep(1000);
for (i = 0; i<56 && playernumbers == 3; i++)
{
color_c[i] = color_d[i]; number_c[i] = number_d[i];
color_show_c[i] = color_show_d[i]; number_show_c[i] = number_show_d[i];
}
for (i = 0; i < 11; i++) name3[i] = name4[i];
k = (k / playernumbers + 1)*(playernumbers - 1);
}
if (cardnum_d == 0 && playernumbers == 4)
{
playernumbers--;
Sleep(1000);
k = (k / playernumbers + 1)*(playernumbers - 1);
}
//初始化D玩家数据存储空间
if (playernumbers == 3)
for (i = 0; i<56; i++)
{
init(color_d, number_d);
init(color_show_d, number_show_d);
}
printf("\n\n");
Sleep(1000);
//判断是否胜利
if (playernumbers == 2)
{
print(direction7, 5); printf("\n\n");
if (cardnum_a >= cardnum_b && cardnum_a >= cardnum_c) printf("%s胜利!\n", name1);
if (cardnum_b >= cardnum_a && cardnum_b >= cardnum_c) printf("%s胜利!\n", name2);
if (cardnum_c >= cardnum_a && cardnum_c >= cardnum_b) printf("%s胜利!\n", name3);
break;
}
if (color_a[0] == NULL && color_b[0] == NULL && color_c[0] == NULL && color_d[0] == NULL && cnt1 == playernumbers - 1)
{
print(direction7, 5); printf("\n\n");
print(direction8, 14); printf("\n");
break;
}
setcolor(16);
}
system("pause");
return 0;
}
void setcolor(short x)
{
if (x >= 0 && x <= 15)//参数在0-15的范围颜色
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x | (16 | 32 | 64) | 8); //只有一个参数,改变字体颜色
else//默认的颜色白色
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0 | (16 | 32 | 64));
}
int count(char**a)
{
int n = 0;
for (i = 0; i < 56; i++) if (a[i] != " "&&a[i] != NULL) n++;
return n;
}
int situation(void)
{
int n1, n2, n3, n4;
for (i = 55; number_show_a[i] == NULL; i--); n1 = i + 1;
for (i = 55; number_show_b[i] == NULL; i--); n2 = i + 1;
for (i = 55; number_show_c[i] == NULL; i--); n3 = i + 1;
for (i = 55; number_show_d[i] == NULL; i--); n4 = i + 1;
if (n1 < n2) n1 = n2; if (n3 < n4) n3 = n4; if (n1 < n3) n1 = n3;
return n1;
}
void init(char**color, char**number)
{
for (i = 0; i<56; i++)
{
color[i] = NULL;
number[i] = NULL;
}
}
void shuffle(char**color, char**number, int card_number)
{
for (i = 0; i<card_number; i++)
{
int index = rand() % (card_number - i) + i;
char *temp_color;
char *temp_number;
temp_color = color[i];
temp_number = number[i];
color[i] = color[index];
number[i] = number[index];
color[index] = temp_color;
number[index] = temp_number;
}
}
void del(char**a, char**b, int n)
{
for (j = n; j < 55; j++)
{
a[j] = a[j + 1];
b[j] = b[j + 1];
}
}
int judge(void)
{
int a, b, c, d;
int *cnt = (int *)malloc(4);
attach(cnt, 0); a = *cnt;
attach(cnt, 1); b = *cnt;
attach(cnt, 2); c = *cnt;
attach(cnt, 3); d = *cnt;
printf("香蕉 %d 个\t草莓 %d 个\t樱桃 %d 个\t柠檬 %d 个", a, b, c, d);
if ((a % 5 == 0 && a != 0) || (b % 5 == 0 && b != 0) || (c % 5 == 0 && c != 0) || (d % 5 == 0 && d != 0)) return 1;
else return 0;
}
void attach(int *p, int n) //n代表颜色种类
{
int anum[56] = { 0 }, bnum[56] = { 0 }, cnum[56] = { 0 }, dnum[56] = { 0 };
*p = 0;
//将存储数字的字符数组转化为对应整型的数字
int t = situation();
for (i = 0; i < t; i++)
{
if (number_show_a[i] != " "&&number_show_a[i] != NULL) anum[i] = *number_show_a[i] - '0';
if (number_show_b[i] != " "&&number_show_b[i] != NULL) bnum[i] = *number_show_b[i] - '0';
if (number_show_c[i] != " "&&number_show_c[i] != NULL) cnum[i] = *number_show_c[i] - '0';
if (number_show_d[i] != " "&&number_show_d[i] != NULL) dnum[i] = *number_show_d[i] - '0';
}
//遍历,统计相同颜色牌水果数目
for (i = 0; i < t - 1; i++)
{
if (color_show_a[i] == colors[n]) *p += anum[i];
if (color_show_b[i] == colors[n]) *p += bnum[i];
if (color_show_c[i] == colors[n]) *p += cnum[i];
if (color_show_d[i] == colors[n]) *p += dnum[i];
}
//明牌区存储空间最后一组数据在窗口未输出前就有数据,处理该情况
switch (cnt1)
{
case 3:if (color_show_d[i] == colors[n]) *p += dnum[i];
case 2:if (color_show_c[i] == colors[n]) *p += cnum[i];
case 1:if (color_show_b[i] == colors[n]) *p += bnum[i];
case 0:if (color_show_a[i] == colors[n]) *p += anum[i]; break;
}
}
void reward(char **a, char **b)
{
int *cnt = (int *)malloc(4);
attach(cnt, 0);
if (*cnt % 5 == 0 && *cnt != 0) give(a, b, 0);
attach(cnt, 1);
if (*cnt % 5 == 0 && *cnt != 0) give(a, b, 1);
attach(cnt, 2);
if (*cnt % 5 == 0 && *cnt != 0) give(a, b, 2);
attach(cnt, 3);
if (*cnt % 5 == 0 && *cnt != 0) give(a, b, 3);
}
void give(char **a, char **b, int n) //n代表颜色种类
{
//遍历,将符合条件的相同水果牌交给判断正确的玩家
int t = situation();
for (i = 0; i < t - 1; i++)
{
attach_g(a, b, color_show_a, number_show_a, n);
attach_g(a, b, color_show_b, number_show_b, n);
attach_g(a, b, color_show_c, number_show_c, n);
attach_g(a, b, color_show_d, number_show_d, n);
}
//明牌区存储空间最后一组数据在窗口未输出前就有数据,处理该情况
switch (cnt1)
{
case 3:attach_g(a, b, color_show_d, number_show_d, n);
case 2:attach_g(a, b, color_show_c, number_show_c, n);
case 1:attach_g(a, b, color_show_b, number_show_b, n);
case 0:attach_g(a, b, color_show_a, number_show_a, n); break;
}
}
void attach_g(char**a, char**b, char**aa, char**bb, int n)
{
if (aa[i] == colors[n])
{
for (j = 0; a[j] != NULL; j++);
a[j] = aa[i]; aa[i] = " ";
b[j] = bb[i]; bb[i] = " ";
}
}
void punish(int m, int playernumbers)
{
int n = playernumbers;
switch (m)
{
case 0:
give_p(color_a, number_a, color_b, number_b);
give_p(color_a, number_a, color_c, number_c);
if (n == 4) give_p(color_a, number_a, color_d, number_d);
break;
case 1:
for (i = 0; color_b[i] != NULL; i++);
if (i < playernumbers - 1 && cnt1 < 1)
give_t(color_show_b, number_show_b, color_c, number_c);
give_p(color_b, number_b, color_c, number_c);
if (n == 4) give_p(color_b, number_b, color_d, number_d);
give_p(color_b, number_b, color_a, number_a);
break;
case 2:
for (i = 0; color_c[i] != NULL; i++);
if (i < playernumbers - 1 && cnt1 < 2)
if (n == 4) give_t(color_show_c, number_show_c, color_d, number_d);
if (n == 4) give_p(color_c, number_c, color_d, number_d);
give_p(color_c, number_c, color_a, number_a);
give_p(color_c, number_c, color_b, number_b);
break;
case 3:
for (i = 0; color_d[i] != NULL; i++);
if (i < playernumbers - 1 && cnt1 < 3)
give_t(color_show_d, number_show_d, color_b, number_b);
give_p(color_d, number_d, color_a, number_a);
give_p(color_d, number_d, color_b, number_b);
give_p(color_d, number_d, color_c, number_c);
break;
}
}
void give_p(char**a, char**b, char**c, char**d)
{
for (i = 0; c[i] != NULL; i++);
c[i] = a[0]; d[i] = b[0];
del(a, b, 0);
}
void give_t(char**a, char**b, char**c, char**d)
{
for (i = 0; c[i] != NULL; i++);
c[i] = a[cnt - 1]; d[i] = b[cnt - 1];
del(a, b, cnt - 1);
}
void print(char** direction, int n)
{
for (i = 0; i < n; i++)
{
printf("%s", direction[i]);
Sleep(240);
}
}