GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - RuffLogix/block-algorithm: A block algorithm is a project that allows you to create blocks with your own specific functions, which can be plugged and played with other blocks.

BranchesTags
Open more actions menu

Latest commit

 

History

44 Commits
44 Commits

Folders and files

NameName
Last commit message
Last commit date
interactive-webapp
interactive-webapp
 
 
logic/src
logic/src
 
 
public/images
public/images
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

Algorithm Visualizer

Concept

A block algorithm is a project that allows you to create blocks with your own specific functions, which can be plugged and played with other blocks.

Block Structure

id: number;
x: number;
y: number;
name: string;
description: string;
nInputs: number;
nOutputs: number;
inputNames: string[];
outputNames: string[];
fn: Function;
style: string;

Every input of a block is passed to fn as its own argument, in the same order as inputNames.

// inputNames: ["A", "B"]
fn: (a: number, b: number) => a + b;

A returned array fills the output pins one by one, so a list that has to travel through a single pin is wrapped in one more array.

// outputNames: ["When True", "When False"]
fn: (condition: boolean, value: unknown) =>
  condition ? [value, undefined] : [undefined, value];

// outputNames: ["List"]
fn: (count: number) => [Array.from({ length: count }, (_, index) => index)];

Templates

Template What it holds
Logic Gates Constants, AND, OR, NOT, display
Arithmetics Constants, add, subtract, multiply, divide, display
Control Flow Greater than, equals, if/else, switch, console log
Loops Range, repeat value, for each, keep even, sum, length, console log
Debug Constant, double, console log

Demo

Demo

Todo List

  • BasedBlock class
  • Connection between blocks
  • Test cases for BasedBlock class
  • Block UI component
  • Block Editor UI component
  • Create Block Button
  • Delete Block Button
  • Curve Connection
  • Zoom In/Out
  • Cancel Connection
  • Preset Blocks (Logic, Math, etc.)
  • Load pre-built template
  • console.log() block for debugging
  • Animation when block is running.
  • Add edit button for block
  • Add stop point for line connection to make it more readable
  • Add syntax highlighter for block code (Create/Edit)
  • Import/Export blocks data
  • Implement infinite canvas

Development

npm test                          # Run the test cases of the logic package

cd interactive-webapp && npm run dev   # Run the interactive web app

Canvas Controls

  • Drag the canvas to pan, scroll over it to zoom, or use the zoom buttons at the bottom right of the canvas.
  • Click a pin of a block to start a connection, then click a pin of the other type to finish it. Esc cancels it.
  • Click a connection or its stop point to remove it.
  • In the block function editor, Tab indents and Shift + Tab outdents; Enter keeps the indentation of the line.
  • The output of the console.log() blocks is shown in the console panel below the canvas.

Contributor

  • RuffLogix

About

A block algorithm is a project that allows you to create blocks with your own specific functions, which can be plugged and played with other blocks.

Resources

Readme
Activity

Stars

3 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.