Skip to content
Snippets Groups Projects
Commit 19a4ba9d authored by Aymeric berthoumieu's avatar Aymeric berthoumieu
Browse files

Merge branch 'master' of...

parents fdf081b5 2a12c6ce
No related branches found
No related tags found
1 merge request!23Aymeric
......@@ -30,6 +30,12 @@ If you want to have access to the total number of animal in the aquarium, you wi
## Miscellaneous
### Documentation
You can find static diagrams for the whole system as well as sequence diagrams for some of the functionalities (implemented or not), in the docs directory.
### Template code for new coders
This repository contains a directory *templates* which contains some code templates to get a common base for the coding styles adopted while developing this project.
It is highly recommended to have a look at these files before coding here.
docs/Add at Runtime.jpg

101 KiB

docs/Decorators.jpg

256 KiB

docs/Die by collision.jpg

316 KiB

docs/Ecosysteme_full.jpg

1.2 MiB

docs/Factory.jpg

169 KiB

docs/Shell.jpg

123 KiB

docs/Singleton_KamikazeBehaviour.PNG

18.6 KiB

docs/Strategy.jpg

367 KiB

docs/population-initialisation&cloning-Cloning_of_a_decorated_pet.png

56.3 KiB

docs/population-initialisation&cloning.png

71.3 KiB

docs/simulation1.png

46.3 KiB

docs/simulation2.png

40.4 KiB

docs/singleton.jpg

82.9 KiB

......@@ -22,10 +22,12 @@ Aquarium::Aquarium( int width, int height, int _delay, int startingNbOfAnimals,
string kamikazeName = (KamikazeBehaviour::getBehaviourInstance())->getBehaviourName();
// TODO : fixer la liste des availableCaptorsAndAccessories
Statistics* statistics = new Statistics({"b_multiple", gregariousName, fearfulName, kamikazeName, Fin::getName(), Eyes::getName()});
//Statistics* statistics = new Statistics({"b_multiple", gregariousName, fearfulName, kamikazeName, Fin::getName(), Eyes::getName()});
Statistics* statistics = new Statistics({"b_multiple", gregariousName, fearfulName, kamikazeName, "a_None"});
// TODO : fixer la liste des availableCaptorsAndAccessories
AnimalFactory* factory = new PetFactory(width, height, animalsDistribution, {Fin::getName(), Eyes::getName()}, *statistics);
//AnimalFactory* factory = new PetFactory(width, height, animalsDistribution, {Fin::getName(), Eyes::getName()}, *statistics);
AnimalFactory* factory = new PetFactory(width, height, animalsDistribution, {"a_None"} , *statistics);
water = new Environment(width, height, startingNbOfAnimals, *factory, *statistics);
......
......@@ -41,7 +41,7 @@ int Environment::getHeight() const {
void Environment::step() {
++nb_steps; // increment the number of steps
cout << "[" << nb_steps << "]" << endl;
cout << "[step #" << nb_steps << "]" << endl;
statistics.saveData(); // save statistics of the previous step before doing the new one
cimg_forXY(*this, x, y)
......
......@@ -5,7 +5,7 @@
#include "Eyes.h"
#include <iterator>
#include <random>
#include <stdlib.h>
using namespace std;
......@@ -22,9 +22,7 @@ string choose_unchosen_element(const unordered_set<string> remaining_elements) {
string chosen_one;
// randomly choosing an index in remaining_elements
default_random_engine random_generator;
uniform_int_distribution<int> distribution(0, remaining_elements.size()-1);
int index = distribution(random_generator);
int index = rand() % remaining_elements.size();
auto it = remaining_elements.begin();
for (int _i=0; _i<index; _i++){
......@@ -42,9 +40,7 @@ unordered_set<string> choose_elements(const unordered_set<string> available_elem
// randomly choosing a number of elements to choose
// this number is bound by the number of elements in available_elements
default_random_engine random_generator;
uniform_int_distribution<int> distribution(0,available_elements.size());
int nb_to_choose = distribution(random_generator);
int nb_to_choose = rand() % available_elements.size();
for (int i=0; i<nb_to_choose; i++){
string chosen_elem;
......@@ -76,7 +72,7 @@ Animal* PetFactory::createMember(string behaviour) {
pet->setBehaviourAsMultiple();
}
else{
if (behaviour != "none"){
if (behaviour != "a_None"){
pet->setBehaviour(behaviour);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment