Commit 51ff3eb2 authored by Yann Boucher's avatar Yann Boucher
Browse files

Ajout de Langton's Loops

parent f917721b
Pipeline #79275 canceled with stage
......@@ -34,6 +34,8 @@ private slots:
void loadStateID(unsigned int); // La fonction idPath permet de parcourir la liste des états et d'avoir un affiche du nom et de la couleur sur l'interface
void pickColor();
void on_state_label_textEdited(const QString &arg1);
private:
Ui::ColorLabel *ui;
Alphabet a;
......
......@@ -108,6 +108,7 @@ private:
//! \brief Charge la grille depuis une image.
void load_from_image();
//! \brief Charge un nouvel alphabet et met à jour l'UI.
void ui_update_alphabet(const Alphabet& alph);
//! \brief Sauvegarde la configuration actuelle.
......
{
"alphabet": [
{
"color": [
255,
255,
255
],
"name": "Dead"
},
{
"color": [
0,
0,
255
],
"name": "Alive"
}
],
"author": "JM",
"date": "jeu. juin 3 2021",
"desc": "Langston's Loops.\n!!CORRIGER L'ALPHABET!!",
"neighborhood_data": {
"radius": 1
},
"neighborhood_name": "Von Neumann",
"title": "langston_loops",
"transition_data": {
"rule_string": "rotate4\n0,0,0,0,0->0\n0,0,0,0,1->2\n0,0,0,0,2->0\n0,0,0,0,3->0\n0,0,0,0,5->0\n0,0,0,0,6->3\n0,0,0,0,7->1\n0,0,0,1,1->2\n0,0,0,1,2->2\n0,0,0,1,3->2\n0,0,0,2,1->2\n0,0,0,2,2->0\n0,0,0,2,3->0\n0,0,0,2,6->2\n0,0,0,2,7->2\n0,0,0,3,2->0\n0,0,0,5,2->5\n0,0,0,6,2->2\n0,0,0,7,2->2\n0,0,1,0,2->2\n0,0,1,1,2->0\n0,0,2,0,2->0\n0,0,2,0,3->0\n0,0,2,0,5->0\n0,0,2,1,2->5\n0,0,2,2,2->0\n0,0,2,3,2->2\n0,0,5,2,2->2\n0,1,2,3,2->1\n0,1,2,4,2->1\n0,1,2,5,2->5\n0,1,2,6,2->1\n0,1,2,7,2->1\n0,1,2,7,5->1\n0,1,4,2,2->1\n0,1,4,3,2->1\n0,1,4,4,2->1\n0,1,4,7,2->1\n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,5->2\n5,0,2,2,2->0\n5,0,2,2,4->4\n5,0,2,7,2->2\n5,1,2,1,2->2\n5,1,2,2,2->0\n5,1,2,4,2->2\n5,1,2,7,2->2\n6,0,0,0,1->1\n6,0,0,0,2->1\n6,0,2,1,2->0\n6,1,2,1,2->5\n6,1,2,1,3->1\n6,1,2,2,2->5\n7,0,0,0,7->7\n7,0,1,1,2->0\n7,0,1,2,2->0\n7,0,1,2,5->0\n7,0,2,1,2->0\n7,0,2,2,2->1\n7,0,2,2,5->1\n7,0,2,3,2->1\n7,0,2,5,2->5\n7,0,2,7,2->0"
},
"transition_name": "Non isotropic rulestring"
}
{
"alphabet": [
{
"color": [
0,
0,
0
],
"name": "Background"
},
{
"color": [
0,
0,
255
],
"name": "Core"
},
{
"color": [
255,
0,
0
],
"name": "Sheath"
},
{
"color": [
0,
170,
0
],
"name": "Green"
},
{
"color": [
255,
255,
0
],
"name": "Yellow"
},
{
"color": [
255,
85,
255
],
"name": "Pink"
},
{
"color": [
255,
255,
255
],
"name": "White"
},
{
"color": [
0,
255,
255
],
"name": "Cyan"
}
],
"author": "JM",
"date": "dim. juin 6 2021",
"desc": "",
"neighborhood_data": {
"radius": 1
},
"neighborhood_name": "Von Neumann",
"title": "langton",
"transition_data": {
"rule_string": "rotate4\n0,0,0,0,0->0\n0,0,1,0,0->2\n0,0,2,0,0->0\n0,0,3,0,0->0\n0,0,5,0,0->0\n0,0,6,0,0->3\n0,0,7,0,0->1\n0,0,1,0,1->2\n0,0,2,0,1->2\n0,0,3,0,1->2\n0,0,1,0,2->2\n0,0,2,0,2->0\n0,0,3,0,2->0\n0,0,6,0,2->2\n0,0,7,0,2->2\n0,0,2,0,3->0\n0,0,2,0,5->5\n0,0,2,0,6->2\n0,0,2,0,7->2\n0,0,2,1,0->2\n0,0,2,1,1->0\n0,0,2,2,0->0\n0,0,3,2,0->0\n0,0,5,2,0->0\n0,0,2,2,1->5\n0,0,2,2,2->0\n0,0,2,2,3->2\n0,0,2,5,2->2\n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,5->0\n4,0,2,3,2->1\n5,0,2,0,0->2\n5,0,1,0,2->5\n5,0,2,0,2->5\n5,0,3,0,2->2\n5,0,7,0,2->2\n5,0,2,0,5->0\n5,0,2,2,0->2\n5,0,2,2,1->2\n5,0,5,2,1->2\n5,0,2,2,2->0\n5,0,4,2,2->4\n5,0,2,2,7->2\n5,1,2,2,1->2\n5,1,2,2,2->0\n5,1,2,2,4->2\n5,1,2,2,7->2\n6,0,1,0,0->1\n6,0,2,0,0->1\n6,0,2,2,1->0\n6,1,2,2,1->5\n6,1,3,2,1->1\n6,1,2,2,2->5\n7,0,7,0,0->7\n7,0,2,1,1->0\n7,0,2,1,2->0\n7,0,5,1,2->0\n7,0,2,2,1->0\n7,0,2,2,2->1\n7,0,5,2,2->1\n7,0,2,2,3->1\n7,0,2,2,5->5\n7,0,2,2,7->0"
},
"transition_name": "Non isotropic rulestring"
}
{
"author": "JM",
"cells": [
{
"state": 2,
"x": 1,
"y": 0
},
{
"state": 2,
"x": 2,
"y": 0
},
{
"state": 2,
"x": 3,
"y": 0
},
{
"state": 2,
"x": 4,
"y": 0
},
{
"state": 2,
"x": 5,
"y": 0
},
{
"state": 2,
"x": 6,
"y": 0
},
{
"state": 2,
"x": 7,
"y": 0
},
{
"state": 2,
"x": 8,
"y": 0
},
{
"state": 2,
"x": 0,
"y": 1
},
{
"state": 1,
"x": 1,
"y": 1
},
{
"state": 7,
"x": 2,
"y": 1
},
{
"state": 1,
"x": 4,
"y": 1
},
{
"state": 4,
"x": 5,
"y": 1
},
{
"state": 1,
"x": 7,
"y": 1
},
{
"state": 4,
"x": 8,
"y": 1
},
{
"state": 2,
"x": 9,
"y": 1
},
{
"state": 2,
"x": 0,
"y": 2
},
{
"state": 2,
"x": 2,
"y": 2
},
{
"state": 2,
"x": 3,
"y": 2
},
{
"state": 2,
"x": 4,
"y": 2
},
{
"state": 2,
"x": 5,
"y": 2
},
{
"state": 2,
"x": 6,
"y": 2
},
{
"state": 2,
"x": 7,
"y": 2
},
{
"state": 2,
"x": 9,
"y": 2
},
{
"state": 2,
"x": 0,
"y": 3
},
{
"state": 7,
"x": 1,
"y": 3
},
{
"state": 2,
"x": 2,
"y": 3
},
{
"state": 2,
"x": 7,
"y": 3
},
{
"state": 1,
"x": 8,
"y": 3
},
{
"state": 2,
"x": 9,
"y": 3
},
{
"state": 2,
"x": 0,
"y": 4
},
{
"state": 1,
"x": 1,
"y": 4
},
{
"state": 2,
"x": 2,
"y": 4
},
{
"state": 2,
"x": 7,
"y": 4
},
{
"state": 1,
"x": 8,
"y": 4
},
{
"state": 2,
"x": 9,
"y": 4
},
{
"state": 2,
"x": 0,
"y": 5
},
{
"state": 2,
"x": 2,
"y": 5
},
{
"state": 2,
"x": 7,
"y": 5
},
{
"state": 1,
"x": 8,
"y": 5
},
{
"state": 2,
"x": 9,
"y": 5
},
{
"state": 2,
"x": 0,
"y": 6
},
{
"state": 7,
"x": 1,
"y": 6
},
{
"state": 2,
"x": 2,
"y": 6
},
{
"state": 2,
"x": 7,
"y": 6
},
{
"state": 1,
"x": 8,
"y": 6
},
{
"state": 2,
"x": 9,
"y": 6
},
{
"state": 2,
"x": 0,
"y": 7
},
{
"state": 1,
"x": 1,
"y": 7
},
{
"state": 2,
"x": 2,
"y": 7
},
{
"state": 2,
"x": 3,
"y": 7
},
{
"state": 2,
"x": 4,
"y": 7
},
{
"state": 2,
"x": 5,
"y": 7
},
{
"state": 2,
"x": 6,
"y": 7
},
{
"state": 2,
"x": 7,
"y": 7
},
{
"state": 1,
"x": 8,
"y": 7
},
{
"state": 2,
"x": 9,
"y": 7
},
{
"state": 2,
"x": 10,
"y": 7
},
{
"state": 2,
"x": 11,
"y": 7
},
{
"state": 2,
"x": 12,
"y": 7
},
{
"state": 2,
"x": 13,
"y": 7
},
{
"state": 2,
"x": 0,
"y": 8
},
{
"state": 7,
"x": 2,
"y": 8
},
{
"state": 1,
"x": 3,
"y": 8
},
{
"state": 7,
"x": 5,
"y": 8
},
{
"state": 1,
"x": 6,
"y": 8
},
{
"state": 7,
"x": 8,
"y": 8
},
{
"state": 1,
"x": 9,
"y": 8
},
{
"state": 1,
"x": 10,
"y": 8
},
{
"state": 1,
"x": 11,
"y": 8
},
{
"state": 1,
"x": 12,
"y": 8
},
{
"state": 1,
"x": 13,
"y": 8
},
{
"state": 2,
"x": 14,
"y": 8
},
{
"state": 2,
"x": 1,
"y": 9
},
{
"state": 2,
"x": 2,
"y": 9
},
{
"state": 2,
"x": 3,
"y": 9
},
{
"state": 2,
"x": 4,
"y": 9
},
{
"state": 2,
"x": 5,
"y": 9
},
{
"state": 2,
"x": 6,
"y": 9
},
{
"state": 2,
"x": 7,
"y": 9
},
{
"state": 2,
"x": 8,
"y": 9
},
{
"state": 2,
"x": 9,
"y": 9
},
{
"state": 2,
"x": 10,
"y": 9
},
{
"state": 2,
"x": 11,
"y": 9
},
{
"state": 2,
"x": 12,
"y": 9
},
{
"state": 2,
"x": 13,
"y": 9
}
],
"date": "dim. juin 6 2021",
"desc": "",
"title": "langton"
}
......@@ -140,3 +140,10 @@ void ColorLabel::pickColor()
pal.setColor(QPalette::Window, color);
ui->color_label->setPalette(pal);
}
void ColorLabel::on_state_label_textEdited(const QString &arg1)
{
state s = a.getState(current_id);
a.setState(current_id, state(s.getColor(), arg1.toStdString()));
ui->state_list->item(current_id)->setText(arg1);
}
......@@ -219,7 +219,7 @@ void GridGraphicsView::drawForeground(QPainter *painter, const QRectF &)
if (lod < 10)
return; // trop zoomé, on ne dessine rien
painter->setPen(QPen(Qt::black, 0)); // cosmetic 1-pixel pen
painter->setPen(QPen(Qt::gray, 0)); // cosmetic 1-pixel pen
QVector<QLine> lines;
// horizontal lines
......