npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

soil-scape

v1.2.2

Published

The Soil-Scape Simulation

Downloads

9

Readme

Soil-Scape

The Soil-Scape is a simulation libary that models Earth-like plate tectonics and plant genetics.

Getting Started

Installing

npm install soil-scape

Using

To begin working with Soil-Scape, first we require the module.

var soilScape = require('soil-scape');

To create a simulation use createSimulation(specs) where specs are the creation parameters. This returns a snapshot of the simulation on the first day of creation.

The specs object expects:

size.rows - int [1,100] - The number of province rows
size.columns - int [1,100] - The number of province columns
plantsPer - int 1, 3, 9, or 16 - The number of plants per province
tilt - float[0,1] - The tilt of the Earth which determines the sunbelt location, 0 is North, 0.5 is the Equator, and 1 is South
rotation - int -1 or 1 - The rotation of the Earth determines macroscopic weather phenomena, -1 is left, 1 is right
rules.maturity - boolean - Whether or not plants must mature to repoduce 
rules.heliophilia - boolean - Whether or not plants need sunlight
rules.thirst - boolean - Whether or not plants need rain
rules.roots - int [1,8] - How many plant neighbors causes death by root competition
rules.mutation - float [0,1] - The plant gene mutation rate

Here's an example of world creation:

var specs = {
  size: {
    columns: 80
    , rows: 50
  }
  , plantsPer: 9
  , tilt: 0.75
  , rotation: -1
  , rules: {
    maturity: true
    , thrist: true
    , heliophilia: true
    , roots: 8
    , mutation: 0.999
  }
};
var world = soilScape.createSimulation(specs);

Then we can pass time by using simulate(world , days, every) where world is a simulation snapshot, days is the number days you'd like simulated, and every is the save interval in days. This returns an array of simulation snapshots.

var newDates = soilScape.simulate(world, 360, 10); //  A full year with snapshots every week

One should note that a week lasts 10 days, a months lasts 30 days, and a years lasts 360 days within the SoilScape.

If you want to specify the number of days, weeks, months, and years, you can use toDays(days, weeks, months, years).

var newDates = soilScape.simulate(world, soilScape.toDays(360, 36, 12, 1), 10); //  4 Years

The snapshot files contains arrays of data pertaining to the state of the simulation. Data is broken up into the province and plot level. The columns and rows provided within the specs determins the number of provinces, and the plantsPer determines the number of plots within a single province.

The useful province level data includes:

tectonic - int - The tectonic plate this province belongs to, provinces with the same plate number are part of the same plate
heat - int [0,∞) - The amount of built up heat in the asthenosphere, 0 is coolest
stress - int [0,∞) - The amount of tectonic stress, 0 is lowest
height - int [0,∞) - The units of land, 0 is lowest 
depth - int [0,∞) - The units of water, 0 is shallowest
sunlight - int [0,100) - The average sunlight, 0 is lighest and 100 is hardest
rainfall - int [0,100) - The average annual rainfall, 0 is lightest and 100 is hardest
nt - int [0,100) - The amount of nutro in the soil
nc - int [0,100) - The amount of nucium in the soil

Each type of data is stored in an array of size columns*rows where index z is the same province in all arrays. For instance, to get the height and depth of the province at column x and row y, we would access it at world.height[z] and world.depth[z] where z is x + (y * columns).

Within each province are several plant plots. Plant plots are similarly stored in arrays of size columns * rows * plantsPer.

The useful plant plot data includes:

hasPlant - bool - Whether or not there is a living plant here
ntStore - int [0,∞) - The amount of nutro this plant has stored
ncStore - int [0,∞) - The amount of nucium this plant has stored
waterStore - int [0,∞) - The amount of water this plant has stored
growth - int [0,∞) - The size and maturity of the plant
generation - int [0,∞) - The generational distance of this plant from the first plants

There is also a series of plant plot DNA data:

ntConsumption - int [0,∞) - How much nutro this plant pulls from the soil every tick
ntMetabolism - int [0,∞) - How much nutro this plant consumes from its store every tick
ntEndowment - int [0,∞) - How much nutro this plant places in its seeds
ncConsumption - int [0,∞) - How much nucium this plant pulls from the soil every tick
ncMetabolism - int [0,∞) - How much nucium this plant consumes from its store every tick
ncEndowment - int [0,∞) - How much nucium this plant places in its seeds
numberSeeds - int [0,∞) - How many seeds this plant outputs, plants need nutrients equivalent to `endowment * numberSeeds` to reproduce
seedSpread - int [0,∞) - How far seeds spread
requiredGrowth - int [0,∞) - How much the plant must mature before it can reproduce

To access the growth of a plant at plant column j and plant row k we use world.growth[p] where p is j + (k * plantColumns). The plots associated with a province will appear on several plant rows and columns. You can get an array of indices associated with a single province with world.GetPlotsOfZ(z) where z is the index of the province.

Built With

Author

Oliver Barnum

License

This project is licensed under the MIT License - see the LICENSE.md file for details