From 29d1ad4d5edf5c4b1968c0f1e432cdfc751d5d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Semid=C3=A1n=20Robaina=20Est=C3=A9vez?= Date: Sat, 8 Oct 2022 12:28:22 +0100 Subject: [PATCH] refactor --- index.html | 4 ++-- sketch.js => script.js | 9 ++++++--- styles.css | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) rename sketch.js => script.js (94%) diff --git a/index.html b/index.html index 2f8a34f..721309f 100644 --- a/index.html +++ b/index.html @@ -51,7 +51,7 @@
Producción máxima semillas
- +
200
@@ -80,7 +80,7 @@
- + diff --git a/sketch.js b/script.js similarity index 94% rename from sketch.js rename to script.js index 448a004..a6823a9 100644 --- a/sketch.js +++ b/script.js @@ -1,5 +1,5 @@ /* Una simulación sencilla del proceso de invasión de Nicotiana glauca en un ecosistema de cardones y tabaibas desarrollada para alumnado de 4º de ESO. - Semidan Robaina Estevez + Semidan Robaina Estevez, 2021 */ let suelo, glauca, cardon, tabaiba, plantImg, images; @@ -26,7 +26,7 @@ let plantParameters = { glauca: { energy_gain_rate: 0.25, reproductive_energy_threshold: 2, - max_life: 15, + max_life: 20, life_dev: 5, seed_success: 0.01, max_seed_production: 300, @@ -190,7 +190,10 @@ class Plant { this.p = plantParameters["suelo"]; } if (this.energy >= this.p.reproductive_energy_threshold) { - this.seeds = getRandomInt(this.p.max_seed_production - this.p.seed_production_dev, this.p.max_seed_production + this.p.seed_production_dev); + this.seeds = getRandomInt( + this.p.max_seed_production - this.p.seed_production_dev, + this.p.max_seed_production + this.p.seed_production_dev + ); this.energy = 0; } if (Math.round(this.seeds * this.p.seed_success) > 0) { diff --git a/styles.css b/styles.css index c2312d5..655484d 100644 --- a/styles.css +++ b/styles.css @@ -1,5 +1,5 @@ :root{ - --canvasSideLength: 38vw; + --canvasSideLength: 34vw; --plotWidth: 55vw; --backgroundColor: rgb(8, 8, 8); --fontColor: rgb(251, 251, 251); @@ -43,9 +43,9 @@ html { align-items: center; justify-content: center; width: 100vw; - height: 200px; + height: 150px; margin-left: 0vw; - margin-bottom: 0px; + margin-bottom: 50px; text-align: center; }