-
Recent Posts
Recent Comments
- R.P. Churchill on TWSL Series 07: Discovery and Data Collection
- R.P. Churchill on A Simulationist’s Framework for Business Analysis: Round Two
- LN on A Simulationist’s Framework for Business Analysis: Round Two
- R.P. Churchill on Starting to Learn About the Java Memory Model
- R.P. Churchill on Multidimensional Arrays in Javascript
Categories
Meta
Daily Archives: September 12, 2016
A Simple Discrete-Event Simulation: Part 8
Today I automated the generation of entity IDs. First we create a basic counter.
1 2 3 4 |
var globalIDCounter = 0; function getNewID() { return ++globalIDCounter; } |
Then we change the entity declarations to remove the explicit assignment of IDs as we have been doing.
1 2 |
function entity1(initialTime,incrementTime,endTime) { this.entityID = getNewID(); |
That was pretty mindless, so let’s … Continue reading