GithubHelp home page GithubHelp logo

lucidmachine / bitclock Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 3.59 MB

Bitclock is a clock made of binary integers to help you practice reading binary.

Home Page: https://lucidmachine.github.io/bitclock/

License: MIT License

JavaScript 45.52% TypeScript 54.48%
bitclock

bitclock's Introduction

Bitclock

Bitclock is a clock made of binary integers to help you practice reading binary.

Reading

For each digit from left to right compute the sum:
    For each value place from top to bottom, 8 to 1:
        If the bit is on then add that value to the sum.

Interpretation

Architecture

Data Structures

BitDigit

A BitDigit is an array of 4 bits which represents a single digit. Positions in the array signify place values 8, 4, 2, and 1. The value stored in that position may be either a 0 or a 1. If the value is a 1, then the corresponding place value should be added to the sum. If the value is a 0, then the corresponding place value is ignored.

// 8  4  2  1
  [1, 0, 0, 1]  // 8 + 0 + 0 + 1 = 9
  [0, 1, 1, 0]  // 0 + 4 + 2 + 0 = 6

BitTime

A BitTime is an array of BitDigits. Each item is a digit in the current time read left to right.

// 12:34:56
[
// 8  4  2  1
  [0, 0, 0, 1],  // H1: 0 + 0 + 0 + 1 = 1
  [0, 0, 1, 0],  // H2: 0 + 0 + 2 + 0 = 2
  [0, 0, 1, 1],  // M1: 0 + 0 + 2 + 1 = 3
  [0, 1, 0, 0],  // M2: 0 + 1 + 0 + 0 = 4
  [0, 1, 0, 1],  // S1: 0 + 1 + 0 + 1 = 5
  [0, 1, 1, 0]   // S2: 0 + 1 + 1 + 0 = 6
]

Backend

Backends retrieve the current time and transform it into a BitTime.

Frontend

Frontends transform a BitTime into something an end user can interpret. Reference implementations exist to draw pixels in a web page or favicon, but ambitious hackers could write to a visual CLI, LEDs, audio, or even a braille terminal.

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.