Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LO21_Pin_Noir_Boucher_Bouri_Detree
CellulutLO21
Commits
6b8c3596
Commit
6b8c3596
authored
Apr 19, 2021
by
Eugene Pin
Browse files
Update
#7
parent
2b464a26
Pipeline
#76605
passed with stages
in 16 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
include/neighborhood.hpp
View file @
6b8c3596
...
...
@@ -24,16 +24,20 @@ class Neighborhood {
//! \brief Vecteur de voisins contenant la position relative et l'état du voisin
vector
<
pair
<
Coord
,
State
>
>
neighborPositions
;
//! \brief Fonction vérifiant que la coordonnée d'un voisin que l'on souhaite ajouter dans le vecteur neighborPositions est unique
//! \param Coord : Coordonnée à comparer
//! \return retourne vrai si la coordonnée est unique sinon faux s'il existe un doublon
bool
Neighborhood
::
isUnique
(
const
Coord
c
)
const
;
public:
//! \brief Retourne le nombre de voisin ayant l'état définit en paramètre
//! \param State : Etat des voisins à rechercher
//! \return Le nombre de voisin
unsigned
int
getNb
(
State
state
);
unsigned
int
getNb
(
const
State
state
)
const
;
//! \brief Retourne l'état de la cellule voisine située à la coordonnée relative entrée en paramètre
//! \param Coordonnée du voisin à trouver
//! \return L'état de la cellule
State
getAt
(
Coord
c
);
State
getAt
(
const
Coord
c
)
const
;
//! \brief Ajoute un voisin au vecteur des voisins. Prend une coordonnée et un état en paramètre
//! \param Coord, State : coordonée relative et état du voisin
...
...
@@ -42,10 +46,6 @@ public:
neighborPositions
.
push_back
(
make_pair
(
c
,
s
));
}
//! \brief Fonction vérifiant que la coordonnée d'un voisin que l'on souhaite ajouter dans le vecteur neighborPositions est unique
//! \param Coord : Coordonnée à comparer
//! \return retourne vrai si la coordonnée est unique sinon faux s'il existe un doublon
bool
Neighborhood
::
isUnique
(
Coord
c
);
};
#endif // NEIGHBOURHOOD_HPP
\ No newline at end of file
src/neighborhood.cpp
View file @
6b8c3596
#include
"neighborhood.hpp"
unsigned
int
Neighborhood
::
getNb
(
State
state
)
unsigned
int
Neighborhood
::
getNb
(
State
state
)
const
{
unsigned
int
res
=
0
;
...
...
@@ -14,7 +14,7 @@ unsigned int Neighborhood::getNb(State state)
return
res
;
}
State
Neighborhood
::
getAt
(
Coord
c
)
State
Neighborhood
::
getAt
(
Coord
c
)
const
{
std
::
vector
<
pair
<
Coord
,
State
>
>::
iterator
it
;
for
(
it
=
neighborPositions
.
begin
();
it
!=
neighborPositions
.
end
();
++
it
)
{
...
...
@@ -27,7 +27,7 @@ State Neighborhood::getAt(Coord c)
//return ERROR;
}
bool
Neighborhood
::
isUnique
(
Coord
c
)
bool
Neighborhood
::
isUnique
(
Coord
c
)
const
{
std
::
vector
<
pair
<
Coord
,
State
>
>::
iterator
it
;
for
(
it
=
neighborPositions
.
begin
();
it
!=
neighborPositions
.
end
();
++
it
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment