Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
js-e004
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
Fernando David Lopez
js-e004
Commits
dfee21de
You need to sign in or sign up before continuing.
Commit
dfee21de
authored
Oct 23, 2018
by
roshka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tateti en js
parents
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
212 additions
and
0 deletions
+212
-0
#README.md#
+2
-0
README.md
+0
-0
TatetiJS/tateti.html
+52
-0
TatetiJS/tateti.js
+158
-0
No files found.
#README.md#
0 → 100644
View file @
dfee21de
Para jugar es obligatorio ingresar nombres para los jugadores, asi se evita problemas. despues de eso se puede jugar sin problema.
\ No newline at end of file
README.md
0 → 100644
View file @
dfee21de
TatetiJS/tateti.html
0 → 100644
View file @
dfee21de
<!DOCTYPE html>
<html>
<head>
</head>
<body
onload=
"cargarJugadores()"
>
<center>
<h1
WIDTH=
30%
HEIGHT=
40
>
TaTeTi
</h1>
<table
border=
"0"
>
<tr>
<td
style=
"border-style:solid"
width=
"96"
Height=
"128"
id=
"c0"
onclick=
"box(0)"
></td>
<td
style=
"border-style:solid"
width=
"96"
Height=
"128"
id=
"c1"
onclick=
"box(1)"
></td>
<td
style=
"border-style:solid"
width=
"96"
Height=
"128"
id=
"c2"
onclick=
"box(2)"
></td>
</tr>
<tr>
<td
style=
"border-style:solid"
width=
"96"
Height=
"128"
id=
"c3"
onclick=
"box(3)"
></td>
<td
style=
"border-style:solid"
width=
"96"
Height=
"128"
id=
"c4"
onclick=
"box(4)"
></td>
<td
style=
"border-style:solid"
width=
"96"
Height=
"128"
id=
"c5"
onclick=
"box(5)"
></td>
</tr>
<tr>
<td
style=
"border-style:solid"
width=
"96"
Height=
"128"
id=
"c6"
onclick=
"box(6)"
></td>
<td
style=
"border-style:solid"
width=
"96"
Height=
"128"
id=
"c7"
onclick=
"box(7)"
></td>
<td
style=
"border-style:solid"
width=
"96"
Height=
"128"
id=
"c8"
onclick=
"box(8)"
></td>
</tr>
<tr>
<th
id=
"jugador1"
>
Jugador 1
</th>
<td></td>
<th
id=
"jugador2"
>
Jugador 2
</th>
</tr>
<tr>
<td><img
src=
"http://images.coveralia.com/audio/d/Def_Leppard-X-Frontal.jpg"
width=
"80"
Height=
"100"
/></td>
<td></td>
<td><img
src=
"https://steemitimages.com/0x0/https://s5.postimg.cc/5z0fqjfnr/redonda_1.jpg"
width=
"80"
Height=
"100"
/></td>
</tr>
</table>
<br
/>
</center>
<script
src=
"tateti.js"
></script>
</body>
</html>
\ No newline at end of file
TatetiJS/tateti.js
0 → 100644
View file @
dfee21de
var
img
=
'http://images.coveralia.com/audio/d/Def_Leppard-X-Frontal.jpg'
;
var
turno
=
1
;
var
arreglo
=
new
Array
();
var
jug1
=
0
;
var
jug2
=
0
;
var
jugada
=
0
;
for
(
i
=
0
;
i
<=
8
;
i
++
){
arreglo
[
i
]
=-
1
;
}
function
cargarJugadores
(){
do
{
jug1
=
prompt
(
"ingrese el jugador1"
);
}
while
(
jug1
==
""
);
do
{
jug2
=
prompt
(
'ingrese el jugador2'
);
}
while
(
jug2
==
""
);
document
.
getElementById
(
"jugador1"
).
innerHTML
=
jug1
;
document
.
getElementById
(
"jugador2"
).
innerHTML
=
jug2
;
}
function
box
(
pos
){
if
(
arreglo
[
pos
]
==-
1
){
if
(
turno
==
1
){
if
(
img
==
'http://images.coveralia.com/audio/d/Def_Leppard-X-Frontal.jpg'
){
imagen
=
document
.
createElement
(
"img"
);
imagen
.
src
=
img
;
imagen
.
width
=
100
;
document
.
getElementById
(
'c'
+
pos
).
appendChild
(
imagen
);
arreglo
[
pos
]
=
1
;
turno
=
2
;
img
=
'https://steemitimages.com/0x0/https://s5.postimg.cc/5z0fqjfnr/redonda_1.jpg'
;
jugada
++
;
}
}
else
if
(
turno
==
2
){
if
(
img
==
'https://steemitimages.com/0x0/https://s5.postimg.cc/5z0fqjfnr/redonda_1.jpg'
){
imagen
=
document
.
createElement
(
"img"
);
imagen
.
src
=
img
;
imagen
.
width
=
100
;
document
.
getElementById
(
'c'
+
pos
).
appendChild
(
imagen
);
arreglo
[
pos
]
=
0
;
turno
=
1
;
img
=
'http://images.coveralia.com/audio/d/Def_Leppard-X-Frontal.jpg'
;
jugada
++
;
}
}
}
else
{
alert
(
'Posicion ocupada!'
);
}
if
(
arreglo
[
0
]
==
1
&&
arreglo
[
1
]
==
1
&&
arreglo
[
2
]
==
1
){
alert
(
'gano X'
);
jug1
=
jug1
+
1
;
}
if
(
arreglo
[
0
]
==
0
&&
arreglo
[
1
]
==
0
&&
arreglo
[
2
]
==
0
){
alert
(
'gano O'
);
jug2
=
jug2
+
1
;
}
if
(
arreglo
[
3
]
==
1
&&
arreglo
[
4
]
==
1
&&
arreglo
[
5
]
==
1
){
alert
(
'gano X'
);
jug1
=
jug1
+
1
;
}
if
(
arreglo
[
3
]
==
0
&&
arreglo
[
4
]
==
0
&&
arreglo
[
5
]
==
0
){
alert
(
'gano O'
);
jug2
=
jug2
+
1
;
}
if
(
arreglo
[
6
]
==
1
&&
arreglo
[
7
]
==
1
&&
arreglo
[
8
]
==
1
){
alert
(
'gano X'
);
jug1
=
jug1
+
1
;
}
if
(
arreglo
[
6
]
==
0
&&
arreglo
[
7
]
==
0
&&
arreglo
[
8
]
==
0
){
alert
(
'gano O'
);
jug2
=
jug2
+
1
;
}
if
(
arreglo
[
0
]
==
1
&&
arreglo
[
3
]
==
1
&&
arreglo
[
6
]
==
1
){
alert
(
'gano X'
);
jug1
=
jug1
+
1
;
}
if
(
arreglo
[
0
]
==
0
&&
arreglo
[
3
]
==
0
&&
arreglo
[
6
]
==
0
){
alert
(
'gano O'
);
jug2
=
jug2
+
1
;
}
if
(
arreglo
[
1
]
==
1
&&
arreglo
[
4
]
==
1
&&
arreglo
[
7
]
==
1
){
alert
(
'gano X'
);
jug1
=
jug1
+
1
;
}
if
(
arreglo
[
1
]
==
0
&&
arreglo
[
4
]
==
0
&&
arreglo
[
7
]
==
0
){
alert
(
'gano O'
);
jug2
=
jug2
+
1
;
}
if
(
arreglo
[
2
]
==
1
&&
arreglo
[
5
]
==
1
&&
arreglo
[
8
]
==
1
){
alert
(
'gano X'
);
jug1
=
jug1
+
1
;
}
if
(
arreglo
[
2
]
==
0
&&
arreglo
[
5
]
==
0
&&
arreglo
[
8
]
==
0
){
alert
(
'gano O'
);
jug2
=
jug2
+
1
;
}
if
(
arreglo
[
0
]
==
1
&&
arreglo
[
4
]
==
1
&&
arreglo
[
8
]
==
1
){
alert
(
'gano X'
);
jug1
=
jug1
+
1
;
}
if
(
arreglo
[
0
]
==
0
&&
arreglo
[
4
]
==
0
&&
arreglo
[
8
]
==
0
){
alert
(
'gano O'
);
jug2
=
jug2
+
1
;
}
if
(
arreglo
[
2
]
==
1
&&
arreglo
[
4
]
==
1
&&
arreglo
[
6
]
==
1
){
alert
(
'gano X'
);
jug1
=
jug1
+
1
;
}
if
(
arreglo
[
2
]
==
0
&&
arreglo
[
4
]
==
0
&&
arreglo
[
6
]
==
0
){
alert
(
'gano O'
);
jug2
=
jug2
+
1
;
}
if
(
jugada
==
9
)
{
alert
(
"Empate"
)
}
}
\ No newline at end of file
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