20 const int wordWidth = 73;
21 const int wordHeight = 8;
22 std::vector<std::string> logo =
parseLogo();
27 if (row > wordHeight && col > wordWidth) {
29 for (
int i = 0; i < 9; i++) {
30 std::cout << logo[i] <<
"\n";
35 for (
int i = 9; i < 18; i++) {
36 std::cout << logo[i] <<
"\n";
41 for (
int i = 18; i < 27; i++) {
42 std::cout << logo[i] <<
"\n";
47 std::cout <<
"Welcome to Stock Market Simulator!\n";
53 int row,
int col,
int round,
float balance, std::string player,
float indexHSI) {
56 std::cout <<
"Round " << round;
58 if (player.size() > 15) {
60 std::cout << player.erase(12) <<
"...";
64 4,
static_cast<int>((15 - player.size()) / 2 + 1));
70 std::cout <<
" HSI: " << indexHSI;
78 for (
int i = 0; i < width - 1; i++) {
79 std::cout <<
"\u2500";
84 for (
int i = 0; i < width - 1; i++) {
85 std::cout <<
"\u2500";
87 std::cout <<
"\u2518";
90void listEvents(
int row,
int col, std::vector<Stock_event> events) {
94 if (
static_cast<int>(events.size()) < row - 10) {
95 if (
static_cast<int>(events.size()) != 0) {
96 height =
static_cast<int>(events.size()) + 2;
107 for (
int i = 0; i < width - 1; i++) {
108 std::cout <<
"\u2500";
110 std::cout <<
"\u2510";
111 for (
int i = 0; i < height; i++) {
113 std::cout <<
"\u2502";
115 std::cout <<
"\u2502";
118 for (
int i = 0; i < width - 1; i++) {
119 std::cout <<
"\u2500";
121 std::cout <<
"\u2518";
124 for (
int i = 0; i < width - 1; i++) {
127 if (
static_cast<int>(events.size()) == 0) {
129 std::cout <<
"There are currently no events!";
130 for (
int i = 0; i < width - 31; i++) {
134 for (
int i = 0; i < width - 1; i++) {
139 for (
int i = 1; i < static_cast<int>(events.size()) + 1; i++) {
141 std::cout << i <<
". " << events[i - 1].text;
142 int digits = (((i) / 10) + 1);
144 j < width -
static_cast<int>(events[i - 1].text.size()) - 3 - digits;
149 std::cout << setCursorPosition(static_cast<int>(events.size()) + 8, 11);
150 for (
int i = 0; i < width - 1; i++) {
160 std::vector<std::string> options = {
"[B] Buy",
"[S] Sell",
"[T] Toggle View",
161 "[E] Events",
"[N] Next Round",
"[X] Exit"};
163 buttons = options.size();
164 width = (col / buttons);
167 for (
int i = 0; i < buttons; i++) {
170 for (
int j = 0; j < static_cast<int>((width - options[i].length()) / 2); j++) {
173 std::cout <<
textBold << options[i] <<
"\x1b[22m";
174 for (
int j = 0; j < static_cast<int>((width - options[i].length() -
175 (width - options[i].length()) / 2));
static void sleep(int dur)
void drawEventBar(int row, int col)
void listEvents(int row, int col, std::vector< Stock_event > events)
void drawButton(int row, int col)
void drawRoundInfo(int row, int col, int round, float balance, std::string player, float indexHSI)
void drawLogo(int row, int col)
Function declarations for drawing/display of various elements.
vector< string > parseLogo(void)
returns the game logo, which is hardcoded inside the function.
Header files for file operation functions related to the game.
float balance
Player's balance.