Commit dd944119 authored by Eugene Pin's avatar Eugene Pin
Browse files

Fin implémentation grille aléatoire #49

parent 3d0b9f03
Pipeline #79239 canceled with stage
......@@ -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);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment