Типа готовый GuessMyNumber. Угадайка от 1 до 50 с 4 уровнями сложности.
This commit is contained in:
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
@ -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
|
||||||
6
CMakeLists.txt
Normal file
6
CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.28)
|
||||||
|
project(GuessMyNumber)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
add_executable(GuessMyNumber main.cpp)
|
||||||
83
main.cpp
Normal file
83
main.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
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<unint>(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<rng) {if (rng-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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user