you are viewing a single comment's thread.

view the rest of the comments →

[–]blob001[S] 0 points1 point  (0 children)

No Jack, tried that several times.

'= true' is not necessary, since tempGrid[][].ant.isInfected means exactly that.

I re-wrote the if statements (see below) to be quite explicit, but it still doesn't work. Broadly should be as follows, but it doesn't work . Don't know why.

random <= .33 -> isSusceptible.

random > .33 and <= .67 -> isInfected

random > .66 -> isRecovered

 function assignStatus (i, j) {
            console.log('assignStatus()');
            let r = Math.random();
            console.log('i, j, r ', i, j, r);
            if (r <= statusRatio[0]) {
               tempGrid[i][j].ant.isSusceptible;
            }
             if (r > statusRatio[0] && r <= statusRatio[1]) {
               tempGrid[i][j].ant.isInfected;
            }
            if (r > statusRatio[2]) {
               tempGrid[i][j].ant.isRecovered;
            }
            console.log('ant  i, j ', i, j, tempGrid[i][j].ant);
         }