Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Romain De Laage De Bellefaye
LO21-projet
Commits
a4657083
Verified
Commit
a4657083
authored
Jun 12, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Add nbStep and nbCycle
parent
743c41e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
includes/Automate.h
View file @
a4657083
...
...
@@ -26,8 +26,10 @@ class Automate {
std
::
string
author
;
std
::
string
desc
;
EnsembleEtat
ensemble
;
int
nbStep
;
int
nbCycle
;
Automate
()
:
title
(
""
),
delai
(
500
),
fonction
(
nullptr
),
regleVoisinage
(
nullptr
),
itBuffer
(
buffer
.
begin
()),
h
(
0
),
l
(
0
),
reseauInit
(
Reseau
(
0
,
0
)),
year
(
2000
),
author
(
"Anonym"
),
desc
(
""
)
{
timer
.
automate
=
this
;
}
Automate
()
:
title
(
""
),
delai
(
500
),
fonction
(
nullptr
),
regleVoisinage
(
nullptr
),
itBuffer
(
buffer
.
begin
()),
h
(
0
),
l
(
0
),
reseauInit
(
Reseau
(
0
,
0
)),
year
(
2000
),
author
(
"Anonym"
),
desc
(
""
)
,
nbStep
(
0
),
nbCycle
(
0
)
{
timer
.
automate
=
this
;
}
Automate
(
const
Automate
&
a
)
=
delete
;
Automate
&
operator
=
(
const
Automate
&
a
)
=
delete
;
class
Timer
:
public
QObject
{
...
...
@@ -107,12 +109,7 @@ class Automate {
void
reset
()
{
buffer
.
clear
();
buffer
.
push_back
(
reseauInit
);
}
/// Se placer sur l'état suivant du buffer et le calculer s'il n'y en a plus de disponible
void
step
()
{
if
(
itBuffer
==
(
--
buffer
.
end
()))
nextTimer
();
itBuffer
++
;
AutoCell
::
getInstance
().
afficherGrille
(
&*
itBuffer
);
}
void
step
();
/// Execution multiple de la méthode step
void
run
(
int
n
)
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
...
...
@@ -160,6 +157,9 @@ class Automate {
/// Définir le comportement aux frontières
void
setMatriceTorique
(
const
bool
val
)
{
regleVoisinage
->
setMatriceTorique
(
val
);
}
bool
getMatriceTorique
()
{
return
regleVoisinage
->
getMatriceTorique
();
}
int
getNbStep
()
const
{
return
nbStep
;
}
int
getNbCycle
()
const
{
return
nbCycle
;
}
};
#endif
src/Automate.cpp
View file @
a4657083
...
...
@@ -44,3 +44,14 @@ void Automate::reinitialiserAutomate() {
desc
=
""
;
ensemble
.
reset
();
}
void
Automate
::
step
()
{
if
(
itBuffer
==
(
--
buffer
.
end
()))
{
nextTimer
();
++
nbStep
;
}
itBuffer
++
;
if
(
nbCycle
==
0
&&
*
(
--
buffer
.
end
())
==
reseauInit
)
nbCycle
=
nbStep
;
AutoCell
::
getInstance
().
afficherGrille
(
&*
itBuffer
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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