top of page
  • Correo
  • Instagram

LÍO EN LA ESCUELA. LO IMPORTANTE DE LLAMARSE STEVE

Chistecito 1

(EN LA CLASE DE INFORMÁTICA)


- FELIPE.


- SÍ MAESTRA.


- ¿EN QUÉ PROYECTO ANDAN?


- CON MAFALDA PROGRAMOS UN JUEGO.


- ¿QUÉ JUEGO?


- EL TRES EN LÍNEA.


- ¿Y CÓMO SE JUEGA?


- EN LÍNEA.


JAJAJA.


- ¿NOS PODÉS COMPARTIR EL CÓDIGO?


- AQUÍ ESTÁ:


<!DOCTYPE html>

<HTML>

<HEAD>

<TITLE>THREE ON LINE GAME</TITLE>



<STYLE>

position: absolute;

top: 400px;

left: 50px; 

height:80vh; 

width:50vw; 

overflow-y:scroll; text-align:left;   

    

}  

position: absolute;  

top: 50px;

left: 50px;  

width: 300px;

height: 300px;   

background-size: 275px; // 205px; Para pantalla de PC 

background-repeat: no-repeat;  

}  


position: absolute;

top: 0px;

left: 0px;            

}


position: absolute;

top: 350px;

left: 50px;            

}


pointer-events: none;     

}


pointer-events:none;

}


pointer-events:none;

}


pointer-events: auto;

position: absolute;

top: 450px;

left: 100px;            

}


position: absolute;

top: 0px;

left: 0px;            

}


position: absolute;

top: 500px;

left: 50px;            

}


top: 30px;

left: 50px;

}

</STYLE>

</HEAD>

<SCRIPT>   

//VARIABLES AREA DE JUEGO


setInterval(refresco,3000);


var linea=[];

var jugadaMia=["  "];

var turno=0;

var cuatroEspacios ="&nbsp;&nbsp;&nbsp;&nbsp;";

var sieteEspacios ="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

var acumulado ="";

var color ="black";

var gane=0;


   

//VARIABLES AREA DE COMUNICACIONES


var primero=-1;

var desactiva=0;

var idOk=0;

var id="";

var name="nop";

var info="nop";

var data="nop";


//AREA DE COMUNICACIONES


function primeroNosotros()

{

id=document.getElementById("Id").value;

primero=-1;

desactiva=0;

idOk=0;

name="nop";

info="nop";

data="nop";


recibir();

console.log("idOk: "+idOk);

if(idOk===0){

document.getElementById("botonAccion").style.pointerEvents="auto";

document.getElementById("mensaje").style.pointerEvents="auto";

document.getElementById("entrada").style.pointerEvents="auto";

document.getElementById("Id").style.pointerEvents="none";       

}else{

document.getElementById("Id").value="";

idOk=0;

}

}


function refresco(){

if(desactiva!==0){recibir();}


if(turno===1){

   document.getElementById("entrada").style.pointerEvents="auto";  

}else{

   document.getElementById("entrada").style.pointerEvents="none";  

}

console.log("turno: "+turno);


}


function envio()

{

 info = info.replace("!", "888");

 info = info.replace("?", "777");

 info = info.replace(":", "555");

 info = info.replace("-", "444");

 info = info.replace(")", "333");

 info = info.replace("(", "222");

 console.log("enviar:");

 console.log("id: "+id);

 console.log("name: "+name);

 console.log("info: "+info);

 console.log("data: "+data);

 

  $.ajax({

   type: 'POST',

   crossDomain: true,

   dataType: 'jsonp',

   success: function(jsondata){}

});


}


function recibir()

{

$.ajax({

   type: 'POST',

   crossDomain: true,

   dataType: 'jsonp',

   success: function(jsondata){

   }

});


//luego reader.php llama a la funcion MyFunc;

}



function myFunc(myObj)

