1
1
function main ( ) {
2
2
3
- const N_CLONES = 40 ** 2
3
+ const N_CLONES = 45 ** 2
4
4
const N_GEN = 50000
5
- const infect_rate = 0.00005
5
+ const infect_rate = 0.0002
6
6
const initial_infection_rate = 0.001
7
- const transmission_rate = 0.6
8
- const infected_time = 5
9
- const post_time = 30
10
- const D = 1
7
+ const transmission_rate = 0.7
8
+ const vaccine_transmission_rate = 0.01
9
+ const vaccine_taking_rate = 0.00003
10
+ const double_days = 4
11
+ const infected_time = 10
12
+ const post_time = 13
13
+ const vaccine_shield_days = 360
14
+ const D = 3
11
15
const gridx = Math . round ( Math . sqrt ( N_CLONES ) ) * Math . round ( Math . sqrt ( N_CLONES ) ) == N_CLONES ?Math . round ( Math . sqrt ( N_CLONES ) ) : Math . round ( Math . sqrt ( N_CLONES ) ) + 1
12
16
const gridy = Math . round ( Math . sqrt ( N_CLONES ) ) * Math . round ( Math . sqrt ( N_CLONES ) ) == N_CLONES ?Math . round ( Math . sqrt ( N_CLONES ) ) : Math . round ( Math . sqrt ( N_CLONES ) ) + 1
13
17
@@ -25,9 +29,14 @@ function main(){
25
29
if ( Math . random ( ) < initial_infection_rate ) {
26
30
grid [ i ] . type = "infected"
27
31
grid [ i ] . infected_time = 0
32
+ grid [ i ] . vaccine_days = 0
33
+ grid [ i ] . double_days = 0
28
34
} else {
29
35
grid [ i ] . type = "neutral"
30
36
grid [ i ] . infected_time = 0
37
+ grid [ i ] . vaccine_days = 0
38
+ grid [ i ] . double_days = 0
39
+
31
40
}
32
41
}
33
42
function getRandomInt ( min , max ) {
@@ -66,6 +75,20 @@ function main(){
66
75
if ( your_mate . type == "infected" && you . type == "neutral" && Math . random ( ) < transmission_rate ) {
67
76
you . type = "infected"
68
77
}
78
+ // if (your_mate.type == "infected" && you.type=="infected"){
79
+ // you.type = "double"
80
+ // }
81
+ // TODo
82
+ if ( you . type == "double" ) {
83
+ you . double_days ++
84
+ if ( you . double_days == double_days ) {
85
+ you . type = "unneutral"
86
+ you . double_days = 0
87
+ }
88
+ }
89
+ if ( your_mate . type == "infected" && you . type == "vaccine" && Math . random ( ) < vaccine_transmission_rate ) {
90
+ you . type = "infected"
91
+ }
69
92
if ( Math . random ( ) < infect_rate && you . type == "unneutral" ) {
70
93
you . type = "infected"
71
94
}
@@ -86,6 +109,18 @@ function main(){
86
109
you . infected_time = 0
87
110
}
88
111
}
112
+ if ( Math . random ( ) < vaccine_taking_rate ) {
113
+ you . type = "vaccine"
114
+ you . infected_time = 0
115
+ }
116
+ if ( you . type == "vaccine" ) {
117
+ you . vaccine_days ++
118
+ }
119
+ if ( you . vaccine_days == vaccine_shield_days ) {
120
+ you . type = "neutral"
121
+ you . vaccine_days = 0
122
+ you . infected_time = 0
123
+ }
89
124
new_grid . push ( you )
90
125
91
126
}
@@ -110,6 +145,12 @@ function main(){
110
145
if ( el . type == "unneutral" ) {
111
146
row . push ( "unneutral" )
112
147
}
148
+ if ( el . type == "vaccine" ) {
149
+ row . push ( "vaccine" )
150
+ }
151
+ if ( el . type == "double" ) {
152
+ row . push ( "double" )
153
+ }
113
154
114
155
}
115
156
visual . push ( row )
0 commit comments