Skip to content

Commit

Permalink
Ajout des stats
Browse files Browse the repository at this point in the history
  • Loading branch information
begarco committed Nov 18, 2015
1 parent 96ca0c6 commit f3aa691
Show file tree
Hide file tree
Showing 96 changed files with 1,772 additions and 179 deletions.
12 changes: 9 additions & 3 deletions GameOfRabbits.depend
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
<random>
<iostream>

1447881519 source:o:\onedrive\github\simulation_lapins\lapinmanager.cpp
1447885210 source:o:\onedrive\github\simulation_lapins\lapinmanager.cpp
"LapinManager.h"

1447880109 o:\onedrive\github\simulation_lapins\lapinmanager.h
1447885096 o:\onedrive\github\simulation_lapins\lapinmanager.h
<vector>
<random>
<iostream>
<fstream>
"ClasseLapins.h"

1447880115 source:o:\onedrive\github\simulation_lapins\main.cpp
1447884425 source:o:\onedrive\github\simulation_lapins\main.cpp
<iostream>
<ostream>
<algorithm>
Expand All @@ -26,4 +26,10 @@
<cstring>
<string>
"LapinManager.h"
"Student.h"

1447883199 source:o:\onedrive\github\simulation_lapins\student.cpp
"Student.h"

1447883584 o:\onedrive\github\simulation_lapins\student.h

6 changes: 6 additions & 0 deletions LapinManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,9 @@ void LapinManager::reset() { // remise a zero pour refaire une simu
m_males[12].nombre(1);
m_femelles[12].nombre(1);
}

void LapinManager::write(long double p_number) {
if(m_file.is_open())
m_file << p_number << endl;
}

6 changes: 6 additions & 0 deletions LapinManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ class LapinManager {
* \fn void reset()
*/
void reset();
/**
* \brief Ecrit un nombre dans le fichier
* \fn void write(long double p_number)
* \param p_number : nombre a ecrire
*/
void write(long double);
};

#endif
6 changes: 6 additions & 0 deletions LapinManagerI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,9 @@ void LapinManager::reset() { // remise a zero pour refaire une simu
m_males[12].nombre(1);
m_femelles[12].nombre(1);
}

void LapinManager::write(long double p_number) {
if(m_file.is_open())
m_file << p_number << endl;
}

6 changes: 6 additions & 0 deletions LapinManagerI.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ class LapinManager {
* \fn void reset()
*/
void reset();
/**
* \brief Ecrit un nombre dans le fichier
* \fn void write(long double p_number)
* \param p_number : nombre a ecrire
*/
void write(long double);
};

#endif
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# definition des variables
CXX = g++
CXXFLAGS = -O2 -Wall -Wextra -g -std=c++11
OBJ = main.o ClasseLapins.o LapinManager.o
OBJI = mainI.o ClasseLapinsI.o LapinManagerI.o
OBJ = main.o ClasseLapins.o LapinManager.o Student.o
OBJI = mainI.o ClasseLapinsI.o LapinManagerI.o Student.o

GameOfRabbits : $(OBJ)
$(CXX) $^ -o ./$@ $(CXXFLAGS) -lm
Expand All @@ -19,6 +19,9 @@ ClasseLapins.o : ClasseLapins.cpp ClasseLapins.h
LapinManager.o : LapinManager.cpp LapinManager.h
$(CXX) -c $< -o $@ $(CXXFLAGS)

Student.o : Student.cpp Student.h
$(CXX) -c $< -o $@ $(CXXFLAGS)

GameOfRabbitsI : $(OBJI)
$(CXX) $^ -o ./$@ $(CXXFLAGS) -lm

Expand Down
79 changes: 79 additions & 0 deletions Student.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
*
* \file Student.cpp
* \brief Loi de Student.
* \author Benoit GARCON
* \author Benjamin BARBESANGE
* \version 1.0
* \date 20 Novembre 2015
*
* Permet d'utiliser la loi de Student.
*
*/

#include "Student.h"

