Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-3-5-sonnet-20241022· AnthropicHugging Face LMArena Human Preference 140K

is there a simple javascript framework for discrete event simulation? I want to simulate…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with grok-3-mini-beta’s answer.
  1. User

    is there a simple javascript framework for discrete event simulation? I want to simulate a simple call center event. I'm looking for a framework which works in the browser and has interactive elements (graphs, sliders)

  2. Claude Assistant

    For browser-based discrete event simulation in JavaScript, I'd recommend looking at Simjs (sim.js) or SimPy.js. However, let me suggest a more specific solution combining a few tools that would work well for a call center simulation:

    1. Sim.js for the core simulation engine - it's lightweight and specifically designed for discrete event simulation
    2. D3.js for interactive visualizations
    3. noUiSlider for interactive parameter controls

    Here's a basic example of how you could structure this:

    // Basic Sim.js setup
    var sim = new Sim.Simulator();
    
    // Call Center Model
    var CallCenter = {
      servers: 3,  // number of agents
      maxQueueSize: 10,
      
      start: function() {
        this.facility = new Sim.Facility('agents', Sim.Facility.FCFS, this.servers);
        this.stats = new Sim.Population('queue');
      },
      
      arrive: function() {
        if (this.stats.current() < this.maxQueueSize) {
          this.facility.use(function() {
            // service time follows exponential distribution
            return rand.exponential(1/5);  // average 5 minutes
          });
        }
      }
    };
    
    // Add visualization
    const margin = {top: 20, right: 20, bottom: 30, left: 40};
    const width = 960 - margin.left - margin.right;
    const height = 500 - margin.top - margin.bottom;
    
    const svg = d3.select("body").append("svg")
        .attr("width", width + margin.left + margin.right)
        .attr("height", height + margin.top + margin.bottom);
    

    Would you like me to elaborate on any part of this setup or provide more specific examples for your use case? For instance, I could show how to add interactive controls or more detailed visualization code.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.