'Bypass if conditions

I'm working on a slot machine game. I'm having a hard time implementing wild numbers that will bypass the checks. The main problem is that wild numbers can be everywhere like at the start of a line, and a basic check like if line[1][1] == line[0][1] will not work. Any suggestion on how to make the wild number(11) bypass if conditions?

// Table

int slot_table[3][5] = 
{
    // Here i will do number(1,10)
    // exemple
    {1, 1, 1, 1, 1}, // Line 1
    {2, 2, 2, 2, 2}, // Line 2
    {3, 3, 3, 3, 3}, // Line 3
};

// Wild
// After the table will be crated
// This function will add randome wilds
int check_line = 0;
int wild_count = 0;
do
{
    // Rate
    if (number(1,100) <= 60)
    {
        slot_table[check_line][number(0,2)] = 11;
        ++wild_count;
    }
}
while (++check_line <= 3);
// Basic Line no. 1
// First check for first 3 numbers

if (slot_table[0][0] == slot_table[0][1] && slot_table[0][1] == slot_table[0][2])
{
    // Check for the forth one
    // 3x Win
     if (slot_table[0][1] == slot_table[0][3])
    {
        // 4x Win
        // Check for the fifth one
        if (slot_table[0][1] == slot_table[0][4])
        {
            // 5x Win
        }
    }
}
if (wild_count >= 3)
{
    // You win something
}
c++


Solution 1:[1]

You can count all numbers in the array by using std::map and a loop. After that check the wild number and check the highest number.

Each element in std::map begins at zero, so you can simply increment the index without having to insert it separately.

#include <map>

const int row = 0;
const int wild = 11;

// Count each number and store the result in map
std::map<int, int> counter;
for (int i = 0; i < 5; i++) {
    counter[slot_table[row][i]]++;
}

// Final result of the game
int score = 0;

// Go through the values in the map
for (auto entry : counter) {
    const int number = entry.first;
    const int count = entry.second;
    if (count >= 3) {
        if (number == wild) {
            score = 100;
        }
        else {
            score = count * number;
        }
        break;
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VLL