Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/KarmaKamikaze/FCDS into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarmisuper committed May 21, 2021
2 parents 764bc91 + 7068041 commit 152bcdc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions node/PublicResources/js/graphHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class CyGraph {
idleZones = new Array();
obstructions = new Array();

/**
* Resets the simulation stats, allowing for a simulation restart
*/
reset() {
this.courierCount = 0;
this.simulationStats = new SimStats();
Expand Down
8 changes: 8 additions & 0 deletions node/PublicResources/js/orderGeneration.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ function findCourier(cyGraph, order) {
return bestCourier;
}

/**
* Stops the simulation, logging stats in the console.
* @param {Class} cyGraph The simulation object.
*/
function stopSimulation(cyGraph) {
clearInterval(cyGraph.simHandler);
console.log(
Expand Down Expand Up @@ -364,6 +368,10 @@ function stopSimulation(cyGraph) {
);
}

/**
* Restarts the simulation, allowing for endless loops of a certain amount of simulation days.
* @param {Class} cyGraph The simulation object.
*/
function restartSimulation(cyGraph) {
cyGraph.numSimulations++;
cyGraph.reset();
Expand Down

0 comments on commit 152bcdc

Please sign in to comment.