Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
HoubkneghteS committed Dec 12, 2017
1 parent 4f18afb commit bb06d36
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
13 changes: 6 additions & 7 deletions engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ function imChange(number) {
start();
}


//changing birth rate
//changing death rate
function dChange(number) {
dRate += number;
if (dRate < 0) dRate = 0;
Expand All @@ -147,14 +146,13 @@ function dChange(number) {

//rendering the data
function start() {

//population tree
for(var i = 0; i < 100; i += 5) {
document.getElementById(i).innerHTML = sum(i, i+4) + ` (${i} - ${i+4})`;
document.getElementById(i).style.width = 20 + sum(i, i+4) / sum(0, pop.length) * 200 + "%";
innerHtml(i, sum(i, i+4) + ` (${i} - ${i+4})`);
document.getElementById(i).style.width = 22 + sum(i, i+4) / sum(0, pop.length) * 200 + "%";
}
document.getElementById("100").innerHTML = pop[100] + " (100+)";
document.getElementById(i).style.width = 20 + pop[100] / sum(0, pop.length) * 200 + "%";
document.getElementById(i).style.width = 22 + pop[100] / sum(0, pop.length) * 200 + "%";

//overall stats
innerHtml("death", "<b>Deaths:</b> " + deaths);
Expand Down Expand Up @@ -190,7 +188,8 @@ function simulate() {
for(var i = 18; i < 41; i++) {
mothers += pop[i]/2;
}
pop[0] += Math.ceil(mothers * bRate / 21.8);

pop[0] += Math.ceil(mothers * bRate / 21.8); //adds number to infant population
births = sum(0, pop.length) - deathPop; //calculates number of births

//calculates immigration
Expand Down
48 changes: 24 additions & 24 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@

/* for mobile support */
@media screen and (max-width: 1024px) {

body {
font-size: 230%;
}

button {
font-size: 1em;
}

input {
height:1.5em;
font-size:1em;
width:50%;
}

div.bar {
font-size:0.5em;
}

}

html {
background:navy;
}
Expand Down Expand Up @@ -73,4 +49,28 @@

div.o {
background:navy;
}

/* for mobile support */
@media screen and (max-width: 1024px) {

body {
font-size: 200%;
}

button {
font-size: 1em;
}

input {
height:1.5em;
font-size:1em;
width:50%;
}

div.bar {
font-size:50%;
height:auto;
}

}

0 comments on commit bb06d36

Please sign in to comment.