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
LO21_Pin_Noir_Boucher_Bouri_Detree
CellulutLO21
Commits
b03fd11b
Commit
b03fd11b
authored
Jun 09, 2021
by
Yann Boucher
Browse files
Résolution d'un bug dans Automaton, qui inversait colonnes et lignes
parent
bd9afa91
Pipeline
#79531
passed with stages
in 17 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
include/property.hpp
View file @
b03fd11b
...
...
@@ -159,6 +159,28 @@ public:
std
::
string
str
;
};
/**
\class HelpProperty
\brief Représente un bouton permettant l'affichage d'un manuel.
**/
struct
HelpProperty
:
public
PropertyImpl
<
StringProperty
>
{
public:
//! \brief Constructeur par défaut.
HelpProperty
()
=
default
;
/** \brief Constructeur avec valeur initiale.
\param initval Valeur initiale.
**/
HelpProperty
(
const
std
::
string
&
initval
)
:
str
(
initval
)
{}
public:
//! \brief La chaîne de caractères contenant l'aide.
std
::
string
str
;
};
/**
\class IntegerProperty
...
...
include/propertyvisitors.hpp
View file @
b03fd11b
...
...
@@ -59,6 +59,7 @@ private:
void
visit
(
IntegerProperty
&
prop
);
void
visit
(
CoordinateProperty
&
prop
);
void
visit
(
PropertyList
&
list
);
void
visit
(
HelpProperty
&
);
private:
std
::
stack
<
QWidget
*>
m_widget_hierarchy
;
...
...
@@ -88,6 +89,7 @@ private:
void
visit
(
IntegerProperty
&
prop
);
void
visit
(
CoordinateProperty
&
prop
);
void
visit
(
PropertyList
&
list
);
void
visit
(
HelpProperty
&
)
{}
private:
std
::
stack
<
QVariant
>
m_current_hierarchy
;
...
...
@@ -114,6 +116,8 @@ private:
void
visit
(
IntegerProperty
&
prop
);
void
visit
(
CoordinateProperty
&
prop
);
void
visit
(
PropertyList
&
prop
);
void
visit
(
HelpProperty
&
)
{}
private:
std
::
stack
<
QJsonValue
>
m_current_hierarchy
;
};
...
...
include/transition_rules/totalistictransition.hpp
View file @
b03fd11b
...
...
@@ -130,6 +130,7 @@ private:
private:
mutable
std
::
vector
<
TotalisticRuleEntry
>
m_entries
;
DEFINE_CONFIGURABLE_PROPERTY
(
StringProperty
,
rule_string
,
"Rule String"
);
DEFINE_CONFIGURABLE_PROPERTY
(
HelpProperty
,
help_string
,
"All your base are belong to us"
);
};
#endif // TOTALISTICTRANSITIONRULE_HPP
src/automaton.cpp
View file @
b03fd11b
...
...
@@ -9,8 +9,8 @@ Automaton::~Automaton() {
void
Automaton
::
setAlphabet
(
const
Alphabet
&
A
)
{
alphabet
=
A
;
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
grid
.
get_
rows
());
++
i
)
{
for
(
int
j
=
0
;
j
<
static_cast
<
int
>
(
grid
.
get_
col
());
++
j
)
{
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
grid
.
get_
col
());
++
i
)
{
for
(
int
j
=
0
;
j
<
static_cast
<
int
>
(
grid
.
get_
rows
());
++
j
)
{
grid
.
set_cell
({
i
,
j
},
0
);
}
}
...
...
@@ -45,8 +45,8 @@ const Grid& Automaton::getGrid() const {
void
Automaton
::
setGrid
(
const
Grid
&
G
)
{
grid
=
G
;
unsigned
int
state
;
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
grid
.
get_
rows
());
++
i
)
{
for
(
int
j
=
0
;
j
<
static_cast
<
int
>
(
grid
.
get_
col
());
++
j
)
{
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
grid
.
get_
col
());
++
i
)
{
for
(
int
j
=
0
;
j
<
static_cast
<
int
>
(
grid
.
get_
rows
());
++
j
)
{
state
=
grid
.
get_state
({
i
,
j
});
if
(
state
>=
alphabet
.
taille
())
{
grid
.
set_cell
({
i
,
j
},
state
%
alphabet
.
taille
());
...
...
@@ -57,8 +57,8 @@ void Automaton::setGrid(const Grid& G) {
void
Automaton
::
runOnce
()
{
Grid
tempGrid
(
grid
);
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
grid
.
get_
rows
());
++
i
)
{
for
(
int
j
=
0
;
j
<
static_cast
<
int
>
(
grid
.
get_
col
());
++
j
)
{
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
grid
.
get_
col
());
++
i
)
{
for
(
int
j
=
0
;
j
<
static_cast
<
int
>
(
grid
.
get_
rows
());
++
j
)
{
tempGrid
.
set_cell
({
i
,
j
},
transitionRule
->
getState
(
grid
.
get_state
({
i
,
j
}),
neighbourhoodRule
->
getNeighborhood
(
grid
,
{
i
,
j
}))
%
alphabet
.
taille
());
}
}
...
...
src/uibuildervisitor.cpp
View file @
b03fd11b
...
...
@@ -130,6 +130,17 @@ void UIBuilderVisitor::visit(CoordinateProperty &prop)
[
&
prop
](
int
i
)
{
prop
.
c
.
y
=
i
;
});
}
void
UIBuilderVisitor
::
visit
(
HelpProperty
&
prop
)
{
QPushButton
*
button
=
new
QPushButton
(
"Help"
,
current_widget
());
add_widget
(
""
,
button
);
QObject
::
connect
(
button
,
&
QPushButton
::
clicked
,
[
&
prop
]()
{
QMessageBox
::
information
(
NULL
,
"Help"
,
QString
::
fromStdString
(
prop
.
str
));
});
}
void
UIBuilderVisitor
::
visit
(
PropertyList
&
list
)
{
push_array_widget
(
list
);
...
...
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