I'm developing a slot machine game. The player insert amount of money and makes a bet to play. And the goal of the game is to obtain as many rows, columns, and diagonals as possible of the same symbol. In the above example, obtained a profit when the upper and lower line have equal symbols, partly 2x lines. Depending on the number of rows with the same symbol the user gets paid as the profit system follows:
- A series provides 2 * bet
- Two lines giving 3 * bet
- Three rows giving 4 * bet
- Four rows gives 5 * bet
- Five lines gives 7 * bet
- Fully playing field gives 10 * bet
I dont know how to solve this problem with the paying? What code can I use? Should I use a for-loop? I'm new with c++ so I'm having trouble with this. I' been spending a lot of hours on this game and I just can't solve it. Please help me! Here's a small part of my code for now: I just want to compare the results.
srand(time(0));
char game[3][3] = {{'O','X','A'}, {'X','A','X'}, {'A','O','O'}};
for (int i = 0; i < 3; ++i)
{
int r = rand() % 3;
cout << " " <<game[r][0] << " | " << game[r][1] << " | " << game[r][2] << "\n";
cout << "___|___|___\n";
}
//......compare the result of the random symbols. ????