{

idX=id;

indexRel=0;

acumulado="";

t=0;

sumar=0;

idSearch=0;


try{

var e=myObj.forEach(function(data){

objX=JSON.parse(JSON.stringify(data));

if(objX.id===idX && objX.info!=="nop"){indexRel++; acumulado += indexRel + " " + objX.name + ": " + objX.info + "<br>";}

if((objX.id===idX) && (objX.data!=="nop")){if(objX.name==="Green"){letra=objX.data[0]; numero=parseInt(objX.data[1]); numLetra=letra.charCodeAt(0)-65; aux=linea[numLetra]; console.log(letra+numero);aux=aux.replaceAt(numero,"#"); linea[letra.charCodeAt(0)-65]=aux;}}

if((objX.id===idX) && (objX.data!=="nop")){if(objX.name==="Red"){letra=objX.data[0]; numero=parseInt(objX.data[1]); numLetra=letra.charCodeAt(0)-65; aux=linea[numLetra]; console.log(letra+numero);aux=aux.replaceAt(numero,"$"); linea[letra.charCodeAt(0)-65]=aux;}}

if(objX.id===idX && objX.info==="Red juega despues"){idSearch=1;}

});

}catch{}


idOk=idSearch;


for(i=0; i<5; i++){

   for(g=1; g<6; g++){

      if(linea[i][g]==="#" || linea[i][g]==="$"){t++;} 

   }   

}


if(desactiva===0 && idOk!==1)

{


if(acumulado!==""){primero=1;}


if(primero===-1)

{

   info="Bienvenidos al juego 3 en linea";

   data="nop";

   name="Administrador";

   envio();


   name="Green";

   info="Green juega primero";

   data="nop";

   envio();

   turno=1;

   primero=0;


   document.getElementById("entrada").style.pointerEvents="auto";  

   document.getElementById("botonAccion").style.pointerEvents="auto";

   document.getElementById("mensaje").style.pointerEvents="auto";

   document.getElementById("annutioGaudium").value="Tu usuario es Green , tu Id es "+id;

}else{

   document.getElementById("annuntioGaudium").value="Tu usuario es Red , tu Id es "+id;

   name="Red";

   info="Red juega despues";

   primero=1;

   turno=0;

   data="nop";

   envio();

}   


document.getElementById("botonInicio").style.display="none";

 document.getElementById("freedom").innerHTML = acumulado;

 

desactiva=1;   

}


if(t!==0){


   turno=0;

   if((primero===1) && (t!==Math.trunc(t/2)*2)){turno=1;}

   if((primero===0) && (t===Math.trunc(t/2)*2)){turno=1;}

   console.log("primero: "+primero+" turno: "+turno+" t:"+t);

}

acumulado="";

imprime();




//AREA DE JUEGO


function cargar()

{

linea[0] = "A00000";

linea[1] = "B00000";

linea[2] = "C00000";

linea[3] = "D00000";

linea[4] = "E00000";

linea[5] = "012345";

}


String.prototype.replaceAt = function(index, replacement) { return this.substring(0, index) + replacement + this.substring(index + replacement.length); }


function control(intro){

salida=0;

if(intro!==""){

   jugadaMia=document.getElementById("entrada").value;

   letra=intro[0].toUpperCase();

   numero=intro[1];

   numLetra=letra.charCodeAt(0)-65;

   numnumero=numero.charCodeAt(0)-48;

   if((numLetra>=0) && (numLetra<7) && (numnumero>=0) && (numnumero<10)){salida=letra+numero;}else{salida=0;}

}

 return salida;

}



function accion()

{

jugadaMia=document.getElementById("entrada").value;

info=document.getElementById("mensaje").value;

check=control(jugadaMia);

if(check!==0)

{     

      if(info===""){info="nop";}

      data=check;

      envio();

      imprime();

      document.getElementById("entrada").style.pointerEvents="none";

}else{

      data="nop";

      envio();

}


 document.getElementById("entrada").value="";

 document.getElementById("mensaje").value="";



console.log("turno: "+turno);

recibir();

}



function imprime() 

{

acumuladoX = "<BR>";

for(y=0;y<6;y++){

   for(x=0;x<6;x++){


      if(linea[y][x]==="#"){color="green";} else if(linea[y][x]==="$"){color="red";}else if(linea[y][x]==="0"){color="white";}else{color="black";}

      if(x===0){espacios=cuatroEspacios;}else{espacios=sieteEspacios;}

      acumuladoX = acumuladoX + "<label style='color: "+color+"' >"+ linea[y][x] + "</label>" +espacios;

   }

   acumuladoX = acumuladoX + "<BR><BR>";

}

document.getElementById("salida").innerHTML= acumuladoX;


if(ganador("#")===1){

   

   console.log("GANO GREEN");

   info="ENHORABUENA, GANO GREEN";

   data="nop";

   name="Administrador";

   envio();

   document.getElementById("botonAccion").style.pointerEvents="auto";

   document.getElementById("mensaje").style.pointerEvents="auto";

   document.getElementById("entrada").style.pointerEvents="none";

   document.getElementById("Id").style.pointerEvents="none";  

}else if(ganador("$")===1){

   console.log("GANO RED");

   info="GANO, GANO, GANO RED";

   data="nop";

   name="Administrador";

   envio();

   document.getElementById("botonAccion").style.pointerEvents="auto";

   document.getElementById("mensaje").style.pointerEvents="auto";

   document.getElementById("entrada").style.pointerEvents="none";

   document.getElementById("Id").style.pointerEvents="none";  

}

}



</SCRIPT>

<BODY  onload="cargar();imprime();">

<DIV id="annuntioGaudium"></DIV>


<DIV id="salida"></DIV>

<BUTTON id="botonInicio" onclick="primeroNosotros();" >Presiona para iniciar</BUTTON>


<DIV id="coordenadas">Ingrese Id, por ejemplo: Danny DeVito <INPUT type="text" size="20" id="Id" ></INPUT></DIV>

<DIV id="charlo">Ingresa coordenadas <INPUT type="text" size="5" id="entrada" ></INPUT>

<BR><BR>Ingresa un mensaje <INPUT type="text" id="mensaje"></INPUT><BR><BR>

<BR><BR><BR>

<BUTTON id="botonAccion" onclick="accion();" >Jugar/ Enviar mensaje</BUTTON>

<BR><BR>

<DIV id="freedom"style="height:80vh; width:50vw; overflow-y:scroll; text-align:left;" ></DIV>

<BR><BR>


</BODY>

</HTML>


- MUY BIEN, SIGAN ASÍ.


- ES LA IDEA.


JAJAJA.



Chistecito 2


- PAPÁ.


- SÍ MIGUELITO.


- QUE INTERESANTE ES LA INFORMÁTICA.


- ¿PARA QUIÉN?


- PARA LOS INFORMÁTICOS.


JAJAJA.



Chistecito 3


- JESÚS, AYÚDANOS A SER EXCELENTES PROGRAMADORES, PERO ANTES QUE BUENOS PROGRAMADORES QUEREMOS SER BUENAS PERSONAS.


AMÉN.





FURIOSO PÉTALO DE SAL




Comentarios


bottom of page