123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #include <iostream>
- #include "Const.h"
- #include "Field.h"
- char field[columns]{}; //Ìàññèâ èãðîâîãî ïîëÿ
- //Ñîçäàíèå ïóñòîãî èãðîâîãî ïîëÿ
- void init_field()
- {
- field[0] = field[columns - 1] = '*';//óñòàíîâêà ãðàíèö
- clear_field();
- }
- //Ìàññèâ èãðîâîãî ïîëÿ çàïîëíÿåòñÿ ñèìâîëîì-çàïîëíèòåëåì.
- void clear_field()
- {
- for (int i = 1; i < columns - 1; i++)//çàïîëíåíèå ïîëÿ ïóñòûìè ñèìâîëàìè
- {
- field[i] = field_symbol;
- }
- }
- //Ìàññèâ èãðîâîãî ïîëÿ âûâîäèòñÿ íà ýêðàí.
- void print_field()//Ìàññèâ èãðîâîãî ïîëÿ âûâîäèòñÿ íà ýêðàí.
- {
- for (int i = 0; i < columns; i++)
- {
- std::cout << border_symbol;
- }
- std::cout << std::endl;
- for (int i = 0; i < columns; i++)
- {
- std::cout << field[i];
- }
- std::cout << std::endl;
- for (int i = 0; i < columns; i++)
- {
- std::cout << border_symbol;
- }
- std::cout << std::endl;
- }
|