Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
eric15342335 authored Apr 18, 2024
2 parents b5f1a55 + dee42e5 commit 32db764
Show file tree
Hide file tree
Showing 17 changed files with 1,162 additions and 99 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Setup Doxygen
- name: Install and run doxygen via Chocolatey
run: |
sudo apt-get update -y
sudo apt-get install doxygen graphviz -y
choco install doxygen.portable graphviz --yes -r --no-progress
doxygen Doxyfile
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
7 changes: 4 additions & 3 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
QUIET = YES
USE_MDFILE_AS_MAINPAGE = README.md
# SOURCE_BROWSER = YES
# SOURCE_BROWSER = YES
VERBATIM_HEADERS = NO
# INLINE_SOURCES = YES
# INLINE_SOURCES = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_RELATION = YES
HTML_TIMESTAMP = YES
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 200
Expand All @@ -18,3 +18,4 @@ LATEX_TIMESTAMP = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES
INTERACTIVE_SVG = YES
HTML_COLORSTYLE = TOGGLE
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ events.o: events.h events.cpp
names.o: names.h names.cpp
g++ -Wall -Wextra -std=c++11 -c names.cpp -o names.o

format.o: format.cpp format.h
g++ -Wall -Wextra -std=c++11 -c format.cpp -o format.o

draw.o: draw.cpp draw.h format.h
g++ -Wall -Wextra -std=c++11 -c draw.cpp -o draw.o

graph.o: graph.h graph.cpp
g++ -Wall -Wextra -std=c++11 -c graph.cpp -o graph.o

stocksim: main.cpp stock.o random_price.o events.o names.o
g++ -Wall -Wextra -std=c++11 main.cpp stock.o random_price.o events.o names.o -o stocksim
stocksim: main.cpp stock.o random_price.o events.o names.o format.o draw.o
g++ -Wall -Wextra -std=c++11 main.cpp stock.o random_price.o events.o names.o format.o draw.o -o stocksim

test: stocksim
./stocksim
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Team members
| Name | UID | Profile |
|-----------------|------------|-------------------------------------------|
| Cheng Ho Ming | 3036216734 | [Link](https://github.com/eric15342335) |
| Chung Shing Hei | 3036216760 | [Link](https://github.com/MaxChungsh) |
| Chow Yui Hei | 3036222446 | [Link](https://github.com/Prismatiscence) |
| Chu Chun Yin | 3036270778 | [Link](https://github.com/84ds84d8s) |
| Wong Sonny | 3036222458 | [Link](https://github.com/comet13579) |
| Name | UID | Profile |
|-----------------|------------|------------------------------------------------------------------------------------------------------------------------|
| Cheng Ho Ming | 3036216734 | <a href="https://github.com/eric15342335"><img src="https://avatars.githubusercontent.com/u/70310617" width="40px"/> |
| Chung Shing Hei | 3036216760 | <a href="https://github.com/MaxChungsh"><img src="https://avatars.githubusercontent.com/u/70740754" width="40px"/> |
| Chow Yui Hei | 3036222446 | <a href="https://github.com/Prismatiscence"><img src="https://avatars.githubusercontent.com/u/56928422" width="40px"/> |
| Chu Chun Yin | 3036270778 | <a href="https://github.com/84ds84d8s"><img src="https://avatars.githubusercontent.com/u/129842660" width="40px"/> |
| Wong Sonny | 3036222458 | <a href="https://github.com/comet13579"><img src="https://avatars.githubusercontent.com/u/67854955" width="40px"/> |
# Game Description
"Stock Market Simulator" is a text-based game that attempts to introduce a realistic <br>
stock buying experience to the players. The game utilizes the random number generation <br>
Expand Down
87 changes: 87 additions & 0 deletions draw.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#include <iostream>
#include <string>
#include <vector>
#include "draw.h"
#include "format.h"

void drawRoundInfo(int row, int col, int round, float balance) {
row++; // Shutup compiler
std::cout << setCursorPosition(3, 5);
std::cout << "Round " << round;
std::cout << setCursorPosition(3, col - 10);
std::cout << "$" << balance;
}

void drawEventBar(int row, int col) {
row++; // Shutup compiler
int width = col - 30;

std::cout << setCursorPosition(2, 15) << "\u250C";
for (int i = 0; i < width - 1; i++) {
std::cout << "\u2500";
}
std::cout << "\u2510" << setCursorPosition(3, 15) << "\u2502";
std::cout << setCursorPosition(3, width + 15) << "\u2502";
std::cout << setCursorPosition(4, 15) << "\u2514";
for (int i = 0; i < width - 1; i++) {
std::cout << "\u2500";
}
std::cout << "\u2518";
}

void listEvents(int row, int col) {
// later do
row++;
col++;
}

void drawButton(int row, int col) {
int width;
int buttons;

std::vector<std::string> options = {"[B] Buy", "[S] Sell", "[E] Events", "[O] Options", "[X] Exit"}; // Add stuff here

buttons = options.size();
width = (int)(col / buttons);
std::cout << setCursorPosition(row - 2, 3);
for (int i = 0; i < buttons; i++) {
i % 2 == 0 ? std::cout << textBlack << bgWhite : std::cout << textWhite << bgBlack;
for (int j = 0; j < width; j++) {
std::cout << " ";
}
}
std::cout << textReset << setCursorPosition(row - 1, 3);
for (int i = 0; i < buttons; i++) {
i % 2 == 0 ? std::cout << bgWhite << textBlack : std::cout << bgBlack << textWhite;
for (int j = 0; j < (int)((width - options[i].length()) / 2); j++) {
std::cout << " ";
}
std::cout << textBold << options[i] << "\x1b[22m";
for (int j = 0; j < (int)(width - options[i].length() - (width - options[i].length()) / 2); j++) {
std::cout << " ";
}
}
std::cout << textReset << setCursorPosition(row, 3);
for (int i = 0; i < buttons; i++) {
i % 2 == 0 ? std::cout << textBlack << bgWhite : std::cout << textWhite << bgBlack;
for (int j = 0; j < width; j++) {
std::cout << " ";
}
}
std::cout << textReset << "\n";
}

/*
int main() {
int row;
int col;
while (1) {
fetchConsoleDimensions(row, col);
drawEventBar(row, col);
drawButton(row, col);
sleep(200);
std::cout << textClear;
}
return 0;
}
*/
9 changes: 9 additions & 0 deletions draw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef DRAW_H
#define DRAW_H

void drawRoundInfo(int row, int col, int round, float balance);
void drawEventBar(int row, int col);
void listEvents(int row, int col);
void drawButton(int row, int col);

#endif
Loading

0 comments on commit 32db764

Please sign in to comment.