0.0.5 • Published 3 years ago

hampath3 v0.0.5

Weekly downloads
-
License
WTFPL
Repository
github
Last release
3 years ago

HamPath3

A library for generating random-looking Hamiltonian paths (aka self-avoiding walks) on a 3D grid. For a 2D grid, see the library this was based on: https://github.com/oysterCrusher/hampath.

Examples image

Use

To generate a 3D Hamiltonian path object:

import { hampath3 } from 'hampath3';
const path = hampath3({ 
    width: 12, // Optional. Width of the grid (Default: 4)
    height: 12, // Optional. Height of the grid (Default: 4)
    depth: 12 // Optional. Depth of the grid (Default: 4)
    seed: "12345678" // Optional. Passing a seed will always produce the same pseudorandom result.
}); 

The path object generated has the form:

path = {
    start : [1, 3, 1], // Coordinates of the start of the path
    end : [2, 6, 4], // Coordinates of the end of the path
    data : [[1, 3, 1], ... [2, 6, 4]] // Sequence of nodes along the path
}

License

WTFPL

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago