agentscript

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.

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:

Files

Our directory layout is:

The core agentscript directories:

Developer directories:

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 views2mv (mv: model/view) onepagers import models from the models/ dir and add a 2D Canvas view as a separate file.

views2mv

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:

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/.