Skip to content

Latest commit

 

History

History
140 lines (117 loc) · 6.29 KB

README.md

File metadata and controls

140 lines (117 loc) · 6.29 KB

vicsek-fractal-cli

Print the Vicsek Fractal to the console!

What vicsek-fractal-cli prints to the console

npm version bundle size downloads license

Why the console? Because it's the cool way.

See All Fractals in the fractals-cli project.

Usage

Via npx:

$ npx vicsek-fractal-cli <n>
$ npx vicsek-fractal-cli <n> [size] [options]

where n >= 0 and size >= n (if provided).

Via Global Install

$ npm install --global vicsek-fractal-cli
$ vicsek-fractal-cli <n>
$ vicsek-fractal-cli <n> [size] [options]

where n >= 0 and size >= n (if provided).

Via Import

$ npm install vicsek-fractal-cli

then:

const vicsek = require('vicsek-fractal-cli');
console.log(vicsek.create(<n>);
console.log(vicsek.create(<n>, { 
    size: <number>, 
    diagonal: <boolean>,
    character: <character> 
}));

The config params are optional.

Options

Recursive Step

$ vicsek-fractal-cli <n>

The first param <n> is the recursive step. <n> should be an integer greater than or equal to 0.

Examples:

$ vicsek-fractal-cli 2

What vicsek-fractal-cli prints to the console

$ vicsek-fractal-cli 3

What vicsek-fractal-cli prints to the console

Size

$ vicsek-fractal-cli <n> [size]

The optional [size] param allows the Vicsek Fractal to be drawn at larger sizes. [size] should be an integer greater than or equal to <n>. Including size will draw a Vicsek Fractal of <n> recursive steps the size of a Vicsek Fractal with [size] recursive steps.

Example:

$ vicsek-fractal-cli 2 3

What vicsek-fractal-cli prints to the console

Diagonal Vicsek Fractal

$ vicsek-fractal-cli <n> --diagonal

The optional --diagonal param (or shorthand -d) will draw the diagonal Vicsek Fractal.

Example:

$ vicsek-fractal-cli 3 --diagonal

What vicsek-fractal-cli prints to the console

Custom Characters

$ vicsek-fractal-cli <n> --character=<character>

The optional --character=<character> param will draw sqaures using the provided character. (Please provide only 1 character)

Example:

$ vicsek-fractal-cli 1 3 --character=*

What vicsek-fractal-cli prints to the console

By default, squares are drawn using ANSI inverse codes: \u001b[7m. To instead draw using unicode block characters, add the --blocks param (or shorthand -b).

$ vicsek-fractal-cli <n> --blocks

(May look better/worse on certain terminals)

Related

Main Project

Fractal Shapes

Fractal Patterns

Space Filling Curves

License