Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wu-e001
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Silvia Barrientos
wu-e001
Commits
cfcb06ef
Commit
cfcb06ef
authored
Sep 02, 2020
by
Silvia Barrientos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ta-te-ti.c
parent
89190682
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
20 deletions
+67
-20
ta-te-ti.c
+67
-20
No files found.
ta-te-ti.c
View file @
cfcb06ef
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#define CRUZ 'X'
...
...
@@ -159,44 +160,76 @@ char turnoVal(char t){
int
fila
(
char
mat
[][
TRES
]){
int
contadorX
=
0
;
int
contadorO
=
0
;
int
bandera
=
0
;
for
(
int
fila
=
0
;
fila
<
TRES
;
fila
++
){
for
(
int
columna
=
0
;
columna
<
TRES
-
1
;
columna
++
){
if
(
mat
[
fila
][
columna
]
==
mat
[
fila
][
columna
+
1
]
)
{
bandera
=
1
;
for
(
int
columna
=
0
;
columna
<
TRES
;
columna
++
){
if
(
mat
[
fila
][
columna
]
==
CRUZ
)
{
contadorX
++
;
}
else
{
contadorX
=
0
;
}
if
(
mat
[
fila
][
columna
]
==
CARA
)
{
contadorO
++
;
}
else
{
bandera
=
0
;
contadorO
=
0
;
}
}
}
if
((
contadorX
==
TRES
)
||
(
contadorO
==
TRES
)){
bandera
=
1
;
}
return
bandera
;
}
int
columna
(
char
mat
[][
TRES
]){
int
contadorX
=
0
;
int
contadorO
=
0
;
int
bandera
=
0
;
for
(
int
fila
=
0
;
fila
<
TRES
-
1
;
fila
++
){
for
(
int
fila
=
0
;
fila
<
TRES
;
fila
++
){
for
(
int
columna
=
0
;
columna
<
TRES
;
columna
++
){
if
(
mat
[
fila
][
columna
]
==
mat
[
fila
+
1
][
columna
]
)
{
bandera
=
1
;
if
(
mat
[
fila
][
columna
]
==
CRUZ
)
{
contadorX
++
;
}
else
{
bandera
=
0
;
contadorX
=
0
;
}
if
(
mat
[
fila
][
columna
]
==
CARA
)
{
contadorO
++
;
}
else
{
contadorO
=
0
;
}
}
}
if
((
contadorX
==
TRES
)
||
(
contadorO
==
TRES
)){
bandera
=
1
;
}
return
bandera
;
}
int
diagonalPrincipal
(
char
mat
[][
TRES
]){
int
contadorX
=
0
;
int
contadorO
=
0
;
int
bandera
=
0
;
for
(
int
fila
=
0
;
fila
<
TRES
-
1
;
fila
++
){
if
(
mat
[
fila
][
fila
]
==
mat
[
fila
+
1
][
fila
+
1
]
)
{
bandera
=
1
;
}
else
{
bandera
=
0
;
}
for
(
int
fila
=
0
;
fila
<
TRES
;
fila
++
){
if
(
mat
[
fila
][
fila
]
==
CRUZ
)
{
contadorX
++
;
}
else
{
contadorX
=
0
;
}
if
(
mat
[
fila
][
fila
]
==
CARA
)
{
contadorO
++
;
}
else
{
contadorO
=
0
;
}
}
if
((
contadorX
==
TRES
)
||
(
contadorO
==
TRES
)){
bandera
=
1
;
}
return
bandera
;
}
...
...
@@ -205,16 +238,30 @@ int diagonalPrincipal(char mat[][TRES]){
int
diagonalSecundaria
(
char
mat
[][
TRES
]){
int
bandera
=
0
;
int
contadorX
=
0
;
int
contadorO
=
0
;
int
contador
=
1
;
int
columna
=
TRES
-
1
;
for
(
int
fila
=
0
;
fila
<
TRES
-
1
;
fila
++
){
for
(
int
fila
=
0
;
fila
<
TRES
;
fila
++
){
if
(
mat
[
fila
][
columna
-
fila
]
==
mat
[
fila
+
1
][
columna
-
(
fila
+
1
)]
)
{
bandera
=
1
;
}
else
{
bandera
=
0
;
}
if
(
mat
[
fila
][
columna
-
fila
]
==
CRUZ
)
{
contadorX
++
;
}
else
{
contadorX
=
0
;
}
if
(
mat
[
fila
][
fila
]
==
CARA
)
{
contadorO
++
;
}
else
{
contadorO
=
0
;
}
}
if
((
contadorX
==
TRES
)
||
(
contadorO
==
TRES
)){
bandera
=
1
;
}
return
bandera
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment