Skip to content

Commit

Permalink
Merge branch 'mobile-compatible' of git+ssh://github.com/sayansil/Eco…
Browse files Browse the repository at this point in the history
…system into mobile-compatible
  • Loading branch information
DarkStar1997 committed May 30, 2023
2 parents f7b103b + a975007 commit 3412214
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
17 changes: 17 additions & 0 deletions docs/privacy_policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<h1>Privacy Policy for Ecosystem Simulator</h1>

In Ecosystem Simulator, one of our main priorities is the privacy of our user. This Privacy Policy document contains types of information that is collected and recorded by Ecosystem Simulator and how we use it.

If you have additional questions or require more information about our Privacy Policy, do not hesitate to contact us.

<h2>Consent</h2>

By using our software, you hereby consent to our Privacy Policy and agree to its terms.

<h2>Information we collect</h2>

None

<h2>Contact Us</h2>

If you have any questions or suggestions about our Privacy Policy, do not hesitate to [contact us](mailto:[email protected]).
5 changes: 3 additions & 2 deletions simulation/RandomTests/test1.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ int main() {
add_current_world_record(session);
}

struct FloatData fData = get_plot_attribute(session, "deer", "population");
struct FloatData fData =
get_plot_values(session, "deer", "weight_on_speed");
for (size_t i = 0; i < fData.length; i++) {
printf("%f\n", fData.data[i]);
}

fData = get_plot_attribute(session, "bamboo", "population");
fData = get_plot_values(session, "bamboo", "population");
for (size_t i = 0; i < fData.length; i++) {
printf("%f\n", fData.data[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion simulation/include/ecosystem_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ EXPORT_C struct BufferData happy_new_year(void *session_ptr);
EXPORT_C const char *get_world_instance(void *session_ptr);
EXPORT_C const char* get_plot_attributes(void *session_ptr);
EXPORT_C void add_current_world_record(void *session_ptr);
EXPORT_C struct FloatData get_plot_attribute(void *session_ptr, const char* species_name, const char* attribute_name);
EXPORT_C struct FloatData get_plot_values(void *session_ptr, const char* species_name, const char* attribute_name);
EXPORT_C void free_god(void *session_ptr);
EXPORT_C void free_session(void *session_ptr);

Expand Down
4 changes: 2 additions & 2 deletions simulation/run/simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ void Simulation::run_ecosystem_simulation() {
{
flatbuffers::ToStringVisitor visitor("", true, "", true);
flatbuffers::IterateFlatBuffer(
allah.population_stats.data(), Ecosystem::WorldPopulationTypeTable(),
&visitor);
allah.population_stats.data(),
Ecosystem::WorldPopulationTypeTable(), &visitor);
nlohmann::json json_data = nlohmann::json::parse(visitor.s);

nlohmann::json formatted_json;
Expand Down
10 changes: 6 additions & 4 deletions simulation/src/ecosystem_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,15 @@ const char *get_plot_attributes(void *session_ptr) {
if (session_ptr != nullptr) {
SessionHandler *session =
reinterpret_cast<SessionHandler *>(session_ptr);
session->stringData = "";
session->stringData = "population,";

/* Extract species population attributes */

const flatbuffers::TypeTable *type_table =
Ecosystem::SpeciesPopulationTypeTable();
for (size_t i = 0; i < type_table->num_elems; i++) {
// Starts from index 2 to avoid kind and kingdom attributes to be
// included in the plot attribute list.
for (size_t i = 2; i < type_table->num_elems; i++) {
session->stringData += type_table->names[i];
session->stringData += ",";
}
Expand Down Expand Up @@ -166,8 +168,8 @@ const char *get_plot_attributes(void *session_ptr) {
return "";
}

struct FloatData get_plot_attribute(void *session_ptr, const char *species_name,
const char *attribute_name) {
struct FloatData get_plot_values(void *session_ptr, const char *species_name,
const char *attribute_name) {
if (session_ptr != nullptr) {
SessionHandler *session =
reinterpret_cast<SessionHandler *>(session_ptr);
Expand Down
2 changes: 1 addition & 1 deletion simulation/src/stat_fetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ FBuffer create_avg_world(const flatbuffers::DetachedBuffer &world_buffer) {
auto asleep = species->organism()->Get(0)->asleep(); // dummy
auto monitor = species->organism()->Get(0)->monitor(); // dummy

std::vector<uint8_t> chromosome_vec; // dummy
std::vector<uint8_t> chromosome_vec; // dummy
auto chromosome = new_builder.CreateVector(chromosome_vec.data(),
chromosome_vec.size());

Expand Down

0 comments on commit 3412214

Please sign in to comment.