-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestingPointsComputer.c
133 lines (121 loc) · 4.25 KB
/
testingPointsComputer.c
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 <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <windows.h>
#include <time.h>
#include "playFunctions.h"
#include "saveFunctions.h"
#include "undoRedoFunctions.h"
#include "gettingNames.h"
#include "testingPoints.h"
void undoRedoSaveExitCheckComputer (play playMatrix[11][11], char player1[], char player2[], char player[], int *order, int *orderClear, int *orderCopy, int f, int t, int *flagTest, int *flag9, int x, int y, int z, int l, int *numberLines, int *lineCounter, int *undoFlag, int *undoFlag4, int *redoScoreFlag, int vs, int th, int tm, int ts, int *move1, int *move2, int *turn, int totalScore){
int flag=0;
int temp,saveFlag2=0,exitFlag1=0,exitFlag2=0,i=0,saveFlag=0;
char exitFlag[3];
char save[3];
if (x==69 && y==69 && z==69 && l==69){
if (*numberLines==*lineCounter){
*flagTest=0;
*flag9=0;
flag=1;
}
if (flag==0){
*orderCopy=*order;
undoFunctionComputer(playMatrix,f,t,&order,&move1,&move2,&turn,&numberLines,player1,player2);
*orderClear=(*orderCopy)-(*order)+1;
*flagTest=0;
*flag9=0;
}
}
else if (x==66 && y==66 && z==66 && l==66){
if (!undoFlag){
*flagTest=0;
*flag9=0;
flag=1;
}
if (flag==0){
if (undoFlag4==1){
*order=0;
}
*order++;
*redoScoreFlag=redoFunctionComputer(playMatrix,f,t,&order,&move1,&turn,&numberLines,player1);
*orderClear--;
if (redoScoreFlag==0){
*order++;
*redoScoreFlag=redoFunctionComputer(playMatrix,f,t,&order,&move2,&turn,&numberLines,player2);
*orderClear--;
while (redoScoreFlag==1){
*order++;
*redoScoreFlag=redoFunctionComputer(playMatrix,f,t,&order,&move2,&turn,&numberLines,player2);
*orderClear--;
*turn=1;
}
}
*flagTest=0;
*flag9=0;
}
}
else if (x==67 && y==67 && z==67 && l==67){
printf("Select the save file: \n\n");
printf("(1) Save 1\n");
printf("(2) Save 2\n");
printf("(3) Save 3\n");
while (saveFlag2==0){
i=0;
while ((saveFlag=getchar())!='\n'){
if (i<2){
save[i]=saveFlag;
i++;
}
}
save[i]='\0';
if (save[0]=='\0' || save[0]==' ' || save[0]=='\t' || (save[0]!='1' && save[0]!='2' && save[0]!='3') || save[1]!='\0'){
printf("Choose the Right File!!");
saveFlag2=0;
i=0;
}
else {
saveFlag=save[0]-48;
saveFlag2=1;
}
}
if (f==5){
saveFunctionComputer2(f,vs,playMatrix,player1,player2,player,th,tm,ts,move1,move2,numberLines,turn,totalScore,saveFlag,order,orderClear,undoFlag);
}
else if (f==11){
saveFunctionComputer1(f,vs,playMatrix,player1,player2,player,th,tm,ts,move1,move2,numberLines,turn,totalScore,saveFlag,order,orderClear,undoFlag);
}
*flagTest=0;
*flag9=0;
}
else if (x==53 && y==53 && z==53 && l==53){
printf("Are You Sure ? (Y or N) ");
while (exitFlag2==0){
i=0;
exitFlag2=1;
while ((exitFlag1=getchar())!='\n'){
if (i<2){
exitFlag[i]=exitFlag1;
i++;
}
}
exitFlag[i]='\0';
if (exitFlag[0]=='\0' || exitFlag[0]==' ' || exitFlag[0]=='\t' || (exitFlag[0]!='n' && exitFlag[0]!='N' && exitFlag[0]!='y' && exitFlag[0]!='Y') || exitFlag[1]!='\0'){
printf("Choose (Y or N)!!");
exitFlag2=0;
i=0;
}
else {
exitFlag2=1;
if (exitFlag[0]=='Y' || exitFlag[0]=='y'){
*flag9=2;
}
else if (exitFlag[0]=='N' || exitFlag[0]=='n'){
*flagTest=1;
break;
}
}
}
}
}