Student::Student() {
/* -------------------------------------------------------------------- */
/* constructor Genere une "table de Student" a alpha = 5% */
/* */
/* En entree: void */
/* */
/* En sortie: void */
/* -------------------------------------------------------------------- */
// Tableau statique des 30 premieres valeurs
values_ = new double[30];
values_[0] = 12.706; values_[1] = 4.303; values_[2] = 3.182; values_[3] = 2.776; values_[4] = 2.571;
values_[5] = 2.447; values_[6] = 2.365; values_[7] = 2.308; values_[8] = 2.262; values_[9] = 2.228;
values_[10] = 2.201; values_[11] = 2.179; values_[12] = 2.160; values_[13] = 2.145; values_[14] = 2.131;
values_[15] = 2.120; values_[16] = 2.110; values_[17] = 2.101; values_[18] = 2.093; values_[19] = 2.086;
values_[20] = 2.080; values_[21] = 2.074; values_[22] = 2.069; values_[23] = 2.064; values_[24] = 2.060;
values_[25] = 2.056; values_[26] = 2.052; values_[27] = 2.048; values_[28] = 2.045; values_[29] = 2.042;

// Equation de droites pour approximation
coeff_40_30_ = (2.021-2.042)/(double)(40-30); off_40_30 = 2.042 - (30. * coeff_40_30_);
coeff_80_40_ = (2.000-2.021)/(double)(80-40); off_80_40 = 2.021 - (40. * coeff_80_40_);
coeff_120_80_ = (1.980-2.00)/(double)(120-80); off_120_80 = 2.00 - (80. * coeff_120_80_);

infty_ = 1.960;
}

Student::~Student(){
/* -------------------------------------------------------------------- */
/* destructor Libere la memoire de la "table de Student" */
/* */
/* En entree: void */
/* */
/* En sortie: void */
/* -------------------------------------------------------------------- */
if(values_) {
delete [] values_;
}
}

double Student::getQuantile(int p_degre_liberte) {
/* -------------------------------------------------------------------- */
/* getQuantile Permet de recuperer le quantile pour n experiences */
/* */
/* En entree: p_degre_liberte : un entier */
/* */
/* En sortie: double */
/* -------------------------------------------------------------------- */
double quantile = 0.;

if(p_degre_liberte > 0) {
if(p_degre_liberte < 31) {
quantile = values_[p_degre_liberte - 1];
} else if (p_degre_liberte < 41) {
quantile = p_degre_liberte * coeff_40_30_ + off_40_30;
} else if (p_degre_liberte < 81) {
quantile = p_degre_liberte * coeff_80_40_ + off_80_40;
} else if (p_degre_liberte <= 120) {
quantile = p_degre_liberte * coeff_120_80_ + off_80_40;
} else {
quantile = infty_;
}
}
return quantile;
}

62 changes: 62 additions & 0 deletions Student.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
*
* \file Student.cpp
* \brief Loi de Student.
* \author Benoit GARCON
* \author Benjamin BARBESANGE
* \version 1.0
* \date 20 Novembre 2015
*
* Permet d'utiliser la loi de Student.
*
*/

#ifndef STUDENT_H
#define STUDENT_H

/**
*
* \class Student
* \brief Classe de la loi de Student.
*
* Loi de Student pour les quantiles.
*
*/
class Student {
protected:
/// Valeurs de 1 a 30
double * values_,
/// Valeurs 30 a 40
coeff_40_30_,
/// Valeurs 30 a 40
off_40_30,
/// Valeurs 40 a 80
coeff_80_40_,
/// Valeurs 40 a 80
off_80_40,
/// Valeurs 80 a 120
coeff_120_80_,
/// Valeurs 80 a 120
off_120_80,
/// Valeurs a l'infini
infty_;

public:
/**
* \brief Constructeur de la classe Student.
*/
Student();
/**
* \brief Destructeur de la classe Student.
*/
~Student();
/**
* \brief Permet de recuperer le quantile pour n experiences.
* \fn double getQuantile(int p_nbExp)
* \param p_nbExp : entier donnant le nombre d'experiences
* \return Double representant le quantile demande.
*/
double getQuantile(int);
};

