Commit 22b90558 authored by Noah Olsen's avatar Noah Olsen

formatting and yml

parent 950a4073
Pipeline #4711 failed with stages
in 53 seconds
......@@ -105,10 +105,10 @@ code_coverage:
# - mkdir -p ~/.ssh
# - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# script:
# - ELF_NAME="${CI_PROJECT_NAMESPACE}-fact"
# - 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/factorial?job=build_programs' --output ${ELF_NAME} &&\" "
# - "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
......@@ -122,7 +122,7 @@ code_coverage:
# # Execute the deploy
# - ssh $SSH_USER@$SSH_HOST "${SSH_COMMAND_STRING}"
# # Make sure it is running
# - "curl --location http://${SSH_HOST}:${RUN_PORT} | grep \"Hello World!\""
# - "curl --location http://${SSH_HOST}:${RUN_PORT} | grep \"Go to /quote/# or /random to get a quote.\""
# when: manual
# only:
# - master
......
// "Copyright [year] <Copyright Owner>"
#include "Entity.h"
#include "Grid.h"
#include "Moves.h"
#include <ctime>
#include <iostream>
#include <string>
#include <vector>
#include "Grid.h"
#include "Moves.h"
using namespace std;
......@@ -12,145 +13,147 @@ class MoveSet;
// void Entity::action() {}
void Entity::move() {}
void Entity::move() {
}
void Entity::setPos() {
srand(time(0));
// Random Positioning
this->colPos = rand() % 3;
this->rowPos = rand() % 3;
// Random Positioning
this->colPos = rand() % 4;
this->rowPos = rand() % 4;
}
bool Entity::checkHealth() { return (con > 0); }
bool Entity::checkHealth() {
return (con > 0);
}
Player::Player() {
setPos();
this->con = 10;
this->str = 10;
this->dex = 10;
// setClass('a');
setPos();
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');
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');
}
void Player::setClass(char Class) {
switch (Class) {
case 'a': // Warrior
this->str = 14;
this->con = 12;
this->dex = 8;
break;
case 'b': // Rogue
break;
}
switch (Class) {
case 'a': // Warrior
this->str = 14;
this->con = 12;
this->dex = 8;
break;
case 'b': // Rogue
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
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::setBossClassByChoice(int boss) {
switch (boss) {
case 1: // Minotaur
this->str = 16;
this->con = 14;
this->dex = 8;
break;
case 2: // Dragonoid
this->str = 14;
this->con = 16;
this->dex = 12;
break;
case 3: // Cyclops
this->str = 18;
this->con = 16;
this->dex = 6;
break;
}
switch (boss) {
case 1: // Minotaur
this->str = 16;
this->con = 14;
this->dex = 8;
break;
case 2: // Dragonoid
this->str = 14;
this->con = 16;
this->dex = 12;
break;
case 3: // Cyclops
this->str = 18;
this->con = 16;
this->dex = 6;
break;
}
}
void Enemy::setBossClassByRand() {
int monster = rand() % 3; // Boss Monster Randomization
int monster = rand() % 3; // Boss Monster Randomization
setBossClassByChoice(monster);
setBossClassByChoice(monster);
}
void Enemy::setClassByChoice(int 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;
}
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;
}
}
void Enemy::setClassByRand() {
int monster = rand() % 3; // Monster Randomization
int monster = rand() % 3; // Monster Randomization
setClassByChoice(monster);
setClassByChoice(monster);
}
Enemy::Enemy(bool boss) {
setPos();
if (boss) {
setBossClassByRand();
} else {
setClassByRand();
}
}
\ No newline at end of file
setPos();
if (boss) {
setBossClassByRand();
} else {
setClassByRand();
}
}
// "Copyright [year] <Copyright Owner>"
#ifndef ENTITY_H
#define ENTITY_H
class MoveSet;
class Entity {
public:
bool checkHealth();
void move();
void setPos();
virtual void action() const = 0;
protected:
// MoveSet* moves;
int colPos;
int rowPos;
int con;
int str;
int dex;
public:
bool checkHealth();
void move();
void setPos();
int getCol() {
return colPos;
}
int getRow() {
return rowPos;
}
virtual void action() const = 0;
protected:
// MoveSet* moves;
int colPos;
int rowPos;
int con;
int str;
int dex;
};
class Player : public Entity {
public:
Player();
void action();
void setClass(char Class);
private:
// Vector of inventory items
// Vector of equipped items
public:
Player();
void action();
void setClass(char Class);
private:
// Vector of inventory items
// Vector of equipped items
};
class Enemy : public Entity {
public:
Enemy(bool boss);
void action();
void setBossClassByChoice(int boss);
void setBossClassByRand();
void setClassByRand();
void setClassByChoice(int monster);
bool seesPlayer();
private:
// Vector of drop items
// Vector of equipped items
public:
Enemy(bool boss);
void action();
void setBossClassByChoice(int boss);
void setBossClassByRand();
void setClassByRand();
void setClassByChoice(int monster);
bool seesPlayer();
private:
// Vector of drop items
// Vector of equipped items
};
#endif
\ No newline at end of file
#endif
// "Copyright [year] <Copyright Owner>"
#include <cstdlib>
#include <iostream>
using namespace std;
......@@ -10,62 +10,97 @@ using namespace std;
// 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;
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;
}
//2D array using subtraction in direction
/*
int Grid::move(int room, char direction) {
} */
// 2D array using subtraction in direction
int Grid::move(int room, 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;
/*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());
}
} else if (direction == 'm') {
room = move(room, getRandDirection());
} else {
cout << "Invalid entry. Please input valid entry. ";
room = move(room, getDirection());
}
return room;
}
char Grid::getRandDirection() {
otherDirection = rand() % 4 + 1;
if (otherDirection == 4) {
return 'u';
} else if (otherDirection == 2) {
return 'r';
} else if (otherDirection == 3) {
return 'd';
} else {
return 'l';
}
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++) {
......@@ -78,14 +113,3 @@ char Grid::getRandDirection() {
cout << grid[7] << grid[8] << grid[9] << endl;
}*/
// 2D array print inside a nested loop
void Grid::printGrid(int GridRows, int GridColumns) {//are these the appropriate parameters?
char grid[GridRows][GridColumns];//sets max spaces in grid; 16 spaces max
for(int i = 0; i < GridRows; i++) {
for (int j = 0; j < GridColumns; j++) {
grid[i][j] = '.';
cout << grid[i][j];
}
cout << endl;
}
}
\ No newline at end of file
// "Copyright [year] <Copyright Owner>"
#include <cstdlib>
#include <iostream>
using namespace std;
class Grid {
public:
//Grid();
char getDirection();
char getRandDirection();
int move(int room, char direction);
void printGrid(/*char [][4],*/ int GridRows, int GridColumns);
public:
// Grid();
char getDirection();
char getRandDirection();
int move(int GridRows, int GridColumns, char direction);
// void printGrid();
void printGrid(int GridRows, int GridColumns);
private:
int seed;
int room;
int player;
int bosses;
char direction;
int otherDirection;
int GridRows;
int GridColumns;
};
\ No newline at end of file
private:
int seed;
int room;
int player;
int bosses;
char direction;
int otherDirection;
int GridRows;
int GridColumns;
};
#include <string>
#include <vector>
#include <map>
using namespace std;
#ifndef INVENTORY_H
#define INVENTORY_H
#include <map>
#include <string>
#include <vector>
using namespace std;
class Inventory {
public:
Inventory();
int getItems() { return items; }
vector<int> storeItems;
private:
int items;
map<string, int> item;
};
\ No newline at end of file
// "Copyright [year] <Copyright Owner>"
#include "Moves.h"
#include <iomanip>
#include <iostream>
......@@ -5,26 +6,26 @@
using namespace std;