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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
16 deletions
+63
-16
ta-te-ti.c
+63
-16
No files found.
ta-te-ti.c
View file @
cfcb06ef
#include <stdio.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#define CRUZ 'X'
#define CRUZ 'X'
...
@@ -159,45 +160,77 @@ char turnoVal(char t){
...
@@ -159,45 +160,77 @@ char turnoVal(char t){
int
fila
(
char
mat
[][
TRES
]){
int
fila
(
char
mat
[][
TRES
]){
int
contadorX
=
0
;
int
contadorO
=
0
;
int
bandera
=
0
;
int
bandera
=
0
;
for
(
int
fila
=
0
;
fila
<
TRES
;
fila
++
){
for
(
int
fila
=
0
;
fila
<
TRES
;
fila
++
){
for
(
int
columna
=
0
;
columna
<
TRES
-
1
;
columna
++
){
for
(
int
columna
=
0
;
columna
<
TRES
;
columna
++
){
if
(
mat
[
fila
][
columna
]
==
mat
[
fila
][
columna
+
1
]
)
{
if
(
mat
[
fila
][
columna
]
==
CRUZ
)
{
bandera
=
1
;
contadorX
++
;
}
else
{
contadorX
=
0
;
}
if
(
mat
[
fila
][
columna
]
==
CARA
)
{
contadorO
++
;
}
else
{
}
else
{
bandera
=
0
;
contadorO
=
0
;
}
}
}
}
}
if
((
contadorX
==
TRES
)
||
(
contadorO
==
TRES
)){
bandera
=
1
;
}
}
return
bandera
;
return
bandera
;
}
}
int
columna
(
char
mat
[][
TRES
]){
int
columna
(
char
mat
[][
TRES
]){
int
contadorX
=
0
;
int
contadorO
=
0
;
int
bandera
=
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
++
){
for
(
int
columna
=
0
;
columna
<
TRES
;
columna
++
){
if
(
mat
[
fila
][
columna
]
==
mat
[
fila
+
1
][
columna
]
)
{
if
(
mat
[
fila
][
columna
]
==
CRUZ
)
{
bandera
=
1
;
contadorX
++
;
}
else
{
contadorX
=
0
;
}
if
(
mat
[
fila
][
columna
]
==
CARA
)
{
contadorO
++
;
}
else
{
}
else
{
bandera
=
0
;
contadorO
=
0
;
}
}
}
}
}
}
if
((
contadorX
==
TRES
)
||
(
contadorO
==
TRES
)){
bandera
=
1
;
}
return
bandera
;
return
bandera
;
}
}
int
diagonalPrincipal
(
char
mat
[][
TRES
]){
int
diagonalPrincipal
(
char
mat
[][
TRES
]){
int
contadorX
=
0
;
int
contadorO
=
0
;
int
bandera
=
0
;
int
bandera
=
0
;
for
(
int
fila
=
0
;
fila
<
TRES
-
1
;
fila
++
){
if
(
mat
[
fila
][
fila
]
==
mat
[
fila
+
1
][
fila
+
1
]
)
{
for
(
int
fila
=
0
;
fila
<
TRES
;
fila
++
){
bandera
=
1
;
if
(
mat
[
fila
][
fila
]
==
CRUZ
)
{
contadorX
++
;
}
else
{
contadorX
=
0
;
}
if
(
mat
[
fila
][
fila
]
==
CARA
)
{
contadorO
++
;
}
else
{
}
else
{
bandera
=
0
;
contadorO
=
0
;
}
}
}
}
if
((
contadorX
==
TRES
)
||
(
contadorO
==
TRES
)){
bandera
=
1
;
}
return
bandera
;
return
bandera
;
}
}
...
@@ -205,16 +238,30 @@ int diagonalPrincipal(char mat[][TRES]){
...
@@ -205,16 +238,30 @@ int diagonalPrincipal(char mat[][TRES]){
int
diagonalSecundaria
(
char
mat
[][
TRES
]){
int
diagonalSecundaria
(
char
mat
[][
TRES
]){
int
bandera
=
0
;
int
bandera
=
0
;
int
contadorX
=
0
;
int
contadorO
=
0
;
int
contador
=
1
;
int
columna
=
TRES
-
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
)]
)
{
if
(
mat
[
fila
][
columna
-
fila
]
==
CRUZ
)
{
bandera
=
1
;
contadorX
++
;
}
else
{
}
else
{
bandera
=
0
;
contadorX
=
0
;
}
}
if
(
mat
[
fila
][
fila
]
==
CARA
)
{
contadorO
++
;
}
else
{
contadorO
=
0
;
}
}
if
((
contadorX
==
TRES
)
||
(
contadorO
==
TRES
)){
bandera
=
1
;
}
}
return
bandera
;
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