Apanian25 / Comp345-Risk

0 stars 0 forks source link

Player #5

Closed Apanian25 closed 3 years ago

Apanian25 commented 4 years ago

Tasks

Description

Implement a group of C++ classes that implement a Warzone player using the following design: A player owns a collection of territories (see Part 1). A player owns a hand of Cards (see Part 5). A player has their own list of orders to be created and executed in the current turn (see Part 3). A player must implement the following methods, which are eventually going to get called when decisions have to be made: The player should contain a method named toDefend() that return a list of territories that are to be defended, as well as a method named toAttack() that returns a list of territories that are to be attacked. For now, all that these methods should do is to establish an arbitrary list of territories to be defended, and an arbitrary list of territories that are to be attacked. The class must also have a issueOrder() method that creates an Order object and puts it in the player’s list of orders. The classes/functions that you implement for this component must all reside in a single .cpp/.h file duo named Player.cpp/Player.h. You must deliver a file named PlayerDriver.cpp file that creates player objects and demonstrates that the player objects indeed have the above-mentioned features.

Apanian25 commented 3 years ago

ostream& operator<<(ostream& strm, Player& player) { cout << "Player has " << player.territories.size() << " territories at his disposal.\n" << "He has " << player.hand.size() << " number of cards.\n" << "And, he has " << player.orders.size() << " orders that he can use.";

}

Your stream insertion operator is not doing what it is supposed to do. You are supposed to append your output to the strm and then return your strm object, you're not supposed to directly append to cout