36 lines
724 B
C++
36 lines
724 B
C++
#pragma once
|
|
#include "Player.h"
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
|
|
constexpr auto SIZE = 10;
|
|
constexpr auto SIZE_FOR_ARRAY = SIZE - 1;
|
|
constexpr auto ARMY = 5;
|
|
constexpr auto FLAGS = 3;
|
|
|
|
class Game {
|
|
private:
|
|
char field[SIZE][SIZE];
|
|
std::unique_ptr<Player[]> gamers;
|
|
public:
|
|
Game() : gamers(std::make_unique<Player[]>(2)) {
|
|
for (int i = 0; i < SIZE; ++i) {
|
|
for (int j = 0; j < SIZE; ++j) {
|
|
field[i][j] = '*';
|
|
}
|
|
}
|
|
gamers[0].set_name('P');
|
|
gamers[1].set_name('E');
|
|
};
|
|
|
|
void info();
|
|
void init();
|
|
void play();
|
|
|
|
private:
|
|
bool handleUnitSelection(const auto&, size_t&, int&, int&);
|
|
bool handleUnitMovement(auto, int&, int&);
|
|
void Random(char);
|
|
void clearScreen();
|
|
void print_field(int, int);
|
|
}; |