UNPKG

agentscape

Version:

Agentscape is a library for creating agent-based simulations. It provides a simple API for defining agents and their behavior, and for defining the environment in which the agents interact. Agentscape is designed to be flexible and extensible, allowing

28 lines 602 B
export default class FixedQueue { constructor(maxSize) { this.queue = []; this.maxSize = maxSize; } get size() { return this.queue.length; } asArray() { return this.queue; } enqueue(value) { if (this.queue.length >= this.maxSize) { this.queue.shift(); } this.queue.push(value); } dequeue() { return this.queue.shift(); } get(index) { return this.queue[index]; } forEach(callback) { this.queue.forEach(callback); } } //# sourceMappingURL=FixedQueue.js.map