Hello,
I seek assistance in creating this game it is similar to RPS(Rock,Paper,Scissors) but with different objectives.
==============================
Card | Beats | Loses To
==============================
Peasants >| Serf >| King
King >| Peasants >| Serf
Serf >| KIng >| Serf
==============================
the player and the Ai are given 5 cards. 4 of which are Peasants. The remaining one is either a King or a Serf, depending on which side the player is playing.
A player can only be on one of the 2 sides in each round. The game starts with determining which side a player is on. The round ends whenever the king or Serf card is played. The objective of the game depends on which side you are on.
If you are on the King side, your goal is to hide your King within the Peasants and play it when you feel the opponent will play the Peasants card.
If you are on the Serf side, your goal is to kill the King. If you fail to predict the opponent’s hand, the Serf will be killed by the Peasants. This denies the opportunity of the Serf side from winning, hence you lose.
this is what I have started
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
void deckBuilder(vector<string>& deck, int &round)
{
vector<int> kingNums = { 1, 2, 3, 7, 8, 9 };
vector<int> serfNums = { 4, 5, 6, 10, 11, 12 };
int i;
for (i = 0; i < deck.size(); i++)
{
kingNums[i];
serfNums[i];
}
if (kingNums[i] == round)
{
deck.push_back("Emperor Card");
deck.push_back("Citizen Card");
deck.push_back("Citizen Card");
deck.push_back("Citizen Card");
deck.push_back("Citizen Card\n");
}
else if (serfNums[i] == round)
{
deck.push_back("Slave Card");
deck.push_back("Citizen Card");
deck.push_back("Citizen Card");
deck.push_back("Citizen Card");
deck.push_back("Citizen Card\n");
}
}
void printDeck(const vector<string> deck)
{
for (int i = 0; i < deck.size(); i++)
{
cout << " -"<< deck[i] << "\n";
}
}
void playRound(int &round, int $mmleft, int moneyEarned)
{
vector<string> deck;
cout << "Round: " << round << "\n";
deckBuilder(deck, round);
printDeck(deck);
}
int main()
{
srand(unsigned int(time(NULL)));
int round = 1;
int mmLeft = 30;
int moneyEarned = 0;
while (round < 13)
{
playRound(round, mmLeft, moneyEarned);
round++;
}
cout << "\n\n";
return 0;
}
}
|
my issue is that for some reason the deckBuilder function is NOT doing what wanted it to do.
OUTPUT:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Round: 1
Round: 2
-Emperor Card
-Citizen Card
-Citizen Card
-Citizen Card
-Citizen Card
Round: 3
Round: 4
Round: 5
-Slave Card
-Citizen Card
-Citizen Card
-Citizen Card
-Citizen Card
Round: 6
Round: 7
Round: 8
Round: 9
Round: 10
Round: 11
Round: 12
|
i wanted that in a specific round (max round = 12) it should push.back either the King deck or the Serf deck in this in round order(King=1,2,3,7,8,9 Serf=4,5,6,10,11,12) but it doesn't do that, Can you help me out.