Advertisement
titovtima

lecture_for_hw_2

Dec 5th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. class Board {
  2. private:
  3.     char b[10][10];
  4.     const size_t size;
  5. public:
  6.     Board();
  7.     bool move(int x, int y, char sign);
  8.     char get_cel(int x, int y) const;
  9.     size_t size() const;
  10.     char is_win() const;
  11. };
  12.  
  13. class BoardView {
  14. private:
  15.     Board *b;
  16. public:
  17.     BoardView(Board *board);
  18.     void start();
  19. private:
  20.     void show();
  21. };
  22.  
  23. void BoardView::start() {
  24.     while (b->is_win() == ?) {
  25.         while (/*некорректный ход*/) {
  26.             scanf
  27.             b->move
  28.         }
  29.         show()
  30.         // сменить игрока
  31.     }
  32. }
  33.  
  34. void BoardView::show() {
  35.     for(; b->size(); )
  36.         for (; b->size();)
  37. }
  38.  
  39. class BoardTest {
  40. private:
  41.     int tests;
  42.     int failed;
  43. public:
  44.     void test_move();
  45.     void test_win();
  46.     void test_win_diag();
  47.     void test_all();
  48.     void show_stat();
  49. };
  50.  
  51. void BoardTest::test_move() {
  52.     Board b();
  53.     if (b.move(-10, 0, 'X') == true) {
  54.         //printf("Сломался move в BoardTest"); - заменили на DO_CHECK(см прак Филатова)
  55.         failed++;
  56.     }
  57.     tests++;
  58. }
  59.  
  60. void BoardTest::test_all() {
  61.     test_move();
  62.     test_win();
  63.     test_win_diag();
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement