Skip to content

Commit f8a310b

Browse files
committed
Rolls are implemented. Robber and resource payouts are not. Each time a road is placed, the roll is written to the console
1 parent 15c1edf commit f8a310b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

include/GameBoard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class GameBoard {
5151
void createRing(Coordinate topRight, int sideLength, std::vector<resourceType>& resources, std::vector<int>& rolls);
5252
void insertTile(Coordinate location, std::vector<resourceType>& resources, std::vector<int>& rolls);
5353

54-
void startTurn();
54+
std::pair<int, int> startTurn();
5555
void enableRobber();
5656
void payoutResources(int roll);
5757

src/GameBoard.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -602,22 +602,22 @@ const std::vector<std::unique_ptr<Player>>& GameBoard::getPlayers() const {
602602

603603
/*
604604
* When a player begins their turn, this rolls the dice and takes the required action (paying resources or enabling robber movement)
605+
* @return An array of the dice rolls
605606
*/
606-
void GameBoard::startTurn()
607+
std::pair<int, int> GameBoard::startTurn()
607608
{
608-
std::srand(std::time(0));
609609
int die1 = std::rand() % 6 + 1;
610610
int die2 = std::rand() % 6 + 1;
611611
int roll = die1+die2;
612-
cout << "Die 1: " << die1 << "\nDie 2: " << die2 << "\nRoll: " << roll;
612+
std::cout << "\nDie 1: " << die1 << "\nDie 2: " << die2 << "\nRoll: " << roll <<"\n";
613613

614614
if (roll==7)
615-
{
616615
enableRobber();
617-
return;
618-
}
619616

620-
payoutResources(roll);
617+
else
618+
payoutResources(roll);
619+
620+
return std::make_pair(die1, die2);
621621
}
622622

623623
/*

0 commit comments

Comments
 (0)