Giter Site home page Giter Site logo

Comments (3)

scottpdo avatar scottpdo commented on May 27, 2024

Hi @AlonBenAriVA — I noticed two things that are causing issues.

  1. In your draw function, you have environment.tick(); commented out. This needs to run in order for the CanvasRenderer to draw anything to the screen.
  2. You are attempting to connect agents in the Network within the same for loop that adds agents to the Environment and Network in the first place. You should instead connect these agents after that initial for loop, like this:
function setup() {
  // get some agents
  for (let i = 0; i < nodeNum; i++) {
    const agent = new Agent();
    agent.set("size", 5);
    agent.set("color", "#F00");
    //agent.addRule(tick);
    //
    environment.addAgent(agent);
    network.addAgent(agent);
  }
  // after adding agents to the environment and network, add a few edges
  network.connect(network.get(1), network.get(2));
  network.connect(network.get(2), network.get(5));
  network.connect(network.get(0), network.get(0));
  network.connect(network.get(2), network.get(7));
}

Please let me know if this helps!

from flocc.

scottpdo avatar scottpdo commented on May 27, 2024

@AlonBenAriVA just wanted to check in again and see if my answer above helped with your issue.

from flocc.

scottpdo avatar scottpdo commented on May 27, 2024

Closing this due to inactivity.

from flocc.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.