The second sections allows the user to paste the json representation of the grid. You should see a green dotted border in the drop target if you can drop a json file there. The first section allows the user to use drag and drop operations of json files previously downloaded. Like the save dialog, it's divided in three sections. Stop the game to enable the button by clicking "Stop" If the button is disabled, it means that the game is running. If the user clicks the "Load" button below the game world, it's presented with the load dialog. This button closes the window if everything went fine. The user just needs to provide a pattern name. The third section contains a form that allows the user to save the current game pattern to the browser's local storage. The second section, is a download button, that will trigger a file download of a json text file with the current game pattern. The user can then select the text and copy it somewhere else… The fist section is just a text area with a representation of the current pattern. If the user clicks the "Save" button below the game world, it's presented with the save dialog. There's not much else to tell about "clear", right? Save Dialog The toolbar bellow the game world clears the game, and enables the save and load dialog. Once you click start, the game will use the value present on the field. The value should be in milliseconds and can be set while the game is running. The form bellow the game's world allows the user to set the lifespan of each generations. Give them a try, both patterns shoot away the hacker logo… The "Load Gosper's Glider Gun" and "Load Gosper's Bi-Gun" button will load two famous game patterns created in the 70's by famous mathematician and programmer Bill Gosper. You can create new cells while the game is running to alter the patterns while they run. Once the game is started, all the controls are disabled, except for the lifespan form and the game world itself. The "Randomize World" creates a random pattern. The user can also step thru each generation manually using the "next generation" button. The toolbar at the top allow the user to start and stop the game. The main window has two toolbars, a generation counter, a form to set the lifespan of each generation and the game "world" itself. The main window allows you to interact with the game. The user interface was implemented using Twitter's Bootstrap library, and it comprises three windows. Follow this guide if you need to su/sudo to install npm packages. Run these commands on the root folder:ĭo not sudo npm. To run the samples, you need to use bower to download the components. All scripts should be run from that location. It should look like this (plus some hidden files): Once you have the repository cloned in your computer, you should browse to this folder (dojo/Conways-Game-of-Life/JavaScript/BackboneJS). Oh, and the test runner won't watch files on Windows. Other stuff may not work on Internet Explorer older than 9. This code has been tested on modern browsers only. For development purposes, a simple node.js server is provided. Any server capable of serving status files should do. The application just needs a server for demonstration purposes. You can check an online version of this code here. This folder contains the Backbone.JS implementation of Conway's Game of Life. From a theoretical point of view, it is interesting because it has the power of a universal Turing machine: that is, anything that can be computed algorithmically can be computed within Conway's Game of Life. The game made its first public appearance in the October 1970 issue of Scientific American, in Martin Gardner's "Mathematical Games" column. The Game of Life emerged as Conway's successful attempt to drastically simplify von Neumann's ideas.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |