This shows you the differences between two versions of the page.
poo-ca-cd:teme:2025:8e211bfe-f6eb-467c-9e54-f8e6df4c1535:tema-1 [2025/10/04 01:30] ioana.tudorache2507 [Comenzi pentru simulare] |
poo-ca-cd:teme:2025:8e211bfe-f6eb-467c-9e54-f8e6df4c1535:tema-1 [2025/10/04 03:42] (current) ioana.tudorache2507 [printMap] |
||
---|---|---|---|
Line 51: | Line 51: | ||
- __Mediul evoluează automat__ – fenomene naturale care se petrec fără intervenția robotului | - __Mediul evoluează automat__ – fenomene naturale care se petrec fără intervenția robotului | ||
+ | * calitatea aerului, a solului și a apei se modifică în timp (în aceasta ordine) | ||
* plantele își schimbă starea (pot crește și se pot ofili) | * plantele își schimbă starea (pot crește și se pot ofili) | ||
* animalele se deplasează și își schimbă starea (consumă plante sau apă ca să nu fie flămânde) | * animalele se deplasează și își schimbă starea (consumă plante sau apă ca să nu fie flămânde) | ||
- | * calitatea aerului, a apei și a solului se modifică în timp | ||
- __TerraBot ia decizii și acționează__ – sub controlul comenzilor primite: | - __TerraBot ia decizii și acționează__ – sub controlul comenzilor primite: | ||
* se deplasează pe hartă | * se deplasează pe hartă | ||
Line 141: | Line 141: | ||
</code> | </code> | ||
</spoiler> | </spoiler> | ||
+ | |||
+ | \\ | ||
+ | |||
+ | === endSimulation=== | ||
+ | |||
+ | * marcheaza sfarsitul unei simulari | ||
+ | |||
+ | |||
+ | Mesaje posibile pentru aceasta comanda: | ||
+ | |||
+ | * ''%%"Simulation has ended."%%'' | ||
+ | * ''%%"ERROR: Simulation not started. Cannot perform action"%%'' | ||
+ | |||
+ | == Input == | ||
+ | |||
+ | <spoiler Click pentru input startSimulation> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "endSimulation", | ||
+ | "timestamp": 10 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | == Output == | ||
+ | |||
+ | <spoiler Click pentru output startSimulation> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "endSimulation", | ||
+ | "message": "Simulation has ended.", | ||
+ | "timestamp": 10 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | \\ | ||
==== Comenzi pentru mediu ==== | ==== Comenzi pentru mediu ==== | ||
+ | |||
+ | === changeWeatherConditions=== | ||
+ | |||
+ | * marcheaza un fenomen meteo care produce schimbari pentru aer | ||
+ | * Valorile posibile pentru tipul de schimbare meteo: | ||
+ | * desertStorm -> desert air | ||
+ | * peopleHiking -> mountain air | ||
+ | * newSeason -> temp air | ||
+ | * polarStorm -> polar air | ||
+ | * rainfall -> tropical air | ||
+ | |||
+ | <note important>Schimbarea meteo se ia in considerare **DOAR** pentru celulele ce au acel tip de aer</note> | ||
+ | |||
+ | Mesaje posibile pentru aceasta comanda: | ||
+ | |||
+ | * ''%%"The weather has changed."%%'' | ||
+ | * ''%%"ERROR: The weather change does not affect the environment. Cannot perform action"%%'' | ||
+ | * ''%%"ERROR: Simulation not started. Cannot perform action"%%'' | ||
+ | |||
+ | == Input == | ||
+ | |||
+ | <spoiler Click pentru input changeWeatherConditions> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "changeWeatherConditions", | ||
+ | "type": "desertStorm", | ||
+ | "windSpeed": 25.0, | ||
+ | "timestamp": 10 | ||
+ | }, | ||
+ | { | ||
+ | "command": "changeWeatherConditions", | ||
+ | "type": "rainfall", | ||
+ | "rainfall": 12.5, | ||
+ | "timestamp": 11 | ||
+ | }, | ||
+ | { | ||
+ | "command": "changeWeatherConditions", | ||
+ | "type": "peopleHiking", | ||
+ | "numberOfHikers": 40, | ||
+ | "timestamp": 12 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | == Output == | ||
+ | |||
+ | <spoiler Click pentru output changeWeatherConditions> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "changeWeatherConditions", | ||
+ | "message": "The weather has changed.", | ||
+ | "timestamp": 10 | ||
+ | }, | ||
+ | { | ||
+ | "command": "changeWeatherConditions", | ||
+ | "message": "The weather has changed.", | ||
+ | "timestamp": 11 | ||
+ | }, | ||
+ | { | ||
+ | "command": "changeWeatherConditions", | ||
+ | "message": "The weather has changed.", | ||
+ | "timestamp": 12 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | \\ | ||
==== Comenzi pentru TerraBot ==== | ==== Comenzi pentru TerraBot ==== | ||
==== Comenzi de debug ==== | ==== Comenzi de debug ==== | ||
+ | |||
+ | ==== getEnergyStatus==== | ||
+ | |||
+ | * returnează energia curenta a TerraBot-ului | ||
+ | |||
+ | Mesaje posibile pentru aceasta comanda: | ||
+ | |||
+ | * ''%%"TerraBot has ${energy_points} energy points left."%%'' | ||
+ | * ''%%"ERROR: Simulation not started. Cannot perform action"%%'' | ||
+ | |||
+ | == Input == | ||
+ | |||
+ | <spoiler Click pentru input getEnergyStatus> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "getEnergyStatus", | ||
+ | "timestamp": 8 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | == Output == | ||
+ | |||
+ | <spoiler Click pentru output getEnergyStatus> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "getEnergyStatus", | ||
+ | "message": "TerraBot has 189 energy points left.", | ||
+ | "timestamp": 8 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ==== printEnvConditions==== | ||
+ | |||
+ | |||
+ | * se printeaza pentru patratica curenta urmatoarele: | ||
+ | * tipul de planta, daca exista | ||
+ | * tipul de animal, daca exista | ||
+ | * tipul de sursa de apa, daca exista | ||
+ | * componenta solului | ||
+ | * componenta aerului | ||
+ | |||
+ | |||
+ | == Input == | ||
+ | |||
+ | <spoiler Click pentru input printEnvConditions> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "printEnvConditions", | ||
+ | "timestamp": 5 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | == Output == | ||
+ | |||
+ | <spoiler Click pentru output printEnvConditions> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "printEnvConditions", | ||
+ | "output" : { | ||
+ | "soil": { | ||
+ | "type": "ForestSoil", | ||
+ | "nitrogen": 3.2, | ||
+ | "waterRetention": 0.55, | ||
+ | "soilpH": 6.8, | ||
+ | "organicMatter": 0.4, | ||
+ | "leafLitter": 0.3 | ||
+ | }, | ||
+ | "plant": { | ||
+ | "type": "Algae", | ||
+ | "name": "RedAlgae", | ||
+ | }, | ||
+ | "animal": { | ||
+ | "type": "Herbivores", | ||
+ | "name": "Cow" | ||
+ | }, | ||
+ | "water": { | ||
+ | "type": "lake", | ||
+ | "purity": 92.0, | ||
+ | "salinity": 0.5, | ||
+ | "turbidity": 4, | ||
+ | "contaminantIndex": 1.5, | ||
+ | "pH": 6.8, | ||
+ | "isFrozen": false, | ||
+ | }, | ||
+ | "air": { | ||
+ | "type": "Tropical Air", | ||
+ | "mass": 1500000.0, | ||
+ | "humidity": 85.0, | ||
+ | "temperature": 30.5, | ||
+ | "oxygenLevel": 21, | ||
+ | "co2Level": 400.0 | ||
+ | } | ||
+ | }, | ||
+ | "timestamp": 5 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | \\ | ||
+ | ==== printMap==== | ||
+ | |||
+ | * se printeaza pentru fiecare patratica de pe harta urmatoarele: | ||
+ | * nr total enitati de pe patratica (sum(plant, animal, water_source)) | ||
+ | * calitate aerului | ||
+ | * calitatea solului | ||
+ | |||
+ | Mesaje posibile pentru aceasta comanda: | ||
+ | |||
+ | * ''%%"Simulation has ended."%%'' | ||
+ | * ''%%"ERROR: Simulation not started. Cannot perform action"%%'' | ||
+ | |||
+ | == Input == | ||
+ | |||
+ | <spoiler Click pentru input printMap> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "printMap", | ||
+ | "timestamp": 23 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | == Output == | ||
+ | |||
+ | <spoiler Click pentru output printMap> | ||
+ | <code json> | ||
+ | { | ||
+ | "command": "endSimulation", | ||
+ | "message": "Simulation has ended.", | ||
+ | "timestamp": 10 | ||
+ | } | ||
+ | </code> | ||
+ | </spoiler> | ||
+ | |||
+ | \\ | ||
+ | ==== printKnowledgeBase==== | ||
+ | |||
+ | * afiseaza pentru fiecare tip de obiect fact-urile invata | ||
+ | * exemplu: s-a scanat si invatat despre red algae, se printeaza toate facts despre red algae | ||
===== Exemplu simulare ===== | ===== Exemplu simulare ===== |