* @copyright 2023 Bartolomé Sintes Marco * @license http://www.gnu.org/licenses/agpl.txt AGPL 3 or later * @version 2023-12-05 * @link https://www.mclibre.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ // Se accede a la sesión session_name("simon-3"); session_start(); $longitud = rand(2, 7); $colores = ["red", "yellow", "green", "blue"]; if (!isset($_SESSION["objetivo"]) || !isset($_SESSION["jugador"]) || !isset($_SESSION["fallo"]) || !isset($_SESSION["completado"])) { for ($i = 0; $i < $longitud; $i++) { $_SESSION["objetivo"][] = $colores[array_rand($colores)]; } $_SESSION["jugador"] = []; $_SESSION["fallo"] = false; $_SESSION["completado"] = false; } ?> Simon (3). Minijuegos. Sesiones. Ejercicios. PHP. Bartolomé Sintes Marco. www.mclibre.org

Simon (3)

Secuencia a reproducir:

\n"; foreach ($_SESSION["objetivo"] as $color) { print " \n"; print " \n"; } print "

\n"; print "\n"; ?>

Haga clic para comenzar el juego: