Monday August 10, 2015
Your task is to use HTML and JavaScript to create a version of an existing AgentSheets/Java model.
Your task is to implement an HTML/JavaScript version of Shodor's "Diffusion Limited Aggregation" AgentSheets model (

Your program should have buttons to play, pause, step, and reset the simulation. There should also be a slider bar that allows the user to choose a "stickiness factor" between 0 and 100, inclusive (whole numbers only, default 100).

The model should start with one red particle in the center and 200 randomly placed blue particles in an environment that is 100 particles wide by 100 particles high. At each step in the simulation, each blue particle checks if it is next to a red particle (in either of the 8 directions found in a Moore neighborhood), and if it is, it becomes red if a random number between 0 and 100 is less than the global "stickiness factor." Otherwise, it moves randomly into an adjacent empty square.

Your program should print the current numbers of red and blue particles. When the number of blue particles reaches 0, the program should stop.

Optional: Add a slider bar to change the speed of the simulation.
Optional: Add color choosers for the two types of particles.
Show solution
Challenge Resources:
©1994-2022   |   Shodor   |   Privacy Policy   |   NSDL   |   XSEDE   |   Blue Waters   |   ACM SIGHPC   |   feedback  |   facebook   |   twitter   |   rss   |   youtube   |   XSEDE Code of Conduct   |   Not Logged In. Login