From 63343fc5813bed33b93485d27b7b5158a1dfdb11 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Mar 2020 16:34:35 -0700 Subject: [PATCH] commit --- .gitlab-ci.yml | 64 +++++++++++------------ main/Quotes.cpp | 78 ++++++++++++++++++++++++++++ main/Quotes.h | 28 +++++++++++ main/main.cpp | 92 +++++++++++++++++++++++++++++++++ src/Entity.cpp | 120 ++++++++++++++++++-------------------------- src/Entity.h | 41 ++++++++------- src/Grid.cpp | 117 +++--------------------------------------- src/Grid.h | 29 +++++++---- src/Moves.cpp | 30 +---------- src/Moves.h | 28 ++++++----- src/a.out | Bin 19880 -> 0 bytes src/main.cpp | 48 ++++-------------- src/test_driver.cpp | 14 +----- test/QuotesTest.cpp | 37 +------------- 14 files changed, 357 insertions(+), 369 deletions(-) create mode 100644 main/Quotes.cpp create mode 100644 main/Quotes.h create mode 100644 main/main.cpp delete mode 100644 src/a.out diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f84d3c9..869eb2f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,38 +94,38 @@ code_coverage: expire_in: 7 days -# deploy_prod: -# stage: deploy -# before_script: -# - apt-get update -qq -# - apt-get install -qq curl -# - 'which ssh-agent || ( apt-get install -qq openssh-client )' -# - eval $(ssh-agent -s) -# - ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d -w 0) -# - mkdir -p ~/.ssh -# - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' -# script: -# - ELF_NAME="${CI_PROJECT_NAMESPACE}-quotes" -# - SSH_COMMAND_STRING="if pgrep ${ELF_NAME}; then pkill ${ELF_NAME}; fi && " -# # Double quotes around everything needed as it has a colon in it -# - "SSH_COMMAND_STRING+=\"curl --location --header 'PRIVATE-TOKEN: ${API_TOKEN}' '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_BUILD_REF_NAME}/raw/build/quotes?job=build_programs' --output ${ELF_NAME} &&\" " -# # Make sure the file is executable -# - SSH_COMMAND_STRING+="chmod +x ${ELF_NAME} && " -# # Start it in the background in such a way that SSH will not hang when we exit -# - SSH_COMMAND_STRING+="(nohup ./${ELF_NAME} ${RUN_PORT} > /dev/null 2>&1 &) && " -# # Make sure the program is running, if it is, we exit gracefully -# - SSH_COMMAND_STRING+="if pgrep ${ELF_NAME}; then exit; fi && " -# # If the program is not running, exit with an error code to say something went wrong -# - SSH_COMMAND_STRING+="exit 1" -# # Print it out so we can see what happened for debugging purposes. -# - echo "$SSH_COMMAND_STRING" -# # Execute the deploy -# - ssh $SSH_USER@$SSH_HOST "${SSH_COMMAND_STRING}" -# # Make sure it is running -# - "curl --location http://${SSH_HOST}:${RUN_PORT} | grep \"Go to /quote/# or /random to get a quote.\"" -# when: manual -# only: -# - master +deploy_prod: + stage: deploy + before_script: + - apt-get update -qq + - apt-get install -qq curl + - 'which ssh-agent || ( apt-get install -qq openssh-client )' + - eval $(ssh-agent -s) + - ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 -d -w 0) + - mkdir -p ~/.ssh + - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + script: + - ELF_NAME="${CI_PROJECT_NAMESPACE}-quotes" + - SSH_COMMAND_STRING="if pgrep ${ELF_NAME}; then pkill ${ELF_NAME}; fi && " + # Double quotes around everything needed as it has a colon in it + - "SSH_COMMAND_STRING+=\"curl --location --header 'PRIVATE-TOKEN: ${API_TOKEN}' '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/artifacts/${CI_BUILD_REF_NAME}/raw/build/quotes?job=build_programs' --output ${ELF_NAME} &&\" " + # Make sure the file is executable + - SSH_COMMAND_STRING+="chmod +x ${ELF_NAME} && " + # Start it in the background in such a way that SSH will not hang when we exit + - SSH_COMMAND_STRING+="(nohup ./${ELF_NAME} ${RUN_PORT} > /dev/null 2>&1 &) && " + # Make sure the program is running, if it is, we exit gracefully + - SSH_COMMAND_STRING+="if pgrep ${ELF_NAME}; then exit; fi && " + # If the program is not running, exit with an error code to say something went wrong + - SSH_COMMAND_STRING+="exit 1" + # Print it out so we can see what happened for debugging purposes. + - echo "$SSH_COMMAND_STRING" + # Execute the deploy + - ssh $SSH_USER@$SSH_HOST "${SSH_COMMAND_STRING}" + # Make sure it is running + - "curl --location http://${SSH_HOST}:${RUN_PORT} | grep \"Go to /quote/# or /random to get a quote.\"" + when: manual + only: + - master variables: diff --git a/main/Quotes.cpp b/main/Quotes.cpp new file mode 100644 index 0000000..5671cbc --- /dev/null +++ b/main/Quotes.cpp @@ -0,0 +1,78 @@ +/************************************************************************* + * + * Homework 4: Exploring continuous deployment. + * + * File Name: quote.cpp + * Course: CPTR 245 + * + */ + +#include "Quotes.h" +#include +#include +#include + +Quotes::Quotes(unsigned int seed) { + this->seed = seed; + + quotes = { + {"Andrew Platner", "", ""}, + {"Austin Garner", + "Men talk of killing time, while time quietly kills them.", + "Dion Boucicault"}, + {"Cameron Bierwagen", "", ""}, + {"Elon Bontemps", + "True humility is not thinking less of yourself; it is thinking of " + "yourself less", + "C.S. Lewis"}, + {"Ivan Guillen", + "Logic will get you from A to B. Imagination will take you " + "everywhere.", + "Albert Einstein"}, + {"James Foster", + "The most disastrous thing that you can ever learn is your first " + "programming language.", + "Alan Kay"}, + {"Jarod Owen", "I do not fear computers. I fear lack of them.", + "Isaac Asimov"}, + {"Jeff Peters", "God does not play dice with the universe.", + "A. Einstein"}, + {"Kaelan Willauer", + "Action without a name, a 'who' attached to it, is meaningless.", + "St. Jerome"}, + {"Luke Hagan", "", ""}, + {"Luke Irvine", + "Life is what happens when you're busy making other plans.", "Lennon"}, + {"Michael Stacy", + "Measuring programming progress by number of lines " + "is like measuring aircraft build process by the weight", + "anonymous author"}, + {"Nelson Phillips", "Ogres are like onions, they have layers", "Shrek"}, + {"Noah Olsen", "The greatest teacher, failure is", "Master Yoda"}, + {"Owen Hoffman", "", ""}, + {"Welcome! Please select a menu option.", "Talk is cheap. Show me the code.", + "Linus Torvalds"}, + {"Samuel Nguyen", "", ""}, + {"Trevor Claridge", + "Its easy to make frends if you let pepul laff at you.", + "Daniel Keyes"}, + {"Trevor Natiuk", + "Before you marry a person, you should first make " + "them use a computer with slow Internet to see who they really are", + "Will Ferrell"}, + {"Will Hensel", + "The question of whether a computer can think is no more " + "interesting than the question of whether a submaring can swim.", + "Edsger W. Dijkstra"}, + }; +} + +Quote Quotes::getRandomQuote() { + int index = rand_r(&seed) % quotes.size(); + return quotes.at(index); +} + +Quote Quotes::getQuote(int id) { + int index = id % quotes.size(); + return quotes.at(index); +} diff --git a/main/Quotes.h b/main/Quotes.h new file mode 100644 index 0000000..c290867 --- /dev/null +++ b/main/Quotes.h @@ -0,0 +1,28 @@ +/************************************************************************* + * + * Homework 4: Exploring continuous deployment. + * + * File Name: quote.h + * Course: CPTR 245 + * + */ + +#include +#include + +struct Quote { + std::string student; + std::string quote; + std::string author; +}; + +class Quotes { + private: + std::vector quotes; + unsigned int seed; + + public: + explicit Quotes(unsigned int); + Quote getRandomQuote(); + Quote getQuote(int); +}; diff --git a/main/main.cpp b/main/main.cpp new file mode 100644 index 0000000..7070f77 --- /dev/null +++ b/main/main.cpp @@ -0,0 +1,92 @@ +/************************************************************************* + * + * Homework 4: Exploring continuous deployment. + * + * File Name: quote.cpp + * Course: CPTR 245 + * + */ + +#include +#include +#include +#include +#include +#include "Quotes.h" + +std::vector explode(const std::string &s, const char &c) { + std::string buff; + std::vector v; + + for (auto n : s) { + if (n != c) { + buff += n; + } else if (n == c && !buff.empty()) { + v.push_back(buff); + buff = ""; + } + } + + if (!buff.empty()) { + v.push_back(buff); + } + + return v; +} + +int main(int argc, char **argv) { + if (argc != 2) { + std::cerr << "You must provide a port to run on" << std::endl; + return -1; + } + int port = 0; + + try { + port = std::stoi(argv[1]); + } catch (const std::invalid_argument &e) { + std::cerr << "Invalid port specified" << std::endl; + return -1; + } + + if (port < 1024 || port > 65535) { + std::cerr << "Port is not in allowable range" << std::endl; + return -1; + } + + httplib::Server svr; + + svr.Get("/", [](const httplib::Request &req, httplib::Response &res) { + res.set_content("Go to /quote/# or /random to get a quote.", "text/plain"); + }); + + svr.Get("/random", + [](const httplib::Request &req, httplib::Response &res) { + Quotes myQuotes(time(NULL)); + Quote quote = myQuotes.getRandomQuote(); + + std::string output = "Today's Random Quote was submitted by " + + quote.student + ".\n\n" + "\"" + quote.quote + + "\"\n ~ " + quote.author + "\n"; + + res.set_content(output, "text/plain"); + }); + + svr.Get(R"(/quote/([0-9]+))", + [](const httplib::Request &req, httplib::Response &res) { + auto urlExploded = explode(req.matches[0], '/'); + auto numbers = std::vector(urlExploded.begin() + 1, + urlExploded.end()); + + Quotes myQuotes(time(NULL)); + Quote quote = myQuotes.getQuote(std::stoi(numbers[0])); + std::string output = "Today's Quote was submitted by " + + quote.student + ".\n\n" + "\"" + quote.quote + + "\"\n ~ " + quote.author + "\n"; + + res.set_content(output, "text/plain"); + }); + + svr.listen("0.0.0.0", port); + + return 0; +} diff --git a/src/Entity.cpp b/src/Entity.cpp index a12b068..b6ee7d4 100644 --- a/src/Entity.cpp +++ b/src/Entity.cpp @@ -4,12 +4,14 @@ #include #include #include -#include "Grid.h" #include "Moves.h" -using namespace std; - -class MoveSet; +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; // void Entity::action() {} @@ -17,13 +19,18 @@ void Entity::move() { } void Entity::setPos() { + srand(time(0)); // Random Positioning - this->colPos = rand() % 4; - this->rowPos = rand() % 4; + this->colPos = rand_r() % 3; + this->rowPos = rand_r() % 3; } bool Entity::checkHealth() { - return (con > 0); + bool life = true; + if (con <= 0) { + life = false; + } + return life; } Player::Player() { @@ -31,41 +38,20 @@ Player::Player() { this->con = 10; this->str = 10; this->dex = 10; - // setClass('a'); } void Player::action() { char act; - do { - cout << "What will you do?" << endl; - cout << " a. Light Attack" << endl; - cout << " b. Heavy Attack" << endl; - cout << " c. Defend" << endl; - cout << " d. Counter" << endl; - cout << " e. Flee" << endl; - cout << " Enter Action Here: "; - cin >> act; - - switch (act) { - case 'a': - // callLightAttack(); - break; - case 'b': - // callHeavyAttack(); - break; - case 'c': - // callDefend(); - break; - case 'd': - break; - case 'e': - break; - default: - cout << "Please enter a valid option." << endl; - break; - } - } while (act != 'a' && act != 'b' && act != 'c' && act != 'd' && - act != 'e' && act != 'f'); + cout << "What will you do?" << endl; + cout << " a. Light Attack" << endl; + cout << " b. Heavy Attack" << endl; + cout << " c. Defend" << endl; + cout << " d. Counter" << endl; + cout << " f. Flee" << endl; + cout << " Enter Action Here: "; + cin >> act; + + switch (act) {} } void Player::setClass(char Class) { @@ -77,28 +63,16 @@ void Player::setClass(char Class) { break; case 'b': // Rogue break; + case 'c': // Mage + break; } } -void Enemy::action() { - int act = rand() % 10; - if (con <= 2) { - // Attempt flee - } else { - if (act <= 2) { - // Heavy Attack - } else if (act >= 3 && act <= 5) { - // Light Attack - } else if (act >= 6 && act <= 8) { - // Defend - } else if (act >= 9) { - // Counter - } - } -} +void Enemy::setBossClass() { + srand(time(0)); + int monster = rand_r() % 3; // Boss Monster Randomization -void Enemy::setBossClassByChoice(int boss) { - switch (boss) { + switch (monster) { case 1: // Minotaur this->str = 16; this->con = 14; @@ -117,12 +91,6 @@ void Enemy::setBossClassByChoice(int boss) { } } -void Enemy::setBossClassByRand() { - int monster = rand() % 3; // Boss Monster Randomization - - setBossClassByChoice(monster); -} - void Enemy::setClassByChoice(int monster) { switch (monster) { case 1: // Goblin @@ -144,16 +112,28 @@ void Enemy::setClassByChoice(int monster) { } void Enemy::setClassByRand() { - int monster = rand() % 3; // Monster Randomization + srand(time(0)); + int monster = rand_r() % 3; // Monster Randomization - setClassByChoice(monster); + switch (monster) { + case 1: // Goblin + this->str = 6; + this->con = 6; + this->dex = 12; + break; + case 2: // Orc + this->str = 14; + this->con = 10; + this->dex = 8; + break; + case 3: // Skeleton + this->str = 8; + this->con = 10; + this->dex = 10; + break; + } } -Enemy::Enemy(bool boss) { +Enemy::Enemy() { setPos(); - if (boss) { - setBossClassByRand(); - } else { - setClassByRand(); - } } diff --git a/src/Entity.h b/src/Entity.h index 1081e05..292f3e6 100644 --- a/src/Entity.h +++ b/src/Entity.h @@ -1,24 +1,28 @@ // "Copyright [year] " -#ifndef ENTITY_H -#define ENTITY_H +#ifndef SRC_ENTITY_H_ +#define SRC_ENTITY_H_ + +// no includes? +#include + +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; class MoveSet; class Entity { - public: + public: bool checkHealth(); void move(); void setPos(); - int getCol() { - return colPos; - } - int getRow() { - return rowPos; - } virtual void action() const = 0; + virtual void setClass() const = 0; - protected: - // MoveSet* moves; + protected: int colPos; int rowPos; int con; @@ -27,29 +31,28 @@ class Entity { }; class Player : public Entity { - public: + public: Player(); void action(); void setClass(char Class); - private: + private: // Vector of inventory items // Vector of equipped items }; class Enemy : public Entity { - public: - Enemy(bool boss); + public: + Enemy(); void action(); - void setBossClassByChoice(int boss); - void setBossClassByRand(); + void setBossClass(); void setClassByRand(); void setClassByChoice(int monster); bool seesPlayer(); - private: + private: // Vector of drop items // Vector of equipped items }; -#endif +#endif // SRC_ENTITY_H_ diff --git a/src/Grid.cpp b/src/Grid.cpp index 300cc62..f1324bd 100644 --- a/src/Grid.cpp +++ b/src/Grid.cpp @@ -1,115 +1,12 @@ // "Copyright [year] " #include #include -using namespace std; -#include "Grid.h" - -// randomly generate grid and start score at 0 -// Ensure player and enemies start at different places - -// define the functions for grid -char Grid::getDirection() { - cout << "Where do you want to go?" << endl; - cout << "Please enter u for up, r for right, d for down, l for left, or m " - "for a random direction." - << endl; - cin >> direction; - return direction; -} +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; -// 2D array using subtraction in direction -/*int Grid::move(int GridRows, int GridColumns, char direction) { - if (direction == 'u') { - if ((room == 3) || (room == 2) || (room == 1)) { - } else { - room = room - 3; - } - } else if (direction == 'r') { - if ((room == 3) || (room == 6) || (room == 9)) { - } else { - room = room + 1; - } - } else if (direction == 'd') { - if ((room == 7) || (room == 8) || (room == 9)) { - } else { - room = room + 3; - } - } else if (direction == 'l') { - if ((room == 1) || (room == 4) || (room == 7)) { - } else { - room = room - 1; - } - } else if (direction == 'm') { - room = move(room, getRandDirection()); - } else { - cout << "Invalid entry. Please input valid entry. "; - room = move(room, getDirection()); - } - return room; -}*/ -int Grid::move(int GridRows, int GridColumns, char direction) { - if (direction == 'u') { - if ((GridRows == 4) || (GridRows == 3) || (GridRows == 2) || - (GridRows == 1)) { - } else { - GridRows += 1; - } - } else if (direction == 'r') { - if ((GridColumns == 4) || (GridColumns == 8) || (GridColumns == 12) || - (GridColumns == 16)) { - } else { - GridColumns += 1; - } - } else if (direction == 'd') { - if ((GridRows == 13) || (GridRows == 14) || (GridRows == 15) || - (GridRows == 16)) { - } else { - GridRows -= 1; - } - } else if (direction == 'l') { - if ((GridColumns == 1) || (GridColumns == 5) || (GridColumns == 9) || - (GridColumns == 13)) { - } else { - GridColumns -= 1; - } - } else if (direction == 'm') { - move(GridRows, GridColumns, getRandDirection()); - } -} - -char Grid::getRandDirection() { - otherDirection = rand() % 5 + 1; - if (otherDirection == 5) { - return 'u'; - } else if (otherDirection == 3) { - return 'r'; - } else if (otherDirection == 4) { - return 'd'; - } else { - return 'l'; - } -} - -void Grid::printGrid(int GridRows, int GridColumns) { - char grid[GridRows][GridColumns]; - for (int i = 0; i < GridRows; i++) { - for (int j = 0; j < GridColumns; j++) { - grid[i][j] = '.'; - cout << grid[i][j]; - } - cout << endl; - } -} -/*void Grid::printGrid(int player, int bosses) { - char grid[10]; - for (int i = 0; i < 10; i++) { - grid[i] = '.'; - } - grid[player] = 'P'; - grid[bosses] = 'B'; - cout << grid[1] << grid[2] << grid[3] << endl; - cout << grid[4] << grid[5] << grid[6] << endl; - cout << grid[7] << grid[8] << grid[9] << endl; -}*/ -// 2D array print inside a nested loop +#include "Grid.h" diff --git a/src/Grid.h b/src/Grid.h index 73da287..a55dbbc 100644 --- a/src/Grid.h +++ b/src/Grid.h @@ -1,24 +1,31 @@ // "Copyright [year] " +#ifndef SRC_GRID_H_ +#define SRC_GRID_H_ + #include #include -using namespace std; +#include + +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; class Grid { - public: - // Grid(); + public: + Grid(); char getDirection(); char getRandDirection(); - int move(int GridRows, int GridColumns, char direction); - // void printGrid(); - void printGrid(int GridRows, int GridColumns); + int move_(int room, char direction); // changed function name due to + void printGrid(int player, int bosses); // library conflict - private: - int seed; + private: int room; int player; int bosses; char direction; - int otherDirection; - int GridRows; - int GridColumns; }; + +#endif // SRC_GRID_H_ diff --git a/src/Moves.cpp b/src/Moves.cpp index ce3d447..fd8ccf0 100644 --- a/src/Moves.cpp +++ b/src/Moves.cpp @@ -1,31 +1,3 @@ // "Copyright [year] " -#include "Moves.h" -#include -#include -#include -using namespace std; -int MoveSet::callLightAttack() { - int LightAttack = 0; - LightAttack = rand() % 10 + 1; - return LightAttack; -} - -int MoveSet::callHeavyAttack() { - int HeavyAttack = 0; - HeavyAttack = rand() % 10 + 10; - return HeavyAttack; -} - -int MoveSet::callDefend() { - int Damage, Attack, Defend; - Defend = rand() % 10 + 1; - Attack = rand() % 10 + 1; - if (Defend >= Attack) { - Damage = 0; - return Damage; - } else { - Damage = Attack - Defend; - return Damage; - } -} +#include "..src/Moves.h" diff --git a/src/Moves.h b/src/Moves.h index 6d2f67c..635c1cc 100644 --- a/src/Moves.h +++ b/src/Moves.h @@ -1,28 +1,32 @@ // "Copyright [year] " -#ifndef MOVES_H -#define MOVES_H +#ifndef SRC_MOVES_H_ +#define SRC_MOVES_H_ #include // for assert #include // for exit #include #include // for cin and cout +#include -using namespace std; +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; class MoveSet { - private: - /* - int LightAttack; - int HeavyAttack; - int Defend; - int counter; - */ + private: + int LightAttack; + int HeavyAttack; + int Defend; + int counter; - public: + public: int callLightAttack(); int callHeavyAttack(); int callDefend(); int callCounter(); }; -#endif +#endif // SRC_MOVES_H_ diff --git a/src/a.out b/src/a.out deleted file mode 100644 index 2796e0116cf702228cc22b3f17c13257f975f8fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19880 zcmeHPeRx#WnZGlW$cG_`7LYIDicq1#kU$dfgPN~_iA^vi;X@?7PG%;_)JY~ga|b~| zu>s38rl$L_KD4E~K1y5IhuzxUu2So2_$Z`4woR?IZ0ojZt9>S-Hmy;zERy}b=brb@ zoy&|^cmLVv;qYYMbAIo~dCz;!J@?#u&*4E&?JB3kp>T33pH`?ekY^y}lCfZw%z%_D zE0hWNovmD}T!C_qzzlx5LBKWAs5H%Vyu@9gq_@Ip0CqY{$}wdRiRMaPCUW|E17)fx zssKoje0_Y8D1xdY!?cqeLh3V(tD;Qqk>19|q6n&r3{yq=&y?FoZKJDl1ho9~`k zU)n#T_KF=OI~9N2Z;DdrbiguUlqT=XtBO4~j!hb%W8%q0I6 z$XsQSU^Lhois`{HCT)WeeE@kT4RysX(-dyHY`Jpn;O@zDK649 z|JJR(=Fpbn;^oMPeX*FPZ|e+dp^lb_2U2Sq^cA5%uV#P>4F-Z}fRA>gxz7dZ-SM znY+ZuYfCM;rS4K1hEDu*VOAqbIT!A2RHhuym^52*ndU>Mm=ozbD#G8-zjF`nSUJiX zTyKQw3;!0kAeV9{%9Kd{9L75FC`}H9Cea-YRaAWi9@yk9cj z^9cig%7(vjje#Gr;TxtKc%Kb_Vy1!j+wk5=27cOxPm}lGVH;i~@$pOzb;T>ostq5M z3yTFdoaI;8@T8P4x8W>bZ^MVB{CGJJaoo5(DE+5tNQP2)JembBl=kiN91p_t@W=hk z@v!6UFX1$@SiXOWijuL`kwZb02Q0W;3JCnP1!o(?7_{Kl`%cn=Tj%Xz3r=eSPNNol z3WK0LuhTM(*8;@md7W@M1PN9;rJZreQ=2($wczHG56qnw+`69HW5LN5r(O%reN4Q4 z791CtnI5;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V)wlMw_H-y`j&C{}!mUO({nPy!k$w-%Br$nt1FGiJxy} zQCWiwt&O?;eKNzeT$ZuS7I9*Ieomn02t1ma`sVv>Ss{P7frv=<_#cZ_{D1$+HJf-XIh(=|ki-!neG$S5x`i22L< zOn(6mg_!mEdq}_3XE`>&Wv0IagZyWGeor+Z_4lx%q^!sAJIK)3Wqtm>vT?DLkb&Xx z&H6kJ_Cd^AKYxeWxWv#uD9tcoeWqt^`sVwSB141gvFmgB17ye+`_KQ6L!s0!=Z=*M zs-#TtpFauzr8vWQZ(?NmeHk;Tt(2_PR)ye~OZ{Pa9n*ctgFkLJ&p&j1u -#include "Entity.h" -#include "Grid.h" -#include "Moves.h" -using namespace std; +using std::cerr; +using std::cin; +using std::cout; +using std::endl; +using std::string; +using std::vector; int main() { - srand(time(0)); - char option; - - do { // Menu options. Add other options later. - cout << "Welcome! Please select a menu option." << endl; - cout << "[A] Play Game." << endl; - cout << "[B] Quit Game." << endl; - cin >> option; - - while (option != 'A' && option != 'B') { - cout << "Please enter a valid option of A, or B. " << endl; - cin >> option; - } - // if (option == 'A') { - // launch game, so call what function? - //} - } while (option != 'B'); - cout << endl; - - // Jake's functions - /* MoveSet action; - - cout << action.callLightAttack() << endl; - cout << action.callHeavyAttack() << endl; - cout << action.callDefend() << endl; - - // Grace - Grid display; - int GridRows = 4, GridColumns = 4; - display.printGrid(GridRows, GridColumns); - - - */ - return 0; + cout << "Welcome! Please select a menu option." << endl; + // Create menu + // Start Game, } diff --git a/src/test_driver.cpp b/src/test_driver.cpp index b3ec46d..856bc5d 100644 --- a/src/test_driver.cpp +++ b/src/test_driver.cpp @@ -1,3 +1,4 @@ +// "Copyright [year] " /************************************************************************* * * Project III: Start testing here. @@ -8,16 +9,3 @@ * Date: ? * */ - -#include -#include -using namespace std; -#include "Grid.cpp" - - - -int main() { - Grid display; - int GridRows = 4, GridColumns = 4; - display.printGrid(GridRows, GridColumns); -} diff --git a/test/QuotesTest.cpp b/test/QuotesTest.cpp index d1d2f81..2d083af 100644 --- a/test/QuotesTest.cpp +++ b/test/QuotesTest.cpp @@ -2,47 +2,14 @@ #include #include "../main/Quotes.h" -TEST_CASE("Professor Carman's Quote", "[quote]") { +TEST_CASE("Intro Menu", "[quote]") { // Setup Quotes myQuote(9); Quote quote = myQuote.getQuote(15); SECTION("Get Quote") { - REQUIRE(quote.student == "Preston Carman"); - REQUIRE(quote.quote == "Talk is cheap. Show me the code."); - REQUIRE(quote.author == "Linus Torvalds"); - } - - // Teardown -} - -TEST_CASE("Professor Foster's Quote", "[quote]") { - // Setup - Quotes myQuote(14); - - Quote quote = myQuote.getQuote(5); - - SECTION("Get Quote") { - REQUIRE(quote.student == "James Foster"); - REQUIRE(quote.quote == - "The most disastrous thing that you can ever learn is your " - "first programming language."); - REQUIRE(quote.author == "Alan Kay"); - } - - // Teardown -} - -TEST_CASE("Random Quote", "[quote]") { - // Setup - Quotes myQuote(25); - - Quote quote = myQuote.getRandomQuote(); - SECTION("Random Quote") { - REQUIRE(quote.student == "Preston Carman"); - REQUIRE(quote.quote == "Talk is cheap. Show me the code."); - REQUIRE(quote.author == "Linus Torvalds"); + REQUIRE(quote.student == "Welcome! Please select a menu option."); } // Teardown -- GitLab