viz

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package viz bundles the scenes of the nodes (spec 10) and checks their traces.

A scene is viz/scene.ts. It imports only "@algo/viz". Build bundles it with esbuild into a script that registers the scene in window.AlgoScenes. The player of the site runs it in the browser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(scenePath string, minify bool) ([]byte, error)

Build bundles the scene file into a browser script. The script sets window.AlgoScenes[slug] to the scene, and window.AlgoViz to the runtime.

func Core

func Core() string

Core is the source of @algo/viz.

Types

type Preset

type Preset struct {
	Name  string `json:"name"`
	Input any    `json:"input"`
}

Preset is a named input of a scene.

type Report

type Report struct {
	Slug    string   `json:"slug"`
	Fails   []string `json:"fails"`
	Lines   []string `json:"lines"` // the line ids that the presets reach
	Steps   []int    `json:"steps"` // the number of steps of each preset
	Skipped string   `json:"skipped,omitempty"`
}

Report is the result of checking one scene.

func Check

func Check(slug string, bundle []byte, presets []Preset, ids []string) Report

Check runs the bundled scene in Node on each preset (rules V01, V02, V04, V05 and V10). ids are the line ids of the pseudocode of the page. Without Node, the check is skipped and says so.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL