module WebAlgos

Overview

Zero-dependency reference algorithms for client-side browser media utilities and deterministic web puzzle engines.

Production browser applications backed by these reference algorithms:

Defined in:

webalgos.cr

Constant Summary

VERSION = "0.1.6"

Class Method Summary

Class Method Detail

def self.beat_duration_ms(bpm : Float64) : Float64 #

Returns milliseconds per quarter-note beat for a given BPM tempo. Used by MakeMeRap and Audio Visualizer Online.


[View source]
def self.gif_delay_ticks_to_ms(delay_ticks : Int32) : Int32 #

Converts GIF89a 1/100th-second delay ticks into clamped milliseconds. Used by Offline GIF Editor.


[View source]
def self.hamming_distance(a : String, b : String) : Int32 #

Counts differing positions between two equal-length words for word ladders. Used by Get Word Ladder.


[View source]
def self.nonogram_min_length(clues : Array(Int32)) : Int32 #

Computes minimum Nonogram line length for a sequence of run lengths. Used by PuzzleFern.


[View source]
def self.scale_log10_gap(a_meters : Float64, b_meters : Float64) : Float64 #

Computes logarithmic order-of-magnitude gap between two physical sizes in meters. Used by Play Size Comparison.


[View source]
def self.shared_taxon_depth(a : Array(String), b : Array(String)) : Int32 #

Computes shared taxonomic rank depth between two Linnaean paths. Used by Guess The Animal Game.


[View source]
def self.srgb_luminance(r : UInt8, g : UInt8, b : UInt8) : Float64 #

Computes relative sRGB luminance (0..1) for numeral contrast inside color-by-number regions. Used by Play Color by Number.


[View source]