Skip to content

Commit e382e73

Browse files
Courssumm02Courssumm02
Courssumm02
authored and
Courssumm02
committed
README
1 parent 00e1fd0 commit e382e73

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

Module Extra 6/app.js

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
function main(){
22

3-
const N_CLONES = 45**2
3+
const N_CLONES = 42**2
44
const N_GEN = 50000
5-
const infect_rate = 0.0002
6-
const initial_infection_rate = 0.001
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
5+
const infect_rate = 0.0001
6+
const initial_infection_rate = 0.0001
7+
const transmission_rate = 0.9
8+
const vaccine_transmission_rate = 0.05
9+
const vaccine_taking_rate = 0.0002
10+
const double_days = 1
11+
const infected_time = 4
12+
const post_time=30
13+
const vaccine_shield_days = 100
14+
const D = 1
1515
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
1616
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
1717

@@ -31,11 +31,13 @@ function main(){
3131
grid[i].infected_time = 0
3232
grid[i].vaccine_days=0
3333
grid[i].double_days=0
34+
grid[i].is_double=false
3435
}else{
3536
grid[i].type = "neutral"
3637
grid[i].infected_time = 0
3738
grid[i].vaccine_days=0
3839
grid[i].double_days=0
40+
grid[i].is_double=false
3941

4042
}
4143
}
@@ -75,15 +77,20 @@ function main(){
7577
if (your_mate.type == "infected" && you.type=="neutral" && Math.random() < transmission_rate){
7678
you.type = "infected"
7779
}
78-
// if (your_mate.type == "infected" && you.type=="infected"){
79-
// you.type = "double"
80-
// }
80+
81+
if (your_mate.type == "infected" && you.type=="infected"){
82+
you.is_double = true
83+
}
8184
// TODo
8285
if (you.type=="double"){
8386
you.double_days++
8487
if (you.double_days==double_days){
88+
you.is_double=false
8589
you.type="unneutral"
8690
you.double_days=0
91+
you.infected_time=0
92+
}else{
93+
you.infected_time-=1
8794
}
8895
}
8996
if (your_mate.type == "infected" && you.type=="vaccine" && Math.random() < vaccine_transmission_rate){
@@ -136,7 +143,7 @@ function main(){
136143
if (el.type=="neutral"){
137144
row.push("neutral")
138145
}
139-
if (el.type=="infected"){
146+
if (el.type=="infected"&& !el.is_double){
140147
row.push("infected")
141148
}
142149
if (el.type=="post"){
@@ -148,8 +155,9 @@ function main(){
148155
if (el.type=="vaccine"){
149156
row.push("vaccine")
150157
}
151-
if (el.type=="double"){
158+
if (el.is_double && el.type=="infected"){
152159
row.push("double")
160+
console.log("dob");
153161
}
154162

155163
}

Module Extra 6/util.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)