Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Board {
- private:
- char b[10][10];
- const size_t size;
- public:
- Board();
- bool move(int x, int y, char sign);
- char get_cel(int x, int y) const;
- size_t size() const;
- char is_win() const;
- };
- class BoardView {
- private:
- Board *b;
- public:
- BoardView(Board *board);
- void start();
- private:
- void show();
- };
- void BoardView::start() {
- while (b->is_win() == ?) {
- while (/*некорректный ход*/) {
- scanf
- b->move
- }
- show()
- // сменить игрока
- }
- }
- void BoardView::show() {
- for(; b->size(); )
- for (; b->size();)
- }
- class BoardTest {
- private:
- int tests;
- int failed;
- public:
- void test_move();
- void test_win();
- void test_win_diag();
- void test_all();
- void show_stat();
- };
- void BoardTest::test_move() {
- Board b();
- if (b.move(-10, 0, 'X') == true) {
- //printf("Сломался move в BoardTest"); - заменили на DO_CHECK(см прак Филатова)
- failed++;
- }
- tests++;
- }
- void BoardTest::test_all() {
- test_move();
- test_win();
- test_win_diag();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement