Косметические правки

This commit is contained in:
2024-12-03 19:26:04 +03:00
parent 1d5ed538c3
commit 1048100ab4
2 changed files with 12 additions and 14 deletions

View File

@@ -12,7 +12,7 @@ enum BoundaryCondition {
class CellularAutomaton class CellularAutomaton
{ {
static const unsigned int functionValues = 0b00000110100000000010110010110110; static const unsigned int functionValues = 25 * 11 * 2003 * 18 * 11;
int m_fieldWidth, m_fieldHeight; int m_fieldWidth, m_fieldHeight;
std::vector<std::vector<int>> field; std::vector<std::vector<int>> field;

View File

@@ -6,6 +6,7 @@ using namespace std;
void clear() { void clear() {
system("cls"); system("cls");
cout << "Вариант: 00000110100000000010110010110110\n\n";
} }
@@ -16,20 +17,23 @@ int main()
while (true) { while (true) {
clear(); clear();
cout << "Выберите способ вычисления функции:\n" cout << "Выберите граничные условия:\n"
"Запустить клеточный автомат (0)\n" "Единичные (0)\n"
"Завершить работу (1)\n\n"; "Нулевые (1)\n"
"Торроидальные (2)\n"
int actionId = inputNumber(0, 1); "Завершить работу (3)\n\n";
int actionId = inputNumber(0, 3);
clear(); clear();
if (actionId == 1) { if (actionId == 3) {
cout << "Выйти из программы? (yes/no)\n"; cout << "Выйти из программы? (yes/no)\n";
if (userApprove()) return 0; if (userApprove()) return 0;
break; continue;
} }
BoundaryCondition boundaryCondition = static_cast<BoundaryCondition>(actionId);
cout << "Укажите ширину поля (min 1): "; cout << "Укажите ширину поля (min 1): ";
int fieldWidth = inputNumber(1); int fieldWidth = inputNumber(1);
@@ -42,12 +46,6 @@ int main()
cout << "Заполнить поле случайными значениями? (yes/no)\n"; cout << "Заполнить поле случайными значениями? (yes/no)\n";
bool fillWithRandom = userApprove(); bool fillWithRandom = userApprove();
cout << "\nВыберите граничные условия:\n"
"Нулевые (0)\n"
"Единичные (1)\n"
"Торроидальные (2)\n\n";
BoundaryCondition boundaryCondition = static_cast<BoundaryCondition>(inputNumber(0, 2));
CellularAutomaton ca(fieldWidth, fieldHeight, fillWithRandom, boundaryCondition); CellularAutomaton ca(fieldWidth, fieldHeight, fillWithRandom, boundaryCondition);
clear(); clear();