From 8956c87447ea9a18ab1512124830d0e60d502ac7 Mon Sep 17 00:00:00 2001 From: "vadim.bochkov" Date: Sun, 20 Oct 2024 17:00:20 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B8=D0=BF=D0=B0=20=D0=B3=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=D1=8B=D0=B9=20GuessMyNumber.=20=D0=A3=D0=B3=D0=B0?= =?UTF-8?q?=D0=B4=D0=B0=D0=B9=D0=BA=D0=B0=20=D0=BE=D1=82=201=20=D0=B4?= =?UTF-8?q?=D0=BE=2050=20=D1=81=204=20=D1=83=D1=80=D0=BE=D0=B2=D0=BD=D1=8F?= =?UTF-8?q?=D0=BC=D0=B8=20=D1=81=D0=BB=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 40 ++++++++++++++++++++++++ CMakeLists.txt | 6 ++++ main.cpp | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73d11be --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +/cmake-build-debug/.cmake/api/v1/query/cache-v2 +/cmake-build-debug/.cmake/api/v1/query/cmakeFiles-v1 +/cmake-build-debug/.cmake/api/v1/query/codemodel-v2 +/cmake-build-debug/.cmake/api/v1/query/toolchains-v1 +/cmake-build-debug/.cmake/api/v1/reply/cache-v2-525f45e814f7fbe6a7a1.json +/cmake-build-debug/.cmake/api/v1/reply/cmakeFiles-v1-bc259aa90cfdd5689d6f.json +/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-7baffd55ee3f7c157ab2.json +/cmake-build-debug/.cmake/api/v1/reply/directory-.-Debug-d0094a50bb2071803777.json +/cmake-build-debug/.cmake/api/v1/reply/index-2024-10-20T07-17-49-0349.json +/cmake-build-debug/.cmake/api/v1/reply/target-GuessMyNumber-Debug-64632c98f000e9a13b71.json +/cmake-build-debug/.cmake/api/v1/reply/toolchains-v1-a2523d1a0a47b8d9fb88.json +/cmake-build-debug/CMakeFiles/3.28.1/CompilerIdC/a.exe +/cmake-build-debug/CMakeFiles/3.28.1/CompilerIdC/CMakeCCompilerId.c +/cmake-build-debug/CMakeFiles/3.28.1/CompilerIdCXX/a.exe +/cmake-build-debug/CMakeFiles/3.28.1/CompilerIdCXX/CMakeCXXCompilerId.cpp +/cmake-build-debug/CMakeFiles/3.28.1/CMakeCCompiler.cmake +/cmake-build-debug/CMakeFiles/3.28.1/CMakeCXXCompiler.cmake +/cmake-build-debug/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_C.bin +/cmake-build-debug/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_CXX.bin +/cmake-build-debug/CMakeFiles/3.28.1/CMakeRCCompiler.cmake +/cmake-build-debug/CMakeFiles/3.28.1/CMakeSystem.cmake +/cmake-build-debug/CMakeFiles/clion-Debug-log.txt +/cmake-build-debug/CMakeFiles/clion-environment.txt +/cmake-build-debug/CMakeFiles/cmake.check_cache +/cmake-build-debug/CMakeFiles/CMakeConfigureLog.yaml +/cmake-build-debug/CMakeFiles/rules.ninja +/cmake-build-debug/CMakeFiles/TargetDirectories.txt +/cmake-build-debug/Testing/Temporary/LastTest.log +/cmake-build-debug/build.ninja +/cmake-build-debug/cmake_install.cmake +/cmake-build-debug/CMakeCache.txt +/.idea/.gitignore +/.idea/GuessMyNumber.iml +/.idea/misc.xml +/.idea/modules.xml +/.idea/vcs.xml +/cmake-build-debug/CMakeFiles/GuessMyNumber.dir/main.cpp.obj +/cmake-build-debug/.ninja_deps +/cmake-build-debug/.ninja_log +/cmake-build-debug/GuessMyNumber.exe diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..25ff327 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.28) +project(GuessMyNumber) + +set(CMAKE_CXX_STANDARD 17) + +add_executable(GuessMyNumber main.cpp) diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..a9cfb4f --- /dev/null +++ b/main.cpp @@ -0,0 +1,83 @@ +#include +#include +#include + +using std::cout; using std::endl; using std::cin; using std::string; typedef unsigned int unint; + +int main() { + + //переменные + int compwin=0, urwin=0, maxtimes, times=1, rng, usercount=101; string yn = "y"; + const char *RAZD = "------------------"; unint dif; bool debug; + char const *TOOCOLD = "hell bro TOO COLD"; char const *TOOHOT = "yo brodie dat SO HOT"; + enum difficult {EASY = 1, HARD = 2, NIGHTMARE = 3, FEDYA = 4}; + + //заглавие + cout << RAZD << "\n" << RAZD << endl; cout << "ayyyy lmao welcome do Doka 3!" << endl; + cout << "CHOOSE UR DESTINY.\n1.EASY gives u 10 tries.\n2.HARD - 6 tries.\n3.NIGHTMARE - 3 tries.\n4.BROOO DON'T TYPE FEDYA" << endl; + cin >> dif; + + //выбор уровня сложности из пеоечисления + switch (dif) { + case EASY: + cout << "DADDY PLZ DON'T BEAT ME!" << endl; maxtimes = 10; break; + case HARD: + cout << "U WANNA PLAY? LET'S PLAY!" << endl; maxtimes = 6; break; + case NIGHTMARE: + cout << "U'LL NEVER WIN." << endl; maxtimes = 3; break; + case FEDYA: + cout << "DeLongia Software ebat'" << endl; maxtimes = 1; break; + default: + cout << "invalid parameter (you are invalid too brodie.)" << endl; return 0; + } + + //дебаг вкл-выкл + cout << "need a debug option? (0/1)" << endl; + cin >> debug; if (debug==true) {cout << "freaking cheater." << endl;} + cout << "I've generated number from 1 to 50. Can u guess it? "; + + //ТЕЛО ИГРЫ + while (yn=="y") { + //рандомайзер + cout << "wut r u waitin' 4? type ur number:" << endl; + srand(static_cast(time(0))); + rng = (rand() % 50) + 1; + + //дебаг-опция выводит верный ответ и счёт после каждого прокрута + if (debug==true) {cout << "rng:" << rng << "\ncompscore:" << compwin << "\nuserscore:" << urwin << endl;} + + //тело угадайки + while (usercount != rng) + { + cin >> usercount; + if (usercount>rng) {if (usercount-rng>=5) {cout << TOOCOLD << endl;} else {cout << TOOHOT << endl;}} + if (usercount=5) {cout << TOOCOLD << endl;} else {cout << TOOHOT << endl;}} + if ((usercount==rng) or (maxtimes==times)) {break;} + ++times; + }; + + //итоги раунда + if ((times==1) and (usercount==rng)) {++urwin; cout << "DAMMIT M8 U GUESSED IT FROM " << times << "st TIME!" << endl;} + else if ((times<=maxtimes) and (usercount==rng)) {++urwin; cout << "sheee not bad u guessed it from " << times << " time!" << endl;} + else {++compwin ;cout << "damn u lost." << endl;} + //прекол (только на уровне сложности ФЕДЯ) + if (maxtimes==1) {cout << "fedya also found u and took ur ass." << endl;} + + //предложение нового раунда + cout << "wanna play another time? (y/n)" << endl; + times = 1; + cin >> yn; + } + + //СТАТИСТИКА ПРИ ЗАВЕРШЕНИИ ИГРЫ + cout << "SOME STATS OF UR SESSION:" << endl; + //только на уровне сложности ФЕДЯ + if (maxtimes==1) {cout << "fedya took ur ass " << compwin << " times.\nu r saved ur anus " << urwin << " times." << endl;} + //в остальных случаях + else {cout << "I'm won " << compwin << " times.\nu won me " << urwin << " times." << endl;} + + //компьютер респектует или лошит игрока + if (compwin>urwin) {cout << "fuckyeah go back home lamer, u need some training." << endl;} + else {cout << "well, dat was not bad how u beat me." << endl;} + return 1488; +} \ No newline at end of file