Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 29, 2020 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/06526e4a25b9867d70ae742e48901d43 to your computer and use it in GitHub Desktop.
Save parzibyte/06526e4a25b9867d70ae742e48901d43 to your computer and use it in GitHub Desktop.
const aleatorioDeArreglo = arreglo => arreglo[Math.floor(Math.random() * arreglo.length)];
const agregarBotonAleatorioASecuencia = secuencia => secuencia.push(aleatorioDeArreglo(botones));
const compararBotones = (boton, otroBoton) => {
return boton.attr("fill") === otroBoton.attr("fill");
};
const compararSecuenciaDeUsuarioConOriginal = (secuenciaOriginal, botonDeUsuario, indice) => {
return compararBotones(secuenciaOriginal[indice], botonDeUsuario);
};
const refrescarPuntaje = puntaje => textoPuntaje.text(puntaje.toString());
const reiniciar = () => {
secuencia = [];
puedeJugar = false;
contador = puntaje = 0;
refrescarPuntaje(puntaje);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment