diff --git a/bulls-and-cows-cpp/CGame.cpp b/bulls-and-cows-cpp/CGame.cpp index 2db24e4..7c2af8f 100644 --- a/bulls-and-cows-cpp/CGame.cpp +++ b/bulls-and-cows-cpp/CGame.cpp @@ -1,6 +1,7 @@ -// Bulls and Cows the game +// Bulls and Cows the game // CGame.cpp // +#include "defines.h" #include "CGame.h" #include "CUserInput.h" #include "CPrint.h" @@ -74,14 +75,14 @@ bool CGame::GetNumber(CStep step) { if (IsEqual(userInput.m_vUserInput, userInput.m_vUserInput.at(i), i)) { - m_sLastError = L"Цифры в числе не должны повторяться!"; + m_sLastError = strERROR_1; return false; } } } else { - m_sLastError = L"Вы должны ввести " + std::to_wstring(m_ucDigits) + L"-значное число!"; + m_sLastError = strERROR_2_1 + std::to_wstring(m_ucDigits) + strERROR_2_2; return false; } diff --git a/bulls-and-cows-cpp/CGame.h b/bulls-and-cows-cpp/CGame.h index 12d1181..4c35107 100644 --- a/bulls-and-cows-cpp/CGame.h +++ b/bulls-and-cows-cpp/CGame.h @@ -2,7 +2,6 @@ // CGame.h // #pragma once -#include "defines.h" #include "CStep.h" #include diff --git a/bulls-and-cows-cpp/CPrint.cpp b/bulls-and-cows-cpp/CPrint.cpp index 9a4c567..aa4f840 100644 --- a/bulls-and-cows-cpp/CPrint.cpp +++ b/bulls-and-cows-cpp/CPrint.cpp @@ -1,26 +1,27 @@ -// Bulls and Cows the game +// Bulls and Cows the game // CPrint.cpp // #include "CPrint.h" +#include "defines.h" #include void CPrint::GameInitialQuery() { - std::wcout << L"Введите количество цифр в числе (от 3 до 5).\n"; - std::wcout << L"Чем больше цифр - тем сложнее. Обычно 4.\n" << std::endl; + std::wcout << strINITIAL_QUERY_1; + std::wcout << strINITIAL_QUERY_2 << std::endl; } void CPrint::GameHeader() { std::system("cls"); - std::wcout << L"Быки и Коровы." << ' ' << L"Версия" << ' ' << VERSION << std::endl; - std::wcout << L"Copyright (c) 2023 by W0LF aka 'dreamforce'" << "\n\n" << std::endl; + std::wcout << strGAME_NAME << ' ' << strGAME_VERSION << ' ' << VERSION << std::endl; + std::wcout << strGAME_COPYRIGHT << "\n\n" << std::endl; } void CPrint::GameFooter(CGame* const game) { - std::wcout << L"\n\n\t" << L"!!! П О Б Е Д А !!!" << std::endl; - std::wcout << L"\tКоличество ходов: " << game->m_uStepCounter << L"\n\n" << std::endl; + std::wcout << "\n\n\t" << strVICTORY << std::endl; + std::wcout << strNUM_STEPS << game->m_uStepCounter << "\n\n" << std::endl; } void CPrint::Steps(CGame* const game) @@ -31,7 +32,7 @@ void CPrint::Steps(CGame* const game) { std::wcout << '\t'; for (int& d : s.GetStepNumber()) std::wcout << d; - std::wcout << '\t' << s.GetStepAnimals().first << L" Б., " << s.GetStepAnimals().second << L" К."; + std::wcout << '\t' << s.GetStepAnimals().first << strBULLS << s.GetStepAnimals().second << strCOWS; std::wcout << std::endl; } } diff --git a/bulls-and-cows-cpp/defines.h b/bulls-and-cows-cpp/defines.h index c975b33..db4e55a 100644 --- a/bulls-and-cows-cpp/defines.h +++ b/bulls-and-cows-cpp/defines.h @@ -1,4 +1,4 @@ -// Bulls and Cows the game +// Bulls and Cows the game // defines.h // #pragma once @@ -9,3 +9,20 @@ #else #define IS_SHOW false #endif + +#define strERROR_1 L"Цифры в числе не должны повторяться!" +#define strERROR_2_1 L"Вы должны ввести " +#define strERROR_2_2 L"-значное число!" + +#define strBULLS L" Б., " +#define strCOWS L" К." + +#define strINITIAL_QUERY_1 L"Введите количество цифр в числе (от 3 до 5).\n" +#define strINITIAL_QUERY_2 L"Чем больше цифр - тем сложнее. Обычно 4.\n" + +#define strGAME_NAME L"Быки и Коровы." +#define strGAME_VERSION L"Версия" +#define strGAME_COPYRIGHT L"Copyright (c) 2023 by W0LF aka 'dreamforce'" + +#define strVICTORY L"!!! П О Б Е Д А !!!" +#define strNUM_STEPS L"\tКоличество ходов: "