Ver Mensaje Individual
  #5 (permalink)  
Antiguo 27/09/2013, 10:02
publicidadalandalus
 
Fecha de Ingreso: diciembre-2012
Ubicación: España
Mensajes: 51
Antigüedad: 11 años, 4 meses
Puntos: 0
Respuesta: Argumentación Pseudoaleatoria tipo Rand

La idea es crear una especie de "tragaperras" pero de 3 valores aleatorios.
y si coincide los 3 te diga que has ganado y si no coinciden te diga que has perdido
pero los valores en vez de ser numeros me gustaria que fueran unas imagnes. y he aqui el atascamiento.
Despues de esto ya encontraré la manera de hacer mas combinaciones. Pero como es para aprender, prefiero hacerlo paso a paso.

Os paso el código por completo y así se entenderá mucho mejor el concepto.

Cita:
<html>
<head>
<title> Alea </title>
<style type="text/css">
<!--
.Estilo1 {color: #FFCC33}
-->
</style>
</head>
<body bgcolor="#FFCC33">
<div align="center">
<table border="9">

<img src="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/LOGO.png">
<hr>

<br><br>

<?php


$num1 ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/Casillas/1.png";
$num2 ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/Casillas/2.png";
$num3 ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/Casillas/3.png";
$num4 ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/Casillas/4.png";
$num5 ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/Casillas/5.png";
$num6 ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/Casillas/6.png";
$num7 ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/Casillas/7.png";
$num8 ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/Casillas/8.png";
$num9 ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/Casillas/9.png";

$var1 =rand(1,3);
$var2 =rand(1,3);
$var3 =rand(1,3);
$GameWin ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/GameWin_1.png";
$GameOver ="http://localhost/Laboratorio/3CoincidenciasAleatorias/img/GameOver_1.png";



echo "<tr>";
echo "<td> - $var1 - </td>";
echo "<td> - $var2 - </td>";
echo "<td> - $var3 - </td>";
echo "</tr>";

if (($var1==$var2) && ($var2==$var3))
{
echo '<img src="'.$GameWin.'">';
}
else
{
echo '<img src="'.$GameOver.'">';
}

?>
</table>
</body>
</html>

gracias por todo.
Atentamente
PA