View difference between Paste ID: HMJcqdb6 and x3AUv8EM
SHOW: | | - or go back to the newest paste.
1-
http://pastebin.com/7qHdLf2b
1+
// Inicializamos los valores al comienzo del juego
2
$natalidad=$mortalidad=$sinCambios=0;
3
4
// Generamos las cordenadas X e Y al azar para el inicio del juego
5
// Tablero de 6 x 6 celdas
6
7
$x=rand(0, 6); $y=rand(0, 6);
8
9
// Generamos al azar si la celda esta viva (1) o Muerta (0) al inicio del juego
10
11
$arrayTablero[$x][$y] = rand(0, 1);
12
13
// continua el desarrollo del codigo donde ya comienza el juego
14
15
if($n < 2){
16
$arrayTablero[$x][$y] = 0;
17
$mortalidad++;
18
19
}
20
21
if($n > 3){
22
$arrayTablero[$x][$y] = 0;
23
$mortalidad++;
24
}
25
26
if($n == 3){
27
$arrayTablero[$x][$y] = 1;
28
$natalidad++;
29
}
30
31
if($n == 2){
32
$sinCambios++;
33
// no se modifica
34
}