Skip to content

Instantly share code, notes, and snippets.

View wybo's full-sized avatar

Wybo Wiersma wybo

View GitHub Profile
@wybo
wybo / dividendPathways.coffee
Last active May 1, 2017 21:40
Swarm Redistribution
u = ABM.util # shortcut for ABM.util, some tools
log = (arg) -> console.log arg # log to the browser console
class ABM.TemplateModel extends ABM.Model
setup: ->
@stopTick = 200
@wybo
wybo / model.coffee
Created July 29, 2015 11:30
Small Template Modification
# AgentBase is Free Software, available under GPL v3 or any later version.
# Original AgentScript code @ 2013, 2014 Owen Densmore and RedfishGroup LLC.
# AgentBase (c) 2014, Wybo Wiersma.
# This model shows the basic structure of a model and is a good
# place to get started when you want to try building your own.
#
# To build your own model, extend class ABM.Model supplying the
# two built in methods `setup` and `step`.
#
@wybo
wybo / model.coffee
Last active May 1, 2017 23:04
Traveling Salesman
# AgentBase is Free Software, available under GPL v3 or any later version.
# Original AgentScript code @ 2013, 2014 Owen Densmore and RedfishGroup LLC.
# AgentBase (c) 2014, Wybo Wiersma.
# Traveling Salesman demonstrates a Traveling Sales Person solution
# via a Genetic Algorithm showing the rapid conversion of stochastic
# methods.
u = ABM.util
@wybo
wybo / model.coffee
Last active May 1, 2017 23:04
Preferential Attachment
# AgentBase is Free Software, available under GPL v3 or any later version.
# Original AgentScript code @ 2013, 2014 Owen Densmore and RedfishGroup LLC.
# AgentBase (c) 2014, Wybo Wiersma.
# Preferential Attachment models a dynamic graph where new links
# preferentially attach to the nodes that have the most links. This
# results in a power-law distribution.
u = ABM.util
@wybo
wybo / model.coffee
Last active May 1, 2017 23:04
N-body
# AgentBase is Free Software, available under GPL v3 or any later version.
# Original AgentScript code @ 2013, 2014 Owen Densmore and RedfishGroup LLC.
# AgentBase (c) 2014, Wybo Wiersma.
# N body is a simulation of the nonlinear gravitation of n bodies.
u = ABM.util
class ABM.NBodyModel extends ABM.Model
setup: ->
@wybo
wybo / model.coffee
Last active May 1, 2017 23:04
Link Travel
# AgentBase is Free Software, available under GPL v3 or any later version.
# Original AgentScript code @ 2013, 2014 Owen Densmore and RedfishGroup LLC.
# AgentBase (c) 2014, Wybo Wiersma.
# Link Travel has agents traversing a graph of nodes and links.
u = ABM.util
class ABM.LinkTravelModel extends ABM.Model
setup: ->
@wybo
wybo / model.coffee
Last active May 1, 2017 23:04
Life
# AgentBase is Free Software, available under GPL v3 or any later version.
# Original AgentScript code @ 2013, 2014 Owen Densmore and RedfishGroup LLC.
# AgentBase (c) 2014, Wybo Wiersma.
# Life provides an implementation of Conway's Game of Life with a twist.
# This example demonstrates running multiple models on the same page.
u = ABM.util
class ABM.LifeModel extends ABM.Model
@wybo
wybo / model.coffee
Last active May 1, 2017 23:04
Grid Path
# AgentBase is Free Software, available under GPL v3 or any later version.
# Original AgentScript code @ 2013, 2014 Owen Densmore and RedfishGroup LLC.
# AgentBase (c) 2014, Wybo Wiersma.
# Grid Path shows one of Knuth's great puzzles on the probability
# of all Manhattan traversals diagonally traversing a grid.
u = ABM.util
class ABM.GridPathModel extends ABM.Model
@wybo
wybo / model.coffee
Last active May 1, 2017 23:04
Flock
# AgentBase is Free Software, available under GPL v3 or any later version.
# Original AgentScript code @ 2013, 2014 Owen Densmore and RedfishGroup LLC.
# AgentBase (c) 2014, Wybo Wiersma.
# Flock is the classic "boids" model where agents each follow
# three simple rules resulting in realistic flocking. This example
# uses the as.dat.gui.js extra.
u = ABM.util
@wybo
wybo / model.coffee
Last active May 1, 2017 23:04
Fire
# AgentBase is Free Software, available under GPL v3 or any later version.
# Original AgentScript code @ 2013, 2014 Owen Densmore and RedfishGroup LLC.
# AgentBase (c) 2014, Wybo Wiersma.
# Fire is a cellular automata model of fire spreading.
u = ABM.util
class ABM.FireModel extends ABM.Model
setup: ->