Git Product home page Git Product logo

clock-of-life's Introduction

Clock of Life

This is a wall clock implemented in Conway's Game of Life. You can run it on a Raspberry Pi 3 or similar.

The debugger

The clock speed is 23000 steps/min, so if you switch to manual mode to discover the inner workings of the clockwork, you often have to wait a lot for the next signal glider to arrive. It is possible to speed up the simulation in manual mode (default is 12 steps/sec) but then you need to be quick to stop it at the right moment. It can be painful.

To address the issue I have developed an experimental debugger which looks for moments of "period breaks". To use it zoom to a small area which processes a sparse signal and press "Run to Signal".

  • The debugger draws the first [period] generations onto a small canvas without clearing it between them, this way collecting a snapshot of all the cells that are active during normal periodic work.
  • Then it switches to high speed by drawing only every 2^step generations. Thanks to the Hashlife algorithm the simulation is very fast when the inner generations are not rendered.
  • For every drawn generation it checks if there is any live cell which is not marked in the accumulated snapshot. When it finds one, that must be part of the signal

You may need to tune the parameters: Use higher step if you are working with the hour or AM/PM displays, and enter a high enough period if the debugger stops immediately without finding a signal. Don't forget to zoom in to a small area, as the larger ones are not periodic and also the canvas used to collect the snapshot is small.

Embedding

TODO This section is a stub.

I run it on a Raspberry Pi 3 Model B using Chromium kiosk mode. On a low-end device like the rpi you have to configure the JavaScript heap with command line flags. Use clock.sh to start the browser.

TODOs

  • Allow editing and provide usable editor tools and a better debugger
  • Fix the memory leak correctly (only a workaround is done)
  • Remove unneeded code from the original simulator

Thanks

The original clockwork was designed by dim (see the post), I only tuned it a bit.

The player is based on life by copy.

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.