Pierre Angelo

Generation

generate functionWed, 29 Mar 2023

a) float P01FuerzaFija(): Impulse with fixed value (500) b) float P02RandomRange(): Random impulse in a range of values defined[200, 500] c) float P03RandomDosDados(float faces): Let the sum of two values random, such that its value is in the range [0, 500] d) float P04RandomVariousDice(int dice, float faces): Let the sum of several dice (this will be a variable that we can modify). so that the value of the sum is in the range [0, 500] e) float P05maxDice(int dice, float faces): Several dice are thrown and gets the biggest of them f) float P06discardMinDice(int dice, float faces): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the lowest one is discarded from them g) float P07discardMinAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n dice will be rolled, the minor and this one will be thrown again h) float P08discardMaxAndReturnToRoll(int dice, float heads): The value of the impulse will be the sum of n dice. n+1 dice will be rolled and the greatest of them i) float P09PossibleBonus(float force, float bonus, float probability): will add a boost boost with a 20% chance of this happen

float P01FuerzaFija(){ return 500.0f; } float P02RandomRange(){ return static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(500-200))) + 200; } float P03RandomDosDados(float faces){ float dado1 = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(faces))); float dado2 = static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(faces))); return dado1 + dado2; } float P04RandomVariousDice(int dice, float faces){ float suma=0; for (int i = 0; i < dice; ++i) { suma += P03RandomDosDados(faces); } return suma; } float P05maxDice(int dice, float faces){ float max; max =

Questions about programming?Chat with your personal AI assistant