-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualization_interface.cpp
59 lines (50 loc) · 1.59 KB
/
visualization_interface.cpp
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
#include <iostream>
#include "functions_definitions.h"
#include "conio.h"
#include "board.h"
void p1(Board* table_of_boards, Player* table_of_player_1, Player* table_of_player_2, int index)
{
clrscr();
gotoxy(95, 7);
std::cout << "[N] -> next state of the game";
gotoxy(95, 8);
std::cout << "[P] -> previous state of the game";
gotoxy(95, 9);
std::cout << "[D] -> database";
gotoxy(95, 10);
std::cout << "[Q] -> quit";
gotoxy(20, 2);
std::cout << "Visualization of the BackGammon game at state: " << index;
gotoxy(20, 4);
std::cout << table_of_player_1[index].name << ": " << table_of_player_1[index].points;
gotoxy(20, 5);
std::cout << table_of_player_2[index].name << ": " << table_of_player_2[index].points;
}
void p2(Board* table_of_boards, Player* table_of_player_1, Player* table_of_player_2, int index)
{
for (size_t i = 0; i < table_of_player_1[index].number_of_removed_pawns; i++)
{
gotoxy(42 + i + 2, 30);
textcolor(LIGHTCYAN);
std::cout << "B";
}
textcolor(LIGHTGRAY);
gotoxy(20, 32);
std::cout << "Player 2 removed pawns: ";
for (size_t i = 0; i < table_of_player_2[index].number_of_removed_pawns; i++)
{
gotoxy(42 + i + 2, 32);
textcolor(LIGHTRED);
std::cout << 'R';
}
}
void print_visualization_interface(Board* table_of_boards, Player* table_of_player_1, Player* table_of_player_2, int index)
{
p1(table_of_boards, table_of_player_1, table_of_player_2, index);
gotoxy(20, 7);
print_table(&table_of_boards[index]);
gotoxy(20, 30);
std::cout << "Player 1 removed pawns: ";
p2(table_of_boards, table_of_player_1, table_of_player_2, index);
textcolor(LIGHTGRAY);
}