Skip to content

NetLogo/microtortoise

Repository files navigation

Microtortoise

What is it?

Ants, but small.

How do you use it?

Get a Galapagos instance running on port 9000. Galapagos commit ec944e6fd8 is confirmed to work.

Rust

cd rust
cargo run bench # Generates a performance metric
cargo run json  # Dumps out a JSON file into the root of this repo

Scala

cd scala
sbt "run bench" # Generates a performance metric
sbt "run json"  # Dumps out a JSON file into the root of this repo

TypeScript

cd typescript
npm install
npm run build

Headless NetLogo

This one allows you to run against a headless version of the actual NetLogo desktop application.

cd headless
sbt 'run "../Ants.nlogox"'

Unlike the other options here, you cannot see it run in the browser. Its functionality could be expanded to hook into the mirroring stuff used by the Tortoise tests, so that you could render the mirroring output as JSON and read it in the browser. But this is left as an exercise for the reader.

Viewing the model in action

From the root of the repository, launch an HTTP server, like this:

python3 -m http.server 8080

Then:

This will allow you to watch the TypeScript version in action.

You can click "Benchmark" and wait ~20 seconds, and you will eventually get a pop-up that tells you how many milliseconds it took to run the TypeScript version of the model.

You can click "Play Recording (Scala)" to watch a JSON file that was exported by Scala. It is expected to be found at the URL /microtortoise-data-scala.json. A similar thing can be done (presumably, for TypeScript) by getting another data file hosted at the URL /microtortoise-data.json. Such a recording can be created with the "Make Recording" button.

About

Pared-down versions of Ants in various languages

Resources

License

Stars

Watchers

Forks

Contributors