Игра Крестики-Нолики с игроком и с машиной. Студия 2019
14.05.2023, 21:22. Показов 762. Ответов 1
Добрый день всем!! Не подскажет кто то как решить проблему. В моей программе есть два режима игра с человеком и игра с ботом. Я реши реализовать игровую логику бота через алгоритм MinMax но почему-то получилось так что бот играет и за игрока и за бота то есть без человека. Может кто-то подскажет как исправить это? Заранее всем спасибо!!
Я кину ссылку на два файлообменника(проект тяжелый на киберфорум не помещается),и сам код сюда много файлов просто.
Главный файл Game.cpp
Ссылка 1: https://dropmefiles.com/r3aHb
Ссылка 2: https://drive.google.com/drive... sp=sharing
Проект в виде текста очень большой (ограничение в 25000 символом) поэтому я только часть скину.
Файл Game.cpp
| C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
| #include "Game.h"
#include "Loby.h"
enum GMode {
PlwithPl = 0,
PlwithComp = 1
}; int Gmode;
//Общ знач.
MapGame map;
Gamer pl1;
Gamer pl2;
GamerStat currentPl;
Vec SelectCellPl;
//Флаги
bool canPl;
bool endGame;
//Значен. для бота
std::vector<Vec> allXod;//все ходы
int curenXod;//тек. ход
void GameTicTacToe::Game::GameRules()
{
//Пров. реж. игр.
if (Gmode == PlwithComp) {
//Очередь бота
if (currentPl == Comp) {
//Делать ход
Bot();
}
Update();
}
}
void GameTicTacToe::Game::Update()
{
if (endGame)
return;
//Проверка игр. пол.
int stat_game = map.CheckWin();
if (stat_game == 1) {
UpdateGGrid();
if (Gmode == PlwithPl) {
MessageBox::Show("Вітаємо Гравця1 з Перемогою!!");
}
else {
MessageBox::Show("Вітаємо Гравця з Перемогою!!");
}
endGame = true;
}
else if (stat_game == 2) {
UpdateGGrid();
if (Gmode == PlwithPl) {
MessageBox::Show("Вітаємо Гравця2 з Перемогою!!");
}
else {
MessageBox::Show("Вітаємо Комп'ютер з Перемогою!!");
}
endGame = true;
}
else if (stat_game == 3) {
UpdateGGrid();
MessageBox::Show("Перемогла дружба!!!", "Нічія!!");
endGame = true;
}
if (endGame) {
if (MessageBox::Show("Запустити нову гру?", "Увагу!!", MessageBoxButtons::YesNo) == Windows::Forms::DialogResult::Yes) {
NGame();
}
return;
}
if (Gmode == PlwithComp) {
if (currentPl == Comp) {
Statusxod->Text = "Хід Гравця!";
currentPl = Player;
return;
}
else {
Statusxod->Text = "Хід Комп'ютера!";
currentPl = Comp;
GameRules();
UpdateGGrid();
return;
}
}
else {
if (currentPl == Player1) {
Statusxod->Text = "Хід O!";
currentPl = Player2;
}
else {
Statusxod->Text = "Хід X!";
currentPl = Player1;
}
}
GameRules();
UpdateGGrid();
}
void GameTicTacToe::Game::NGame()
{
//Обяв. данных
map.SetMap(row, colonki, length);
rand = gcnew Random();
endGame = false;
CreateGGread(map.GetSize());//созд поле
//Обяв. данных для бота
curenXod = 0;
allXod.clear();
Vec buf;
for (int i = 0; i < map.GetSize().x; i++) {
for (int j = 0; j < map.GetSize().x; j++) {
buf.x = i;
buf.y = j;
allXod.push_back(buf);
}
}
//Пров. всех ход. + перепровер.
int num_max = rand->Next(1, 10);
for (int i = 0; i < num_max; i++)
std::random_shuffle(allXod.begin(), allXod.end());
//Провер. режим. игр. и очередь
int state_gamer = rand->Next(1, 3);
if (state_gamer == 1) {
if (Gmode == PlwithComp) {
pl1.SetPool(Player, 1);
pl2.SetPool(Comp, 2);
Statusxod->Text = "Хід Гравця!";
currentPl = Player;
}
else {
pl1.SetPool(Player1, 1);
pl2.SetPool(Player2, 2);
Statusxod->Text = "Хід X!";
currentPl = Player1;
}
}
else if (state_gamer == 2) {
if (Gmode == PlwithComp) {
pl1.SetPool(Player, 1);
pl2.SetPool(Comp, 2);
Statusxod->Text = "Хід Комп'ютера!";
currentPl = Comp;
GameRules();
UpdateGGrid();
}
else {
pl1.SetPool(Player1, 1);
pl2.SetPool(Player2, 2);
Statusxod->Text = "Хід O!";
currentPl = Player2;
}
}
else {
MessageBox::Show("Помилка генерації прершого гравця!", "Помилка!!!");
return;
}
}
void GameTicTacToe::Game::UpdateGGrid()
{
for (int i = 0; i < map.GetSize().x; i++) {
for (int j = 0; j < map.GetSize().y; j++) {
if (!map.CheckCell(i, j)) {
if (map.GetV(i, j) == 1) {
Fild->Rows[i]->Cells[j]->Value = "X";
}
else {
Fild->Rows[i]->Cells[j]->Value = "O";
}
}
}
}
}
void GameTicTacToe::Game::CreateGGread(Vec s)
{
//Очистка табл.
Fild->Rows->Clear();
Fild->Columns->Clear();
//Задать стиль табл.
System::Drawing::Font^ font = gcnew System::Drawing::Font("Microsoft Sans Serif", 14);
Fild->DefaultCellStyle->Font = font;
Fild->ColumnHeadersDefaultCellStyle->Font = font;
Fild->RowHeadersDefaultCellStyle->Font = font;
//Созд. столбцы
for (int i = 0; i < s.x; i++) {
DataGridViewButtonColumn^ column = gcnew DataGridViewButtonColumn();
column->HeaderCell->Value = Convert::ToString(i + 1);
column->Name = "column" + i;
column->Width = 50;
Fild->Columns->Add(column);
}
//Созд. строк
for (int i = 0; i < s.y; i++) {
Fild->Rows->Add();
Fild->Rows[i]->HeaderCell->Value = Convert::ToString(i + 1);
Fild->Rows[i]->Height = 50;
}
}
void GameTicTacToe::Game::SetKordPlayer(Vec cell)
{
//Пров. режим. игр.
if (Gmode == PlwithComp) {
//Пров. очер. игрока
if (currentPl == Player) {
//+Ход
if (!map.Setkordinat(cell, pl1.GetMark())) {
MessageBox::Show("Дана ячейка зайнята!", "Увагу!!");
return;
}
}
else {
MessageBox::Show("Ще не ваша черга зачекайте!", "Увагу!!");
return;
}
}
else {
if (currentPl == Player1) {
//Делаем ход
if (!map.Setkordinat(cell, pl1.GetMark())) {
MessageBox::Show("Дана ячейка зайнята!", "Увагу!!");
return;
}
}
else {
//+Ход
if (!map.Setkordinat(cell, pl2.GetMark())) {
MessageBox::Show("Дана ячейка зайнята!", "Увагу!!");
return;
}
}
}
Update();
}
void GameTicTacToe::Game::Bot()
{
int bestScore = INT_MIN;
Vec bestMove;
int currentPlayer = pl2.GetMark();
std::vector<Vec> availableMoves;
for (int i = 0; i < map.GetSize().x; i++)
{
for (int j = 0; j < map.GetSize().y; j++)
{
if (map.CheckCell(i, j))
{
availableMoves.push_back({ i, j });
}
}
}
for (int i = 0; i < availableMoves.size(); i++)
{
Vec move = availableMoves[i];
map.Setkordinat(move, currentPlayer);
int score = MiniMax(false);
map.Setkordinat(move, 0);
if (score > bestScore)
{
bestScore = score;
bestMove = move;
}
}
map.Setkordinat(bestMove, currentPlayer);
}
int GameTicTacToe::Game::MiniMax(bool isMaximizing)
{
int bestScore;
int currentPlayer;
if (isMaximizing)
{
bestScore = INT_MIN;
currentPlayer = pl2.GetMark();
}
else
{
bestScore = INT_MAX;
currentPlayer = pl1.GetMark();
}
int result = map.CheckWin();
if (result != 0)
{
if (result == pl2.GetMark())
return 1;
else if (result == pl1.GetMark())
return -1;
else
return 0;
}
std::vector<Vec> availableMoves;
for (int i = 0; i < map.GetSize().x; i++)
{
for (int j = 0; j < map.GetSize().y; j++)
{
if (map.CheckCell(i, j))
{
availableMoves.push_back({ i, j });
}
}
}
for (int i = 0; i < availableMoves.size(); i++)
{
Vec move = availableMoves[i];
map.Setkordinat(move, currentPlayer);
int score = MiniMax(!isMaximizing);
map.Setkordinat(move, 0);
if (isMaximizing)
{
if (score > bestScore)
bestScore = score;
}
else
{
if (score < bestScore)
bestScore = score;
}
}
return bestScore;
}
System::Void GameTicTacToe::Game::Game_Load(System::Object^ sender, System::EventArgs^ e)
{
//Задаем знач.
if (setGameMode == 0) {
Gmode = PlwithPl;
}
else {
Gmode = PlwithComp;
}
NGame();
}
System::Void GameTicTacToe::Game::новаГраToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
if (MessageBox::Show("Ви хочете нову гру?", "Увагу!!", MessageBoxButtons::YesNo) == Windows::Forms::DialogResult::Yes) {
NGame();
}
}
System::Void GameTicTacToe::Game::повернутисяВЛоббіToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
if (MessageBox::Show("Ви хочете повернутися в лоббі?", "Увагу!!", MessageBoxButtons::YesNo) == Windows::Forms::DialogResult::Yes) {
Loby^ form = gcnew Loby();
form->Show();
this->Hide();
}
}
System::Void GameTicTacToe::Game::вихідToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
if (MessageBox::Show("Ви хочете вийти з гри?", "Увагу!!", MessageBoxButtons::YesNo) == Windows::Forms::DialogResult::Yes) {
Application::Exit();
}
}
System::Void GameTicTacToe::Game::Fild_CellContentClick(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e)
{
auto senderGrid = (DataGridView^)sender;//преобр пол. обэкт в табл.
//Заполн инд. дан яч.
SelectCellPl.x = e->RowIndex;
SelectCellPl.y = e->ColumnIndex;
//+Ход
SetKordPlayer(SelectCellPl);
} |
|
Файл Gamer.cpp
| C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| #include "Gamer.h"
void Gamer::SetPool(GamerStat mode, int m)
{
if (mode == 0)
stat = Comp;
else if (mode == 1)
stat = Player;
else if (mode == 2)
stat = Player1;
else if (mode == 3)
stat = Player2;
mark = m;
} |
|
Файл Gamer.h
| C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| #pragma once
enum GamerStat {
Comp = 0,
Player = 1,
Player1 = 2,
Player2 = 3,
};
class Gamer {
// Поля
private:
GamerStat stat;
int mark;
// Методы
public:
Gamer() {}
~Gamer() {}
void SetPool(GamerStat mode, int m);
int GetMark() { return mark; }
GamerStat GetStatus() { return stat; }
}; |
|
Файл Loby.cpp
| C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
| #include "Loby.h"
#include "Game.h"
#include"AboutProgram.h"
#include"GameRules.h"
using namespace System;
using namespace System::Windows::Forms;
[STAThreadAttribute]
int main(array<String^>^ args) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
GameTicTacToe::Loby form;
Application::Run(% form);
}
System::Void GameTicTacToe::Loby::numericUpDown2_ValueChanged(System::Object^ sender, System::EventArgs^ e)
{
return System::Void();
}
System::Void GameTicTacToe::Loby::проПрограмуToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
AboutProgram^ form = gcnew AboutProgram;
form->Show();
}
System::Void GameTicTacToe::Loby::првилаГриToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
GameRules^ form = gcnew GameRules;
form->Show();
}
System::Void GameTicTacToe::Loby::StartGame_Click(System::Object^ sender, System::EventArgs^ e)
{
int indexGMod = ListBoxMod->SelectedIndex;
if (indexGMod == -1) {
MessageBox::Show("Обов'язково натисніть на режим гри!!", "Помилка!!");
return;
}
int size = Convert::ToInt32(Pool->Value);
int length = Convert::ToInt32(Longer->Value);
if (size < length) {
MessageBox::Show("Довжина вийгрошної комбінації не повина бути більше розміру ігрового поля!!. Помилка!!");
return;
}
Game^ form = gcnew Game();
form->row = size;
form->colonki = size;
form->length = length;
form->setGameMode = indexGMod;
form->Show();
this->Hide();
}
System::Void GameTicTacToe::Loby::вихідToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
Application::Exit();
} |
|
Файл MapGame.cpp
| C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
| #include "MapGame.h"
MapGame::MapGame()
{
size.x = 0;
size.y = 0;
length = 0;
map = new int* [size.x];
for (int i = 0; i < size.x; i++) {
map[i] = new int[size.y];
}
}
MapGame::MapGame(Vec _s, int l) {
//Обявляем карту
size = _s;
length = l;
map = new int* [size.x];
for (int i = 0; i < size.x; i++) {
map[i] = new int[size.y];
}
//Рестарт(0)
for (int i = 0; i < size.x; i++) {
for (int j = 0; j < size.y; j++) {
map[i][j] = 0;
}
}
}
MapGame::MapGame(int i, int j, int l)
{
//Создаем карту
size.x = i;
size.y = j;
length = l;
map = new int* [size.x];
for ( i = 0; i < size.x; i++) {
map[i] = new int[size.y];
}
//Рестарт(0)
for (i = 0; i < size.x; i++) {
for (j = 0; j < size.y; j++) {
map[i][j] = 0;
}
}
}
MapGame::~MapGame()
{
//Очистка динамки
for (int i = 0; i < size.x; i++) {
delete[] map[i];
}
delete[] map;
}
bool MapGame::Setkordinat(Vec cell, int c)
{
if (CheckCell(cell)) {
map[cell.x][cell.y] = c;
return true;
}
else {
return false;
}
}
bool MapGame::CheckCell(Vec cell)
{
if (map[cell.x][cell.y] == 0)
return true;
else
return false;
}
bool MapGame::CheckCell(int i, int j)
{
if (map[i][j] == 0)
return true;
else
return false;
}
void MapGame::SetMap(Vec _s, int l)
{
//Создаем карту
size = _s;
length = l;
map = new int* [size.x];
for (int i = 0; i < size.x; i++) {
map[i] = new int[size.y];
}
//Рестарт(0)
for (int i = 0; i < size.x; i++) {
for (int j = 0; j < size.y; j++) {
map[i][j] = 0;
}
}
}
void MapGame::SetMap(int i, int j, int l)
{
//Создаем карту
size.x = i;
size.y = j;
length = l;
map = new int* [size.x];
for (int i = 0; i < size.x; i++) {
map[i] = new int[size.y];
}
//Рестарт(0)
for (int i = 0; i < size.x; i++) {
for (int j = 0; j < size.y; j++) {
map[i][j] = 0;
}
}
}
int MapGame::GetV(Vec cell)
{
return map[cell.x][cell.y];
}
int MapGame::GetV(int i, int j)
{
return map[i][j];
}
int MapGame::CheckWin()
{
int statWin = 0;
std::vector<int> check;
//Поиск победы гориз.
for (int i = 0; i < size.x; i++) {
for (int j = 0; j < size.y; j++) {
check.push_back(map[i][j]);
}
//Поиск
statWin = CheckList(check);
check.clear();
if (statWin == 3) {
return 3;//ничья
}
else if (statWin == 2) {
return 2;//победа 2
}
else if (statWin == 1) {
return 1;//победа 1
}
}
//Поиск победы гориз.
for (int i = 0; i < size.x; i++) {
for (int j = 0; j < size.y; j++) {
check.push_back(map[j][i]);
}
//Поиск
statWin = CheckList(check);
check.clear();
if (statWin == 3) {
return 3;//ничья
}
else if (statWin == 2) {
return 2;//победа 2
}
else if (statWin == 1) {
return 1;//победа 1
}
}
//Поиск победы левые диаг.
//Глав. диаг. и свеху.
for (int i = 0; i < size.x; ++i)
{
for (int j = 0; i + j < size.y; ++j) {
check.push_back(map[i + j][j]);
}
//Поиск
statWin = CheckList(check);
check.clear();
if (statWin == 3) {
return 3;//ничья
}
else if (statWin == 2) {
return 2;//победа 2
}
else if (statWin == 1) {
return 1;//победа 1
}
}
//Под глав. диаг.
for (int i = 1; i < size.x; ++i)
{
for (int j = 0; i + j < size.y; ++j) {
check.push_back(map[i + j][j]);
}
//Поиск
statWin = CheckList(check);
check.clear();
if (statWin == 3) {
return 3;//ничья
}
else if (statWin == 2) {
return 2;//победа 2
}
else if (statWin == 1) {
return 1;//победа 1
}
}
//Поиск прав. диаг.
//Побоч. диаг и сверху
for (int j = size.y; j > 0; --j)
{
for (int i = 0; i < size.x; ++i) {
if (size.x - j - i >= 0) {
check.push_back(map[i ][size.x-j-i]);
}
}
//Поиск
statWin = CheckList(check);
check.clear();
if (statWin == 3) {
return 3;//ничья
}
else if (statWin == 2) {
return 2;//победа 2
}
else if (statWin == 1) {
return 1;//победа 1
}
}
//Под побоч. диаг
for (int j = 0; j < size.y; ++j) {
for (int i = 0; i < size.x; ++i)
{
if (size.x + j - i < size.x) {
check.push_back(map[i][size.x + j - i]);
}
}
//Поиск
statWin = CheckList(check);
check.clear();
if (statWin == 3) {
return 3;//ничья
}
else if (statWin == 2) {
return 2;//победа 2
}
else if (statWin == 1) {
return 1;//победа 1
}
}
if (CanMove())
return 0;//Нет побед.
else
return 3;
}
bool MapGame::CanMove()
{
for (int i = 0; i < size.x; i++) {
for (int j = 0; j < size.y; j++) {
if (map[i][j] == 0) {
return true;
}
}
}
return false;
}
Vec MapGame::GetCentr()
{
Vec centr;
int x;
if (size.x % 2 != 0) {
x = (size.x - 1) / 2;
}
else {
x = (size.x / 2) - 1;
}
centr.x = x;
centr.y = x;
return centr;
}
int MapGame::CheckList(std::vector<int> a)
{
if (a.size() < length)
return 0;
//Флаги
bool winP1 = false;
bool winP2 = false;
int count1 = 0, count2 = 0;
//Проверка очк.
for (int i = 0; i < a.size(); i++) {
for (int j = i; j < i + length; j++) {
if (j < a.size()) {
if (a[j] == 1) {
count1++;
}
}
else
break;
}
if (count1 >= length) {
winP1 = true;
break;
}
count1 = 0;
}
for (int i = 0; i < a.size(); i++) {
for (int j = i; j < i + length; j++) {
if (j < a.size()) {
if (a[j] == 2) {
count2++;
}
}
else
break;
}
if (count2 >= length) {
winP2 = true;
break;
}
count2 = 0;
}
//Вывод рез.
if (winP1 && winP2) {
return 3;//Ничья
}
else if (!winP1 && winP2) {
return 2;//Победил 2
}
else if (winP1 && !winP2) {
return 1;//Победил 1
}
else
return 0;
} |
|
Файл MapGame.h
| C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| #pragma once
#include <algorithm>
#include <vector>
struct Vec {
int x, y;
};
class MapGame
{
//Поля
private:
int** map;
Vec size;
int length;//Длина победы
//Мет клас
public:
MapGame();//Констр.
MapGame(Vec, int);//Констр.
MapGame(int, int, int);//Констр.
~MapGame();//Дестр.
bool Setkordinat(Vec, int);//Задать корд.
bool CheckCell(Vec);//Проверка на св. поз.
bool CheckCell(int, int);//Проверка на св. поз.
void SetMap(Vec, int);
void SetMap(int, int, int);
int GetV(Vec);
int GetV(int, int);
int GetLen() { return length; };
Vec GetSize() { return size; };
int CheckWin();
bool CanMove();
Vec GetCentr();
int CheckList(std::vector <int> a);
}; |
|
Ну вот это основные файлы еще есть AboutProgram.cpp, GameRules.cpp, AboutProgram.h, GameRules.h.Они роли не играют просто окна закрыть/открыть.
Проект создан в Visual Studio 2019. В студии 2022 может не открыть. Всем спасибо кто поможет!!!
0
|