From 1048100ab4a6c6a92e5f2a336c8f5726cff82040 Mon Sep 17 00:00:00 2001 From: Arity-T Date: Tue, 3 Dec 2024 19:26:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D1=81=D0=BC=D0=B5=D1=82=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D1=81=D0=BA=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab1/CellularAutomaton.h | 2 +- lab1/lab1.cpp | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/lab1/CellularAutomaton.h b/lab1/CellularAutomaton.h index d0e51f7..7766b7a 100644 --- a/lab1/CellularAutomaton.h +++ b/lab1/CellularAutomaton.h @@ -12,7 +12,7 @@ enum BoundaryCondition { class CellularAutomaton { - static const unsigned int functionValues = 0b00000110100000000010110010110110; + static const unsigned int functionValues = 25 * 11 * 2003 * 18 * 11; int m_fieldWidth, m_fieldHeight; std::vector> field; diff --git a/lab1/lab1.cpp b/lab1/lab1.cpp index e5d5d95..d65e5df 100644 --- a/lab1/lab1.cpp +++ b/lab1/lab1.cpp @@ -6,6 +6,7 @@ using namespace std; void clear() { system("cls"); + cout << "Вариант: 00000110100000000010110010110110\n\n"; } @@ -16,20 +17,23 @@ int main() while (true) { clear(); - cout << "Выберите способ вычисления функции:\n" - "Запустить клеточный автомат (0)\n" - "Завершить работу (1)\n\n"; - - int actionId = inputNumber(0, 1); + cout << "Выберите граничные условия:\n" + "Единичные (0)\n" + "Нулевые (1)\n" + "Торроидальные (2)\n" + "Завершить работу (3)\n\n"; + int actionId = inputNumber(0, 3); clear(); - if (actionId == 1) { + if (actionId == 3) { cout << "Выйти из программы? (yes/no)\n"; if (userApprove()) return 0; - break; + continue; } + BoundaryCondition boundaryCondition = static_cast(actionId); + cout << "Укажите ширину поля (min 1): "; int fieldWidth = inputNumber(1); @@ -42,12 +46,6 @@ int main() cout << "Заполнить поле случайными значениями? (yes/no)\n"; bool fillWithRandom = userApprove(); - cout << "\nВыберите граничные условия:\n" - "Нулевые (0)\n" - "Единичные (1)\n" - "Торроидальные (2)\n\n"; - BoundaryCondition boundaryCondition = static_cast(inputNumber(0, 2)); - CellularAutomaton ca(fieldWidth, fieldHeight, fillWithRandom, boundaryCondition); clear();