-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdanh.cpp
69 lines (66 loc) · 1.2 KB
/
danh.cpp
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
#include "danh.h"
#include "dichuyen.h"
#include "dangnhap.h"
#include "console.h"
#include "banco.h"
#include "dieukien.h"
int danh(char a[100][100], int &k, int i, int j, int n)
{
int ff;
if (k % 2 == 0)
{
if (a[i][j] != 'O' && a[i][j] != 'X')
{
a[i][j] = 'X';
TextColor(11);
printf("%c", a[i][j]);
k++;
}
}
else if (k % 2 != 0)
{
if (a[i][j] != 'O' && a[i][j] != 'X')
{
a[i][j] = 'O';
TextColor(13);
printf("%c", a[i][j]);
k++;
}
}
//Thuc thi dieu kien thang
TextColor(12);
if ((DK_O_ChienThang(a, i, j) == 1))
{
gotoXY(4 * n + 25, 15);
TextColor(11);
printf("O chien thang\n");
return 1;
}
else
if ((DK_X_ChienThang(a, i, j) == 1))
{
gotoXY(4 * n + 25, 15);
TextColor(12);
printf("X Chien Thang\n");
return 1;
}
else if (k == n*n)
{
TextColor(12);
gotoXY(4 * n + 30, 15);
printf("Hoa");
return 1;
}
TextColor(7);
return 0;
}
void inluot(int k, char p1[20], char p2[20], int n)
{
gotoXY(4 * n + 5, 5);
TextColor(10);
if (k % 2 == 0)
printf("Luot di cua: %s", p1);
else
printf("Luot di cua: %s", p2);
printf("\t\t\t\t\tLuot thu: %d", k);
}