int NCurseGui::printGame(const Snake& snake, const Apple & apple) { std::deque<std::pair<int, int> > s = snake.getSnake(); std::deque<std::pair<int, int> >::const_iterator it = s.begin(); int apple_color; if (apple.getAge() <= apple.getBonusAge()) apple_color = 4; else if (apple.getAge() > apple.getRottenAge()) apple_color = 5; else apple_color = 1; wborder(_win, '|', '|', '_', '_', ' ', ' ', '|', '|'); wattron(_win, COLOR_PAIR(3)); mvwprintw(_win, it->first + 1, it->second * 2 + 1, " "); wattroff(_win, COLOR_PAIR(3)); while (++it != s.end()) { wattron(_win, COLOR_PAIR(2)); mvwprintw(_win, it->first + 1, it->second * 2 + 1, " "); wattroff(_win, COLOR_PAIR(2)); } wattron(_win, COLOR_PAIR(apple_color)); mvwprintw(_win, apple.getApple().first + 1, apple.getApple().second * 2 + 1, " "); wattroff(_win, COLOR_PAIR(apple_color)); std::pair<size_t, size_t> lastLink = snake.getLastChain(); mvwprintw(_win, lastLink.first + 1, lastLink.second * 2 + 1, lastLink.first + 1 == _height ? "__" : " "); wrefresh(_win); return 0; }