Que tal a todos, se me ocurrio Hacer un pequeño Desafio entre nosotros (los usuarios del foro php),mas que nada para ponernos en practicas :) y participar mas. El Desafio o mini Concurso que se me ocurrio es el Siguiente :
El Laberinto es representado por una Matriz 24x24, inicialmente se encuentra sin el queso (solo paredes 1 y espacios libres 0)
la cual aleatoriamente inserta en un espacio libre el Queso (2) en el laberinto
Un Algoritmo,Script, Funcion, Clase, etc ... que simule un Raton, es decir comienze en un Punto Inicial (puede ser aleatorio este punto) y luego valla avanzando hasta encontrar el queso, debe
. Pueden utilizar cualquier tecnica de Programacion (Dividir y Venceras, Recursivas, Iterativas, Vuelta Atras, etc ..)
Código PHP:
<?
$array = array (
0 => array(
0 => 1,
1 => 1,
2 => 1,
3 => 1,
4 => 1,
5 => 1,
6 => 1,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => 1,
12 => 1,
13 => 1,
14 => 1,
15 => 1,
16 => 1,
17 => 1,
18 => 1,
19 => 1,
20 => 1,
21 => 1,
22 => 1,
23 => 1,
),
1 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 1,
10 => 0,
11 => 0,
12 => 0,
13 => 0,
14 => 0,
15 => 1,
16 => 0,
17 => 0,
18 => 0,
19 => 0,
20 => 0,
21 => 0,
22 => 0,
23 => 1,
),
2 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 1,
5 => 1,
6 => 1,
7 => 1,
8 => 0,
9 => 1,
10 => 1,
11 => 1,
12 => 1,
13 => 1,
14 => 0,
15 => 1,
16 => 0,
17 => 0,
18 => 1,
19 => 0,
20 => 1,
21 => 0,
22 => 0,
23 => 1,
),
3 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 1,
8 => 0,
9 => 1,
10 => 0,
11 => 0,
12 => 0,
13 => 0,
14 => 0,
15 => 1,
16 => 1,
17 => 0,
18 => 1,
19 => 1,
20 => 1,
21 => 0,
22 => 1,
23 => 1,
),
4 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 1,
4 => 1,
5 => 1,
6 => 0,
7 => 1,
8 => 0,
9 => 1,
10 => 0,
11 => 1,
12 => 0,
13 => 1,
14 => 0,
15 => 1,
16 => 0,
17 => 0,
18 => 0,
19 => 0,
20 => 0,
21 => 0,
22 => 0,
23 => 1,
),
5 => array(
0 => 1,
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 1,
8 => 0,
9 => 1,
10 => 1,
11 => 1,
12 => 0,
13 => 1,
14 => 0,
15 => 1,
16 => 1,
17 => 0,
18 => 1,
19 => 0,
20 => 1,
21 => 0,
22 => 0,
23 => 1,
),
6 => array(
0 => 1,
1 => 1,
2 => 1,
3 => 0,
4 => 1,
5 => 0,
6 => 0,
7 => 1,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0,
13 => 1,
14 => 1,
15 => 1,
16 => 1,
17 => 1,
18 => 1,
19 => 0,
20 => 1,
21 => 1,
22 => 1,
23 => 1,
),
7 => array(
0 => 1,
1 => 0,
2 => 0,
3 => 0,
4 => 1,
5 => 0,
6 => 0,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => 1,
12 => 0,
13 => 0,
14 => 0,
15 => 0,
16 => 0,
17 => 0,
18 => 0,
19 => 0,
20 => 0,
21 => 0,
22 => 0,
23 => 1,
),
8 => array(
0 => 1,
1 => 1,
2 => 1,
3 => 0,
4 => 1,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 1,
12 => 0,
13 => 1,
14 => 1,
15 => 1,
16 => 0,
17 => 1,
18 => 1,
19 => 0,
20 => 1,
21 => 1,
22 => 0,
23 => 1,
),
9 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 1,
5 => 0,
6 => 1,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => 1,
12 => 0,
13 => 1,
14 => 0,
15 => 1,
16 => 0,
17 => 0,
18 => 1,
19 => 0,
20 => 1,
21 => 0,
22 => 0,
23 => 1,
),
10 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 1,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0,
13 => 1,
14 => 0,
15 => 1,
16 => 0,
17 => 1,
18 => 1,
19 => 0,
20 => 1,
21 => 0,
22 => 1,
23 => 1,
),
11 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 1,
5 => 0,
6 => 1,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => 0,
12 => 1,
13 => 1,
14 => 0,
15 => 0,
16 => 0,
17 => 1,
18 => 0,
19 => 0,
20 => 1,
21 => 0,
22 => 0,
23 => 1,
),
12 => array(
0 => 1,
1 => 0,
2 => 0,
3 => 0,
4 => 1,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 1,
11 => 0,
12 => 0,
13 => 1,
14 => 0,
15 => 1,
16 => 1,
17 => 1,
18 => 1,
19 => 1,
20 => 1,
21 => 0,
22 => 1,
23 => 1,
),
13 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => 1,
12 => 0,
13 => 1,
14 => 0,
15 => 1,
16 => 0,
17 => 0,
18 => 0,
19 => 0,
20 => 0,
21 => 0,
22 => 0,
23 => 1,
),
14 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 1,
4 => 1,
5 => 0,
6 => 0,
7 => 1,
8 => 0,
9 => 0,
10 => 1,
11 => 0,
12 => 0,
13 => 1,
14 => 0,
15 => 1,
16 => 1,
17 => 1,
18 => 1,
19 => 0,
20 => 1,
21 => 1,
22 => 0,
23 => 1,
),
15 => array(
0 => 1,
1 => 0,
2 => 0,
3 => 0,
4 => 1,
5 => 0,
6 => 0,
7 => 1,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 1,
13 => 1,
14 => 0,
15 => 0,
16 => 0,
17 => 0,
18 => 0,
19 => 0,
20 => 0,
21 => 0,
22 => 0,
23 => 1,
),
16 => array(
0 => 1,
1 => 1,
2 => 1,
3 => 0,
4 => 1,
5 => 1,
6 => 1,
7 => 1,
8 => 0,
9 => 1,
10 => 0,
11 => 0,
12 => 1,
13 => 0,
14 => 0,
15 => 1,
16 => 1,
17 => 0,
18 => 0,
19 => 1,
20 => 0,
21 => 1,
22 => 1,
23 => 1,
),
17 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 1,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 1,
10 => 1,
11 => 0,
12 => 1,
13 => 0,
14 => 1,
15 => 0,
16 => 1,
17 => 0,
18 => 1,
19 => 1,
20 => 0,
21 => 1,
22 => 0,
23 => 1,
),
18 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 1,
5 => 0,
6 => 1,
7 => 1,
8 => 0,
9 => 0,
10 => 1,
11 => 0,
12 => 0,
13 => 0,
14 => 1,
15 => 0,
16 => 1,
17 => 0,
18 => 0,
19 => 1,
20 => 0,
21 => 1,
22 => 0,
23 => 1,
),
19 => array(
0 => 1,
1 => 0,
2 => 0,
3 => 0,
4 => 1,
5 => 0,
6 => 0,
7 => 1,
8 => 0,
9 => 0,
10 => 1,
11 => 0,
12 => 1,
13 => 0,
14 => 1,
15 => 0,
16 => 0,
17 => 0,
18 => 1,
19 => 1,
20 => 0,
21 => 0,
22 => 0,
23 => 1,
),
20 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 1,
5 => 1,
6 => 0,
7 => 1,
8 => 0,
9 => 1,
10 => 1,
11 => 0,
12 => 1,
13 => 0,
14 => 1,
15 => 1,
16 => 1,
17 => 0,
18 => 0,
19 => 1,
20 => 1,
21 => 1,
22 => 0,
23 => 1,
),
21 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 1,
8 => 0,
9 => 1,
10 => 0,
11 => 0,
12 => 1,
13 => 0,
14 => 0,
15 => 0,
16 => 1,
17 => 0,
18 => 1,
19 => 1,
20 => 1,
21 => 1,
22 => 0,
23 => 1,
),
22 => array(
0 => 1,
1 => 0,
2 => 1,
3 => 0,
4 => 1,
5 => 1,
6 => 1,
7 => 1,
8 => 0,
9 => 0,
10 => 0,
11 => 1,
12 => 1,
13 => 1,
14 => 0,
15 => 0,
16 => 1,
17 => 0,
18 => 0,
19 => 0,
20 => 0,
21 => 0,
22 => 0,
23 => 1,
),
23 => array(
0 => 1,
1 => 1,
2 => 1,
3 => 1,
4 => 1,
5 => 1,
6 => 1,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => 1,
12 => 1,
13 => 1,
14 => 1,
15 => 1,
16 => 1,
17 => 1,
18 => 1,
19 => 1,
20 => 1,
21 => 1,
22 => 1,
23 => 1,
),
) ;
?>