Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Robaina committed Oct 8, 2022
1 parent 7ab0e86 commit 29d1ad4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div class="control_group">
<div class="slider_container">
<div class="slider_name">Producción máxima semillas</div>
<input class="slider" id="seed_production_slider" type="range" min="100" max="500" value="200" step="100" onchange="updateSeedProductionSliderText(this.value);">
<input class="slider" id="seed_production_slider" type="range" min="100" max="1000" value="200" step="100" onchange="updateSeedProductionSliderText(this.value);">
<div class="slider_value" id="seed_production_slider_text">200</div>
</div>

Expand Down Expand Up @@ -80,7 +80,7 @@
</footer>
</div>

<script src="sketch.js"></script>
<script src="script.js"></script>

</body>

Expand Down
9 changes: 6 additions & 3 deletions sketch.js → script.js
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root{
--canvasSideLength: 38vw;
--canvasSideLength: 34vw;
--plotWidth: 55vw;
--backgroundColor: rgb(8, 8, 8);
--fontColor: rgb(251, 251, 251);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 29d1ad4

Please sign in to comment.