Giter Club home page Giter Club logo

can-model's Introduction

Application URL: https://can-model.herokuapp.com/ *** No setup is required. Just visit the link *** *** Refresh the page to reset the model ***

The following application is a web based model of a Content Addressable Network. The model demonstrates the way nodes should be added to the network as well as a deterministic way of dividing up the area of responsibility per node.

The technology used for this application is as follows: Twitter Bootstrap: UI / Presentation layer Vanilla JavaScript: Application layer ExpressJS: Middleware and HTTP functionality NodeJS: Asynchronous JavaScript runtime Heroku: Cloud deployment

The program fully works for adding a Node to the network. The full application logic resides in the javascript file nodeFunctions.js. Below, I will describe what each function does.

  1. function add_node: This function adds a node to the cartesian grid. It is dependent on three other functions which will be further discussed. This function is the link between the DOM and the application logic.

  2. function generate_number: This function returns a random number for the add_node function to use. A required feature of a CAN is for nodes to be randomly placed on the cartesian grid. This function ensures this requirement.

  3. function generate_hex: This function returns a random hex number for the add_node and label_zone functions to use. It picks 6 random indices from a predefined array of hex values (0-9,a-f)

  4. function append_table: This function displays what’s currently in the network. It shows the order in which nodes were placed, their locations, and it’s hex color representation.

5 label_zone: This function divides the network up according to a deterministic way and labels each area a color that was generated by the generate_hex function.

The flow is pretty simple. The user clicks a button to add a node. A random number and hex is generated. The node is inserted at the random number and the background of the area for the node to control is changed to the random hex. The information is then recorded in the table for reference. This process repeats until there is no more room in the network (36 max spots ) which will result in each node in charge of only the area where it was initially inserted.

can-model's People

Contributors

jaymjax1 avatar

Watchers

 avatar  avatar

Forkers

ecoriihc

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.