Skip to main content
added 136 characters in body
Source Link
paparazzo
  • 6.9k
  • 2
  • 24
  • 53

I think there was a mistake and the correct answer is
4 card 25740 3 card 135564 2 card 94497 1 card 14924 total 270725

Not hard to just run em all
The total matches combin(52; 4)

Not hard to just run em all
The total matches combin(52; 4)

I think there was a mistake and the correct answer is
4 card 25740 3 card 135564 2 card 94497 1 card 14924 total 270725

Not hard to just run em all
The total matches combin(52; 4)

added 747 characters in body
Source Link
paparazzo
  • 6.9k
  • 2
  • 24
  • 53

Here is the strength code

public static int BengasiStrength(int[] cards)
{
    int score = 4;            
    int i = cards[0];
    for(int j = 1; j <= 3; j++)
    {
        if(i % 13 == cards[j] % 13 || i / 13 == cards[j] / 13)
        {
            score--;
            break;
        }
    }
    i = cards[1];
    for (int j = 2; j <= 3; j++)
    {
        if (i % 13 == cards[j] % 13 || i / 13 == cards[j] / 13)
        {
            score--;
            break;
        }
    }
    if (cards[2] % 13 == cards[3] % 13 || cards[2] / 13 == cards[3] / 13)
    {
        score--;
    }
    return score;
}

Here is the strength code

public static int BengasiStrength(int[] cards)
{
    int score = 4;            
    int i = cards[0];
    for(int j = 1; j <= 3; j++)
    {
        if(i % 13 == cards[j] % 13 || i / 13 == cards[j] / 13)
        {
            score--;
            break;
        }
    }
    i = cards[1];
    for (int j = 2; j <= 3; j++)
    {
        if (i % 13 == cards[j] % 13 || i / 13 == cards[j] / 13)
        {
            score--;
            break;
        }
    }
    if (cards[2] % 13 == cards[3] % 13 || cards[2] / 13 == cards[3] / 13)
    {
        score--;
    }
    return score;
}
added 1 character in body
Source Link
paparazzo
  • 6.9k
  • 2
  • 24
  • 53
 17160   6.34%  4 card
123552  45.64%  3 card
112476  41.55%  2 card
 17537   6.48%  1 card
270725  100.00%  
Rank count + suit count
    8      7      6     5   4 3 2      t      t
17160 113256 112632 27209 468 0 0 270725 270725

public static int Bengasi()
{
    int counter = 0;
    int[] split = new int[9];
    HashSet<int> rank = new HashSet<int>();
    HashSet<int> suit = new HashSet<int>();
    int rankPlusSuit;
    for (int i = 51; i >=3;>= 3; i--)
    {
        for (int j = i - 1; j >= 2; j--)
        {
            for (int k = j - 1; k >= 1; k--)
            {
                for (int m = k - 1; m >= 0; m--)
                {
                    rank.Clear();
                    rank.Add(i % 13);
                    rank.Add(j % 13);
                    rank.Add(k % 13);
                    rank.Add(m % 13);
                    suit.Clear();
                    suit.Add(i / 13);
                    suit.Add(j / 13);
                    suit.Add(k / 13);
                    suit.Add(m / 13);
                    rankPlusSuit = rank.Count + suit.Count;
                    split[rankPlusSuit]++;
                    counter++;
                }
            }
        }
    }
    Debug.WriteLine($"{split[8]} {split[7]} {split[6]} {split[5]} {split[4]} {split[3]}  {split[8] + split[7] + split[6] + split[5] + split[4] + split[3]} {counter}");
    return counter;
}
 17160   6.34%  4 card
123552  45.64%  3 card
112476  41.55%  2 card
 17537   6.48%  1 card
270725  100.00% 
Rank count + suit count
    8      7      6     5   4 3 2      t      t
17160 113256 112632 27209 468 0 0 270725 270725

public static int Bengasi()
{
    int counter = 0;
    int[] split = new int[9];
    HashSet<int> rank = new HashSet<int>();
    HashSet<int> suit = new HashSet<int>();
    int rankPlusSuit;
    for (int i = 51; i >=3; i--)
    {
        for (int j = i - 1; j >= 2; j--)
        {
            for (int k = j - 1; k >= 1; k--)
            {
                for (int m = k - 1; m >= 0; m--)
                {
                    rank.Clear();
                    rank.Add(i % 13);
                    rank.Add(j % 13);
                    rank.Add(k % 13);
                    rank.Add(m % 13);
                    suit.Clear();
                    suit.Add(i / 13);
                    suit.Add(j / 13);
                    suit.Add(k / 13);
                    suit.Add(m / 13);
                    rankPlusSuit = rank.Count + suit.Count;
                    split[rankPlusSuit]++;
                    counter++;
                }
            }
        }
    }
    Debug.WriteLine($"{split[8]} {split[7]} {split[6]} {split[5]} {split[4]} {split[3]}  {split[8] + split[7] + split[6] + split[5] + split[4] + split[3]} {counter}");
    return counter;
}
 17160   6.34%  4 card
123552  45.64%  3 card
112476  41.55%  2 card
 17537   6.48%  1 card
270725 100.00%  
Rank count + suit count
    8      7      6     5   4 3 2      t      t
17160 113256 112632 27209 468 0 0 270725 270725

public static int Bengasi()
{
    int counter = 0;
    int[] split = new int[9];
    HashSet<int> rank = new HashSet<int>();
    HashSet<int> suit = new HashSet<int>();
    int rankPlusSuit;
    for (int i = 51; i >= 3; i--)
    {
        for (int j = i - 1; j >= 2; j--)
        {
            for (int k = j - 1; k >= 1; k--)
            {
                for (int m = k - 1; m >= 0; m--)
                {
                    rank.Clear();
                    rank.Add(i % 13);
                    rank.Add(j % 13);
                    rank.Add(k % 13);
                    rank.Add(m % 13);
                    suit.Clear();
                    suit.Add(i / 13);
                    suit.Add(j / 13);
                    suit.Add(k / 13);
                    suit.Add(m / 13);
                    rankPlusSuit = rank.Count + suit.Count;
                    split[rankPlusSuit]++;
                    counter++;
                }
            }
        }
    }
    Debug.WriteLine($"{split[8]} {split[7]} {split[6]} {split[5]} {split[4]} {split[3]}  {split[8] + split[7] + split[6] + split[5] + split[4] + split[3]} {counter}");
    return counter;
}
added 193 characters in body
Source Link
paparazzo
  • 6.9k
  • 2
  • 24
  • 53
Loading
deleted 2 characters in body
Source Link
paparazzo
  • 6.9k
  • 2
  • 24
  • 53
Loading
added 90 characters in body
Source Link
paparazzo
  • 6.9k
  • 2
  • 24
  • 53
Loading
deleted 872 characters in body
Source Link
paparazzo
  • 6.9k
  • 2
  • 24
  • 53
Loading
Source Link
paparazzo
  • 6.9k
  • 2
  • 24
  • 53
Loading