Education and Outreach Blog

« Back

HPC University Bi-Weekly Challenge - JavaScript Diffusion, Limited Aggregation

RELEASE DATE:  August 10, 2015

SUMMARY:
Your task is to use HTML and JavaScript to create a version of an
existing AgentSheets/Java model.

QUESTION:
Your task is to implement an HTML/JavaScript version of Shodor's
"Diffusion, Limited Aggregation" AgentSheets model
(http://shodor.org/…/DiffusionLimitedAggregationA…/index.html).

Your program should have buttons to play, pause, step, and reset the simulation. There should also be a selection menu 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 "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.

SOLUTION:
Will be posted August 17, 2015.

LINK:
http://hpcuniversity.org/students/weeklyChallenge/105/

Comments
Trackback URL:

No comments yet. Be the first.