#endif // STUDENT_H
Binary file modified bin/Debug/GameOfRabbits.exe
Binary file not shown.
6 changes: 4 additions & 2 deletions doxygen/doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ WARN_LOGFILE = "O:\OneDrive\GitHub\Simulation_Lapins\doxygen\doxygen.
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = \
"..\ClasseLapins.h" \
"..\LapinManager.cpp" \
"..\Student.cpp" \
"..\LapinManager.h" \
"..\ClasseLapins.h" \
"..\main.cpp" \
"..\LapinManager.cpp" \
"..\Student.h" \
"..\ClasseLapins.cpp"
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
Expand Down
8 changes: 4 additions & 4 deletions doxygen/doxygen.log
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
O:/OneDrive/GitHub/Simulation_Lapins/main.cpp:35: warning: argument 'option' of command @param is not found in the argument list of main(int argc, char **argv)
O:/OneDrive/GitHub/Simulation_Lapins/main.cpp:35: warning: argument 'int_1' of command @param is not found in the argument list of main(int argc, char **argv)
O:/OneDrive/GitHub/Simulation_Lapins/main.cpp:35: warning: argument 'int_2' of command @param is not found in the argument list of main(int argc, char **argv)
O:/OneDrive/GitHub/Simulation_Lapins/main.cpp:44: warning: The following parameters of main(int argc, char **argv) are not documented:
O:/OneDrive/GitHub/Simulation_Lapins/main.cpp:36: warning: argument 'option' of command @param is not found in the argument list of main(int argc, char **argv)
O:/OneDrive/GitHub/Simulation_Lapins/main.cpp:36: warning: argument 'int_1' of command @param is not found in the argument list of main(int argc, char **argv)
O:/OneDrive/GitHub/Simulation_Lapins/main.cpp:36: warning: argument 'int_2' of command @param is not found in the argument list of main(int argc, char **argv)
O:/OneDrive/GitHub/Simulation_Lapins/main.cpp:45: warning: The following parameters of main(int argc, char **argv) are not documented:
parameter 'argc'
parameter 'argv'
O:/OneDrive/GitHub/Simulation_Lapins/LapinManager.h:67: warning: The following parameters of LapinManager::simulation(unsigned long long p_mois=120, bool p_affichage=false, bool p_fileOut=true) are not documented:
Expand Down
2 changes: 1 addition & 1 deletion doxygen/html/_classe_lapins_8cpp.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="_classe_lapins_8cpp.html">ClasseLapins.cpp</a></li>
<li class="footer">Generated on Wed Nov 18 2015 00:07:01 for GameOfRabbits by
<li class="footer">Generated on Wed Nov 18 2015 23:22:15 for GameOfRabbits by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.10 </li>
</ul>
Expand Down
16 changes: 8 additions & 8 deletions doxygen/html/_classe_lapins_8h.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#define-members">Macros</a> </div>
<a href="#typedef-members">Typedefs</a> </div>
<div class="headertitle">
<div class="title">ClasseLapins.h File Reference</div> </div>
</div><!--header-->
Expand All @@ -123,12 +123,12 @@
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Classe d'age de la population de lapins. <a href="class_classe_lapins.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a91d43eadec33c80149f92e5abf5df58c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a91d43eadec33c80149f92e5abf5df58c"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_classe_lapins_8h.html#a91d43eadec33c80149f92e5abf5df58c">INTEGER</a>&#160;&#160;&#160;long double</td></tr>
<tr class="memdesc:a91d43eadec33c80149f92e5abf5df58c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Definition du type de comptage. <br /></td></tr>
<tr class="separator:a91d43eadec33c80149f92e5abf5df58c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a0391012cd99f054647804c6a44d6f53b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0391012cd99f054647804c6a44d6f53b"></a>
typedef long double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_classe_lapins_8h.html#a0391012cd99f054647804c6a44d6f53b">INTEGER</a></td></tr>
<tr class="memdesc:a0391012cd99f054647804c6a44d6f53b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Definition du type de comptage. <br /></td></tr>
<tr class="separator:a0391012cd99f054647804c6a44d6f53b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Classe statistique de lapins du meme age. </p>
Expand All @@ -144,7 +144,7 @@
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="_classe_lapins_8h.html">ClasseLapins.h</a></li>
<li class="footer">Generated on Wed Nov 18 2015 00:07:01 for GameOfRabbits by
<li class="footer">Generated on Wed Nov 18 2015 23:22:15 for GameOfRabbits by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.10 </li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion doxygen/html/_classe_lapins_8h.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var _classe_lapins_8h =
[
[ "ClasseLapins", "class_classe_lapins.html", "class_classe_lapins" ],
[ "INTEGER", "_classe_lapins_8h.html#a91d43eadec33c80149f92e5abf5df58c", null ]
[ "INTEGER", "_classe_lapins_8h.html#a0391012cd99f054647804c6a44d6f53b", null ]
];
Loading

0 comments on commit f3aa691

Please sign in to comment.