Package-level declarations

Types

Link copied to clipboard
open class Environment<R>(val defaultRetainTime: Int = 1, val areConnected: (Environment<R>, Node<R>, Node<R>) -> Boolean = { _, _, _ -> true })

An environment with a set of nodes with a defaultRetainTime mapped into positions, which are considered connected if the areConnected function returns true for them.

Link copied to clipboard
class EnvironmentWithMeshNetwork<R>(val connectDistance: Double, defaultRetainTime: Int = 1) : Environment<R>

An environment where nodes are connected if they are within connectDistance from each other.

Link copied to clipboard
class Node<R>(val environment: Environment<R>, val id: Int, var value: R, cyclesToResetMessages: Int = 1, program: Aggregate<Int>.(Environment<R>) -> R)

A network node with an associated environment, id, value, and program.

Link copied to clipboard
@Serializable
data class Position(val x: Double, val y: Double, val z: Double)

A position in a 3D space with x, y, and z coordinates.

Link copied to clipboard
object Round

Utility object for round-based computation testing.

Link copied to clipboard
class SerializingMailbox(serializer: SerialFormat = Json) : Mailbox<Int>

A Mailbox that serializes messages using the provided serializer. It can be used to test serialization and deserialization of messages.

Functions

Link copied to clipboard
fun <R, E : Environment<R>> E.grid(sizeX: Int, sizeY: Int, initial: (Environment<R>, Position) -> R, program: Aggregate<Int>.(Environment<R>) -> R): E

An environment with a regular grid of nodes of sizeX by sizeY dimensions. Each node is initialized with the initial function and runs the program function.

Link copied to clipboard
fun <R> mooreGrid(sizeX: Int, sizeY: Int, initial: R, program: Aggregate<Int>.(Environment<R>) -> R): EnvironmentWithMeshNetwork<R>
fun <R> mooreGrid(sizeX: Int, sizeY: Int, initial: (Environment<R>, Position) -> R, program: Aggregate<Int>.(Environment<R>) -> R): EnvironmentWithMeshNetwork<R>

Creates a grid environment with Moore connections between nodes.

Link copied to clipboard
fun <R> vonNeumannGrid(sizeX: Int, sizeY: Int, initial: R, program: Aggregate<Int>.(Environment<R>) -> R): EnvironmentWithMeshNetwork<R>
fun <R> vonNeumannGrid(sizeX: Int, sizeY: Int, initial: (Environment<R>, Position) -> R, program: Aggregate<Int>.(Environment<R>) -> R): EnvironmentWithMeshNetwork<R>

Creates a grid environment with Von Neumann connections between nodes.