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 🙏

© 2024 – Pkg Stats / Ryan Hefner

agentscript

v0.10.25

Published

AgentScript Model in Model/View architecture

Downloads

4,791

Readme

AgentScript

AgentScript is a minimalist Agent Based modeling system based on NetLogo semantics.

It has a Model/View/Control (MVC) architecture which cleanly separates the three components.

  • Model: Provides NetLogo-like semantics for Patches, Turtles and Links. It has no colors, shapes, sizes etc for viewing the model.

  • View: Use the Model properties to create a view. There can be many Views. We provide a 2D Canvas view and a Three.js 2.5D and 3D views. There is also GIS support via a gis module, a geojson module, as well as Leaflet and MapLibre based demos. Plot views are also available.

  • Controls: We use src/GUI.js via dat.gui for a menu UI, a Mouse module for selecting Model objects (Patches, Turtles and Links), an Animator for fine control over the Model/Draw steps.

Modern JavaScript

AgentScript is entirely ES6 Module based with import and export statements.

This allows direct access to individual modules which will automatically load only the module and its dependencies.

Example: to import Class Model for building your own model, use:

import Model from './path/to/agentscript/src/Model.js'

.. where path/to/agentscript is a local file system path or a url to a server:

There are bundles as well of all the agentscript modules as a single file from the usual NPM-based CDNs:

To create your own local agentscript files:

  • Go to: https://github.com/backspaces/agentscript
  • Click on the large green Code button
  • Click on Download ZIP. The creates the file agentscript-master.zip
  • Unzip this. Creates agentscript-master/
  • Rename/Move to where you want it.

Files

Our directory layout is:

The core agentscript directories:

  • models/: simple sample/demo models. All are es6 modules used in onepagers below
  • src/: all the agentscript source code. All are es6 modules
  • docs/ Documentation for all the individual modules used by the programmer.

Developer directories:

  • bin/: workflow scripts
  • dist/: the umd and esm bundles with their min.js versions and src/.
  • test/: testing using Deno with it's browser environment running all models/ using its test feature to report errors.
  • config/: tools for creating "bundles".

Run demos

The models directory contains the individual Models JavaScript files. I.e. HelloModel.js exports the HelloModel etc. It is the only demo directory with .js files, the rest are "onepagers" .html files.

models

The views1 onepagers import models from the models/ dir and run for 500 steps, printing out a sample of the model's data.

views1

The views2 onepagers import models from the models/ dir and add a 2D Canvas view.

views2

The views25 onepagers import models from the models/ dir and add a Three.js webgl 2.5D view.

views25

The views3 onepagers import models from the models/ dir and add a Three.js webgl 3D view.

They are similar to the views25 onepagers but use src/Model3D.js and src/Turtle3D.js which are subclasses of their 2D counterparts: src/Model.js and src/Turtle.js

views3

The mvc onepagers are combine Models, Views, and Controls into "apps".

mvc

AgentScript provides a way to include your models on a map. These two sets of onepagers use gis & geojson utilities to create and view models running on Leaflet and maplibre maps.

leaflet

and

maplibre

Developer Information

Most users need not worry about this, you can access all the AgentScript code as described above using local files or servers. This is for those wishing to build the AgentScript system itself.

To clone the github repo:

  • cd to where you want the agentscript/ dir to appear.
  • git clone https://github.com/backspaces/agentscript
  • cd agentscript # go to new repo
  • yarn install # install all dev dependencies.
  • yarn build # install all our dependencies. Note: Fine to use npm rather than yarn.

All workflow is npm run scripts. See package.json's scripts, or use yarn/npm run for a list of all scripts. JavaScript Standard Style is used, see the prettierrc.js.

License

Copyright Owen Densmore, RedfishGroup LLC, 2012-2023 AgentScript may be freely distributed under the GPLv3 license:

AgentScript is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program, see LICENSE within the distribution. If not, see http://www.gnu.org/licenses/.