@@ -107,6 +107,7 @@ class People_C {//constructor
107
107
} else if ( this . all [ r ] [ c ] . dead ) {
108
108
this . all [ r ] [ c ] . setColor ( color ( colors . WHITE ) ) ;
109
109
} else if ( this . all [ r ] [ c ] . sick >= 10 ) {
110
+ console . log ( this . all [ r ] [ c ] )
110
111
this . all [ r ] [ c ] . setColor ( color ( colors . RED ) ) ;
111
112
} else if ( this . all [ r ] [ c ] . sick == 0 ) {
112
113
this . all [ r ] [ c ] . setColor ( color ( colors . BLUE ) ) ;
@@ -152,9 +153,10 @@ class People_C {//constructor
152
153
spreadDisease ( People , conti ) {
153
154
if ( ! this . startDisease && People ) { //false enter the loop
154
155
let a = random ( this . nb_rows ) , b = random ( this . nb_cols )
155
- const patientZero = this . all [ a ] [ b ] . sick
156
+ console . log ( a , b )
157
+ let patientZero = this . all [ a ] [ b ] . sick
158
+
156
159
this . vaccinate ( )
157
- // console.log("TCL: People_kC -> spreadDisease -> patientZero", a, b)
158
160
if ( this . all [ a ] [ b ] . Vaccinate ) return People . spreadDisease ( )
159
161
this . all [ a ] [ b ] . sick = 10 ;
160
162
this . NBInfected ++
@@ -202,7 +204,7 @@ class People_C {//constructor
202
204
x2 = neighbour [ 0 ]
203
205
y2 = neighbour [ 1 ]
204
206
//fix the issue with the y2 don't exist if we select the Nomber of rows and column is different.
205
- if ( this . all [ x2 ] && ! this . all [ x2 ] [ y2 ] . Vaccinate && this . all [ x2 ] [ y2 ] . sick === 0 && this . all [ x2 ] [ y2 ] ) {
207
+ if ( this . all [ x2 ] && this . all [ x2 ] [ y2 ] && ! this . all [ x2 ] [ y2 ] . Vaccinate && this . all [ x2 ] [ y2 ] . sick === 0 && this . all [ x2 ] [ y2 ] ) {
206
208
this . all [ x2 ] [ y2 ] . sick = 10 ;
207
209
this . NBInfected = this . NBInfected + 1
208
210
@@ -286,11 +288,13 @@ function draw() {
286
288
}
287
289
function run ( ) {
288
290
conti = true
291
+ setup ( ) ;
292
+ draw ( ) ;
289
293
290
294
// console.log("TCL: run -> run")
291
295
loop ( ) ;
292
296
}
293
297
294
- function reload ( ) {
295
- setup ( ) ;
296
- }
298
+ // function reload() {
299
+ // setup();
300
+ // }
0 commit comments