Increase the chances of losing in roulette game with leds

Estoy diseñando una rueda de la fortuna parecida a la del siguiente enlace:

Quiero manipular el juego para que las probabilidades de que caiga en ciertas opciones sea menor a las que realmente tienen premios buenos.
No sé que fórmula matemática utilizar o que código me pueda ayudar a realizar dicha acción. El código no lo pego porque en realidad el juego es muy básico y sencillo y hay muchos tutoriales de él en Internet. De antemano gracias a todos por su valioso conocimiento.

I am designing a wheel of fortune similar to the last video.
I want to manipulate the game so that the chances of landing on certain options are lower than those that really have good prizes.
I don't know what mathematical formula to use or what code can help me to carry out said action. I don't paste the code because in reality the game is very basic and simple and there are many tutorials about it on the Internet. Thank you all in advance for your valuable knowledge.

float chances [] = { 1, 1, 1, 2, 1, 1, 2, 1, 1, 1 };

you can define the chances for each "spot"
you can use the sum of the chances to determine the range of a random value. there are 9 values with a sum of 12
long val = random (0, sum);

you can then scan the array, determining the accumulated sum and the range of random values that match the entry

  0     1.0    1.0
  1     1.0    2.0
  2     1.0    3.0
  3     2.0    5.0
  4     1.0    6.0
  5     1.0    7.0
  6     2.0    9.0
  7     1.0   10.0
  8     1.0   11.0
  9     1.0   12.0

I did not understand your theory very well, could you give me an example of real code or more explained? I really appreciate your knowledge.

consider


const byte ButPin = A1;
byte butLst;

int   max;
float chances [] = { 1, 1, 1, 2, 1, 1, 2, 1, 1, 1 };
#define N_CHANCES    (sizeof(chances)/sizeof(float))

// -----------------------------------------------------------------------------
int
chance ()
{
    long val = random (0, max);
    int  sum = 0;
    unsigned  n;

    for (n = 0; n < N_CHANCES; n++)  {
        if (val <= sum)
            break;
        sum += chances [n];
    }

    char s [80];
    sprintf (s, " val %2ld, sum %2d, n %2u", val, sum, n);
    Serial.println (s);

    return n;
}

// -----------------------------------------------------------------------------
void loop (void)
{
    byte but = digitalRead (ButPin);
    if (butLst != but)  {
        butLst = but;
        delay (10);     // debounce
        if (LOW == but)
            chance ();
    }
}

// -----------------------------------------------------------------------------
void setup (void)
{
    Serial.begin (115200);

    pinMode (ButPin, INPUT_PULLUP);
    butLst = digitalRead (ButPin);

    for (unsigned n = 0; n < N_CHANCES; n++)
        max += chances [n];
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.