Hello, I'm having issues with my slot machine game. I'm required to keep score on the amount of points the player receives, but I don't really know how to go about that.
I thought about creating another function with an "if/else" statement using the position of the objects so I would keep score of the game, but so far it's been unsuccessful. Can you guide me on what I should do? Please be detailed.
Note: I am using a Windows environment. Also, disregard "Game Stats" or "Exit". I have yet to create a function for it.
void getStopOrder(int& first, int& second, int& last)
{
srand(time(0));
first = rand() % 3 + 1;
last = rand() % 3 + 1;
if (first == last)
{
if (last == 3)
{
last = 1;
second = 2;
}
else
{
last = last + 1;
if (last == 3)
second = 1;
else
second = last + 1;
}
}
else if (first == 1)
{
if (last == 2)
second = 3;
else
second = 2;
}
else if (first == 2)
{
if (last == 3)
second = 1;
else
second = 2;
}
else
{
if (last == 1)
second = 2;
else
second = 1;
}
}
"I'm required" would probably indicate this is a homework assignment... After all if you had actually written this code it would have been very easy to make such thing.
Your problem can be solved with only 3 lines of code.
void countScores(Options& posOne, Options& posTwo, Options& posThree)
{
int scores[6] = {10, 20, 30, 40, 50, 60}; // score order equal to options enum
if (all options are equal)
playerScore += item from scoresarray equal to options enum;
}
This however if you study the code should get you on your way.