Refactoring and updating

Fix bug, when steps = 0, but player didn't lose
This commit is contained in:
2025-04-30 19:36:14 +03:00
parent 7f0e023e0c
commit d905c1a3f9
7 changed files with 85 additions and 65 deletions

View File

@@ -1,14 +1,14 @@
#include "client.hpp"
void print_instructions() {
std::cout << "Доступные команды:\n";
std::cout << " - вперёд\n";
std::cout << " - направо\n";
std::cout << " - налево\n";
std::cout << " - назад\n";
std::cout << " - сдаюсь\n";
std::cout << "Введите команду для хода.\n";
}
// void print_instructions() {
// std::cout << "Доступные команды:" << std::endl;
// std::cout << " - вперёд" << std::endl;
// std::cout << " - направо" << std::endl;
// std::cout << " - налево" << std::endl;
// std::cout << " - назад" << std::endl;
// std::cout << " - сдаюсь" << std::endl;
// std::cout << "Введите команду для хода" << std::endl;
// }
int Client::ping(struct sockaddr_in address){
return connect(sock, (struct sockaddr*)&address, sizeof(address)) != 0;
@@ -53,8 +53,8 @@ void Client::run(const std::string& h, const unsigned short p) {
}
void Client::game(){
std::cout << "Игра началась!\n";
print_instructions();
std::cout << "Игра началась!" << std::endl;
//print_instructions();
char buffer[1024] = {0};
while (true) {