Giter Site home page Giter Site logo

juego-de-la-vida-js's Introduction

Juego-de-la-vida-JS

¿Qué es el juego de la vida?

Vista previa

Configuración

  • Configurar celulas vivas por default: En el atributo vivos del objecto config puedes agregar las cordenas de default.

  • Configurar el tamaño del tablero: Puedes cambiarlos a tu gusto modificando los atributos width y height del objecto config, tambien pudes elegir en que elemento mostrar el table modificando el atributo tablero del objeto config

  • Configurar el tiempo: En el attributo tiempo del objecto config lo puede modificar, por default esta 2 segundos

Ejemplo de una configuración

 <script>
    const config = {
      "vivos": ["2,1", "2,2", "3,2", "3,3", "4,2"],
      "width": 50,
      "height": 50,
      "tablero": document.getElementById('main'),
      "tiempo":2000
    }

    start();
  </script>

Ejemplo completo

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Juego de la vida</title>
  <!-- Estilo -->
  <link rel="stylesheet" href="./css/juego_de_la_vida.css">
</head>

<body>
  <!-- Tablero -->
  <main id="main"></main>
  <script src="./js/juego_de_la_vida.js"></script>
  <script>
    // Configuración inicial
    const config = {
      "vivos": ["2,1", "2,2", "3,2", "3,3", "4,2"],
      "width": 50,
      "height": 50,
      "tablero": document.getElementById('main'),
      "tiempo":2000
    }

    /**
     * @Ubicación del archivo: js/juego_de_la_vida.js
     * @linea: 4  
     */
    start();
  </script>
</body>

</html>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.