Skip to content

Commit 37f878e

Browse files
committed
Verificação Horizontal de Vitória feito, Vertical está em progresso ainda
1 parent da907c7 commit 37f878e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Lig 4/Lig 4.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,42 @@ extern void restoreConsole(void);
1111

1212
Win winVerifyer(int grid[6][7])
1313
{
14+
Win returnValue;
15+
for (int i = 0; i < 6; i++)
16+
{
17+
for (int j = 0; j < 3; j++)
18+
{
19+
if (grid[i][j] == 1 && grid[i][j + 1] == 1 && grid[i][j + 2] == 1 && grid[i][j + 3] == 1)
20+
{
21+
returnValue.win = true;
22+
returnValue.victoryType = 'H';
23+
returnValue.row = i;
24+
returnValue.row = j;
25+
}
26+
27+
if (grid[i][j] == -1 && grid[i][j + 1] == -1 && grid[i][j + 2] == -1 && grid[i][j + 3] == -1)
28+
{
29+
returnValue.win = true;
30+
returnValue.victoryType = 'H';
31+
returnValue.row = i;
32+
returnValue.row = j;
33+
}
34+
}
1435

36+
for (int j = 0; j < 7; j++)
37+
{
38+
for (int i = 0; i < 2; i++)
39+
{
40+
if (grid[i][j] == 1 && grid[i + 1][j] == 1 && grid[i + 2][j] == 1 && grid[i + 3][j] == 1)
41+
{
42+
returnValue.win = true;
43+
returnValue.victoryType = 'V';
44+
returnValue.row = i;
45+
returnValue.row = j;
46+
}
47+
}
48+
}
49+
}
1550
}
1651

1752
void supergridGenerator(char supergrid[37][98])

0 commit comments

Comments
 (0)