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();