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
dd944119
Commit
dd944119
authored
Jun 05, 2021
by
Eugene Pin
Browse files
Fin implémentation grille aléatoire
#49
parent
3d0b9f03
Pipeline
#79239
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/interface.cpp
View file @
dd944119
...
...
@@ -200,8 +200,7 @@ void MainWindow::on_nbrStateComboBox_currentTextChanged(const QString &arg1)
void
MainWindow
::
on_randomPatternButton_clicked
()
{
// TODO Prendre en compte l'alphabet !
// int nbr = rand() % nbr de states différents;
int
alphabetSize
=
simulation
.
getAlphabet
().
taille
();
Grid
oldGrid
=
ui
->
grid_view
->
get_grid
();
unsigned
nbrRow
=
oldGrid
.
get_rows
();
// rows = nbr de lignes => axe y
...
...
@@ -212,11 +211,8 @@ void MainWindow::on_randomPatternButton_clicked()
{
for
(
unsigned
x
=
0
;
x
<
nbrCol
;
++
x
)
{
// TODO Remplacer 2 par le nbr d'états différents
// TODO comprendre pourquoi il faut inverser x et y (???)
unsigned
state
=
rand
()
%
2
;
unsigned
state
=
rand
()
%
alphabetSize
;
Coord
pos
=
{
static_cast
<
int
>
(
x
),
static_cast
<
int
>
(
y
)};
//std::cout << "position x= "<< pos.x << " y= "<< pos.y << endl;
newGrid
.
set_cell
(
pos
,
state
);
}
}
...
...
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