diff --git a/src/CSI2372_FinalProject_Build1.cbp b/src/CSI2372_FinalProject_Build1.cbp deleted file mode 100644 index 8e5eea4..0000000 --- a/src/CSI2372_FinalProject_Build1.cbp +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - diff --git a/src/CSI2372_FinalProject_Build1.depend b/src/CSI2372_FinalProject_Build1.depend deleted file mode 100644 index d2cd8c5..0000000 --- a/src/CSI2372_FinalProject_Build1.depend +++ /dev/null @@ -1,62 +0,0 @@ -# depslib dependency file v1.0 -1417430016 source:c:\users\rodger\desktop\uottawa\current\csi2372\mywork\csi2372_finalproject_build1\main.cpp - - -1417431493 source:c:\users\rodger\desktop\uottawa\current\csi2372\mywork\csi2372_finalproject_build1\src\player.cpp - "Player.h" - -1417430016 c:\users\rodger\desktop\uottawa\current\csi2372\mywork\csi2372_finalproject_build1\include\player.h - -1417430016 source:c:\users\rodger\desktop\uottawa\current\csi2372\mywork\csi2372_finalproject_build1\src\tile.cpp - "Tile.h" - -1417431412 c:\users\rodger\desktop\uottawa\current\csi2372\mywork\csi2372_finalproject_build1\include\tile.h - "Player.h" - - -1417431190 source:c:\users\rodger\desktop\uottawa\current\csi2372\mywork\csi2372_finalproject_build1\src\tilefactory.cpp - "TileFactory.h" - - - - - -1417417702 c:\users\rodger\desktop\uottawa\current\csi2372\mywork\csi2372_finalproject_build1\include\tilefactory.h - "Tile.h" - - - -1417419362 source:/Users/ColeClifford/CSI2372_FinalProject/src/main.cpp - - -1417419362 source:/Users/ColeClifford/CSI2372_FinalProject/src/src/Player.cpp - "Player.h" - -1417419569 /Users/ColeClifford/CSI2372_FinalProject/src/include/Player.h - -1417418085 source:/Users/ColeClifford/CSI2372_FinalProject/src/src/Tile.cpp - "Tile.h" - -1417419666 /Users/ColeClifford/CSI2372_FinalProject/src/include/Tile.h - "Player.h" - - -1417419569 source:/Users/ColeClifford/CSI2372_FinalProject/src/src/TileFactory.cpp - "TileFactory.h" - - - - - -1417419569 /Users/ColeClifford/CSI2372_FinalProject/src/include/TileFactory.h - "Tile.h" - - - -1417318935 /Users/ColeClifford/CSI2372_FinalProject/src/Tile.h - -1416608716 /Users/ColeClifford/CSI2372_FinalProject/src/Player.h - -1417315229 /Users/ColeClifford/CSI2372_FinalProject/src/Tile.cpp - "Tile.h" - diff --git a/src/CSI2372_FinalProject_Build1.layout b/src/CSI2372_FinalProject_Build1.layout deleted file mode 100644 index 5416e68..0000000 --- a/src/CSI2372_FinalProject_Build1.layout +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/bin/Debug/CSI2372_FinalProject_Build1.exe b/src/bin/Debug/CSI2372_FinalProject_Build1.exe deleted file mode 100644 index 042de59..0000000 Binary files a/src/bin/Debug/CSI2372_FinalProject_Build1.exe and /dev/null differ diff --git a/src/include/GameBoard.h b/src/include/GameBoard.h index 437526e..2bb8fc9 100644 --- a/src/include/GameBoard.h +++ b/src/include/GameBoard.h @@ -4,7 +4,7 @@ #include "TileFactory.h" -template class GameBoard +template class GameBoard { private: std::map pMap; @@ -13,7 +13,19 @@ template class GameBoard public: enum Move {UP, DOWN, LEFT, RIGHT}; /** Default constructor */ - GameBoard():tf(TileFactory.get()){} + GameBoard():tf(TileFactory.get(n*m)){ + std::vector a; + for(int i =0; i< N;i++){ + a = std::vector; + tVec.push(a); + } + + for(int i = 0; i class GameBoard }catch (...) { add(tf.next(), x, y); } -<<<<<<< HEAD -======= - catch ( ... ) { - add(tf.next(), x, y); - } ->>>>>>> bb93509898a631b4e5e63991d86aef511ba5c30b - } protected: private: diff --git a/src/include/Player.h b/src/include/Player.h index 7d35fac..071388c 100644 --- a/src/include/Player.h +++ b/src/include/Player.h @@ -1,6 +1,6 @@ #ifndef PLAYER_H #define PLAYER_H - +#include class Player { @@ -13,7 +13,7 @@ class Player unsigned int _spice, unsigned int _cart, unsigned int _food, - string name); + std::string _name); bool canAct() const; // returns true if food > 0 bool pay( Player& player ); @@ -49,14 +49,14 @@ class Player void Setfood(unsigned int val); void Addfood(unsigned int val); - string getName() { return name; } + std::string getName() { return name; } unsigned int Getusedcartspace(); unsigned int Addusedcartspace(unsigned int val); protected: private: - string name; + std::string name; int x; int y; unsigned int gold; diff --git a/src/include/Tile.h b/src/include/Tile.h index 7e45fb3..f9febeb 100644 --- a/src/include/Tile.h +++ b/src/include/Tile.h @@ -12,7 +12,7 @@ class Tile /** Default destructor */ virtual ~Tile(); - bool operator == (const Tile &t); + bool operator == (const Tile &t)const; virtual bool action(Player& player){ return false;} diff --git a/src/include/sdf.h b/src/include/sdf.h new file mode 100644 index 0000000..59620b7 --- /dev/null +++ b/src/include/sdf.h @@ -0,0 +1,16 @@ +#ifndef SDF_H +#define SDF_H + + +class sdf +{ + public: + /** Default constructor */ + sdf(); + /** Default destructor */ + virtual ~sdf(); + protected: + private: +}; + +#endif // SDF_H diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index c0e5caf..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include - -int main() -{ - - bool takeTurn(BoardGame& bg, const std::string& pName) { - - try { - Move m; - cin.exceptions(std::istream::failbit); - cin>> m; - const Tile t = bg.move( m, pName ); - Player p = bg.getPlayer( pName ); - if (p.canAct()) { - bool makeAction; - cin>>makeAction; - if ( makeAction ) std::vector opL = bg.getPlayers( t ); - if (p.getGold()>= opL.size()) { - p.eat(); - for ( auto op : opL ) { - p.pay( op, 1 ); - bg.setPlayer( op ); - } - t.action( p ); - bg.setPlayer( p ); - } - } - return true; - } - catch ( std::istream::failure e ) { - cout<< “Incorrect key pressed”; cin.clear(); } - } - catch ( std::out_of_range e ) { - cout<< e.what(); - } - return false; - } - /* - if game is paused - resume - else - Setup: Input the names of all players and the size of the board. Initialize a board game for N players - While no Player has won - Check for Pause - For each Player - Display Player status - while move is not valid - Input move (up/down/right or left) - Move Player to Tile - if Player has food items - Display Tile Action - if Player chooses Action and Action is valid - if Tile occupied - Player pays other Player - Perform Action - Display Player status - if Player has 5 Rubies player has won - */ - - -} diff --git a/src/src/Player.cpp b/src/src/Player.cpp index e57c549..fba630e 100644 --- a/src/src/Player.cpp +++ b/src/src/Player.cpp @@ -17,7 +17,8 @@ Player::Player(unsigned int _gold, unsigned int _jewel, unsigned int _spice, unsigned int _cart, - unsigned int _food) + unsigned int _food, + std::string _name) : gold(_gold), ruby(_ruby), @@ -25,7 +26,8 @@ Player::Player(unsigned int _gold, jewel(_jewel), spice(_spice), cart(_cart), - food(_food) + food(_food), + name(_name) { //ctor } @@ -58,7 +60,7 @@ void Player::eat() { } } -bool Player::canAct() { +bool Player::canAct() const{ if(food > 0) { return true; } diff --git a/src/src/Tile.cpp b/src/src/Tile.cpp index 4c3e344..bae5178 100644 --- a/src/src/Tile.cpp +++ b/src/src/Tile.cpp @@ -8,4 +8,8 @@ Tile::Tile() Tile::~Tile() { //dtor -} \ No newline at end of file +} + +bool Tile::operator==(const Tile &t)const{ + return this == &t; +} diff --git a/src/src/TileFactory.cpp b/src/src/TileFactory.cpp index 5923340..d8cb34d 100644 --- a/src/src/TileFactory.cpp +++ b/src/src/TileFactory.cpp @@ -95,5 +95,6 @@ TileFactory::~TileFactory() } Tile* TileFactory::next(){ - return 0;//tiles.pop_back(); + Tile * tile = tiles.back(); + return tile; } diff --git a/src/src/sdf.cpp b/src/src/sdf.cpp new file mode 100644 index 0000000..9de216a --- /dev/null +++ b/src/src/sdf.cpp @@ -0,0 +1,11 @@ +#include "sdf.h" + +sdf::sdf() +{ + //ctor +} + +sdf::~sdf() +{ + //dtor +}