Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
cellular-automata
Advanced tools
Readme
With npm do:
npm install cellular-automata
To run the test suite, run the following command from the cellular-automata
directory:
npm test
var CellularAutomata = require('cellular-automata');
// create a cellular automata with width of 200 cells and a height of 80 cells
var cellularAutomata = new CellularAutomata([200, 80]);
// fill the array with 95% of 0 values and 5% of 1 values
cellularAutomata.fillWithDistribution([[0, 95], [1, 5]]);
// define that the value out of the array should be interpreted as 0 values
cellularAutomata.setOutOfBoundValue(0);
cellularAutomata.setRule('23/3').iterate(5); // apply 5 times the S23/B3 rule (conway's life)
cellularAutomata.setRule('135/17').iterate(3); // apply 3 times the S135/B17 rule
cellularAutomata.setRule('234/12345678').iterate(5); // apply 5 times the S234/B12345768 rule
console.log(cellularAutomata.array); // ndarray containing the result
// create a cellular automata with width of 75 cells and a height of 75 cells
var cellularAutomata = new CellularAutomata([75, 75]);
// use the fluent interface and the shortcut method "apply"
cellularAutomata
.setOutOfBoundValue(1)
.apply('23/3', 16)
.apply('23456/45678', 16)
.apply('23456/478', 16);
console.log(cellularAutomata.array); // ndarray containing the result
new CellularAutomata(shape[, defaultValue = 0])
All methods are chainable
setOutOfBoundValue([outOfBoundValue = 0])
Define the value used for the neighbours out of the array's bounds.
setRng([rng = null])
Set the random number generation function used internally.
fillWithDistribution(distribution[, rng = null])
Fill the grid with a given distribution.
setRule(rule[, neighbourhoodType[, neighbourhoodRange = 1]])
Define the rule of the cellular automata and the neighbourhood to be used.
iterate([iterations = 1])
Apply the previously defined CA rule multiple times.
apply(rule[, iterations = 1[, neighbourhoodType[, neighbourhoodRange = 1]]])
Apply a given rule for a given number of iterations, shortcut method for setRule and iterate.
shape
The shape of the grid.
dimension
The dimension of the grid.
array
The ndarray containing all the current data in the grid.
const
and let
variable declarations).MIT
FAQs
Cellular automata runner, in arbirtrary dimensions.
The npm package cellular-automata receives a total of 10 weekly downloads. As such, cellular-automata popularity was classified as not popular.
We found that cellular-automata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.