diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f66666c --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +CCPP = g++ +CFLAGS = -I. -Wall -Wextra -fanalyzer --std=c++17 +CFLAGS2 = -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter + +SOURCES = $(shell find . -name '*.cpp') +OBJECTS = $(SOURCES:.cpp=.o) + +NOM = ecosyteme + +%.o: %.cpp + $(CCPP) -c -o $@ $< $(CFLAGS) $(CFLAGS2) + +main: $(OBJECTS) + $(CCPP) -o $(NOM) $^ $(CFLAGS) $(CFLAGS2) + +all: + main + +clean: + rm *.o $(NOM) diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..8f72fa4 --- /dev/null +++ b/main.cpp @@ -0,0 +1,35 @@ +#include +#include + +#include "univers.hpp" + +void lancerSimulation(int m, int n, int nb_moutons, int nb_loups) { + Univers univers(m, n); +} + +/* m x n = taille de l'univers + * nb_moutons = nombre de moutons + * nb_loups = nombre de loups */ +int main(int argc, char const *argv[]) { + if(argc > 1 && argc != 5) { + std::cerr << "Arguments non renseignés." << std::endl; + std::cout << "Usage : " << argv[0] << " m n nb_moutons nb_loups" << std::endl; + exit(1); + } + int m, n, nb_moutons, nb_loups; + if(argc == 5) { // renseigné par l'utilisateur + m = std::stoi(argv[1]); + n = std::stoi(argv[2]); + nb_moutons = std::stoi(argv[3]); + nb_loups = std::stoi(argv[4]); + } else { // valeurs par défaut + m = 5; + n = 5; + nb_moutons = 7; + nb_loups = 2; + } + + lancerSimulation(m, n, nb_moutons, nb_loups); + + return 0; +} diff --git a/univers.cpp b/univers.cpp new file mode 100644 index 0000000..b5149f9 --- /dev/null +++ b/univers.cpp @@ -0,0 +1,3 @@ +#include "univers.hpp" + +Univers::Univers(int m, int n): _m(m), _n(n) { } diff --git a/univers.hpp b/univers.hpp new file mode 100644 index 0000000..9fc413a --- /dev/null +++ b/univers.hpp @@ -0,0 +1,11 @@ +#ifndef _UNIVERS_HPP_ +#define _UNIVERS_HPP_ 1 + +class Univers { + int _m, _n, _tour; + + public: + Univers(int, int); +}; + +#endif