Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Aider moi SVP code pour jeu de hasard

  1. #1
    Junior Member
    Join Date
    Jun 2023
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Aider moi SVP code pour jeu de hasard

    J'ai un code Java mais j'aimerais faire quelque modifications mais je sais pas comment faire, je refais le jeu rapido, j'aimerais effectuer le tirage avec une présentation en tableau en 4 lignes de 5 numéros plus un autre tableau pour la grille B, faire ça pour la chance 1 et chance 2, sans faire d'autre modification que cela merci,* PAS DE MODIFICATION POUR L'AFFICHAGE DES RÉSULTATS, NI DU TEMPS, NI POUR L'AFFICHAGE DU NUMÉRO DE TIRAGE.

    MERCI

    Vérifiez aussi si le code qui sélectionne les numéros au hasard de la grille a et la grille b et bon, sinon vous pouvez le modifier 😉😉😉

    Voici le code :

    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.List;
    import java.util.Random;

    public class Rapido {
    public static void main(String[] args) {
    int totalDraws = 250;
    int drawInterval = 5 * 60 * 1000; // 5 minutes in milliseconds
    int chance1Numbers = 8;
    int chance2Numbers = 1;
    int chance1MaxNumber = 20;
    int chance2MaxNumber = 4;
    int recapDuration = 5 * 1000; // 5 seconds in milliseconds
    int flashingDuration = 5 * 1000; // 5 seconds in milliseconds
    int countdownDuration = (3 * 60 + 15) * 1000; // 3 minutes and 15 seconds in milliseconds
    int totalDuration = (1 * 60 + 45) * 1000; // 1 minute and 45 seconds in milliseconds

    for (int i = 0; i < totalDraws; i++) {
    System.out.println(“RAPIDO”);
    System.out.println("Draw number: " + (i + 1));
    System.out.println("Time: " + System.currentTimeMillis());

    // CHANCE 1
    System.out.println(“CHANCE 1”);
    List<Integer> chance1NumbersList = new ArrayList<>();
    for (int j = 1; j <= chance1MaxNumber; j++) {
    chance1NumbersList.add(j);
    }
    Collections.shuffle(chance1NumbersList);
    chance1NumbersList = chance1NumbersList.subList(0, chance1Numbers);

    Random rand = new Random();
    int chance2Number = rand.nextInt(chance2MaxNumber) + 1;

    System.out.println("GRILLE A: " + chance1NumbersList);
    System.out.println("GRILLE B: " + chance2Number);

    try {
    Thread.sleep(recapDuration);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }

    // Flashing screen
    System.out.println(“Flashing screen”);
    try {
    Thread.sleep(flashingDuration);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }

    // CHANCE 2
    System.out.println(“CHANCE 2”);
    List<Integer> chance2NumbersList = new ArrayList<>();
    for (int j = 1; j <= chance1MaxNumber; j++) {
    chance2NumbersList.add(j);
    }
    Collections.shuffle(chance2NumbersList);
    chance2NumbersList = chance2NumbersList.subList(0, chance1Numbers);

    rand = new Random();
    int chance4Number = rand.nextInt(chance2MaxNumber) + 1;

    System.out.println("GRILLE A: " + chance2NumbersList);
    System.out.println("GRILLE B: " + chance4Number);

    try {
    Thread.sleep(recapDuration);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }

    // Recap screen
    System.out.println(“Recap screen”);
    System.out.println("CHANCE 1 – GRILLE A: " + chance1NumbersList);
    System.out.println("CHANCE 1 – GRILLE B: " + chance2Number);
    System.out.println("CHANCE 2 – GRILLE A: " + chance2NumbersList);
    System.out.println("CHANCE 2 – GRILLE B: " + chance4Number);

    // Countdown
    System.out.println("Countdown: " + countdownDuration / 1000);

    try {
    Thread.sleep(totalDuration – recapDuration * 3 – flashingDuration);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    }
    }
    }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Aider moi SVP code pour jeu de hasard

    A translation:
    I have a Java code but I would like to make some modifications but I don't know how to do it, I'm redoing the quick game, I would like to make the draw with a table presentation in 4 rows of 5 numbers plus another table for the grid B, do this for chance 1 and chance 2, without making any other modification than that thank you,* NO MODIFICATION FOR THE DISPLAY OF THE RESULTS, OR THE TIME, OR FOR THE DISPLAY OF THE DRAW NUMBER.

    THANK YOU

    Also check if the code that selects random numbers from grid a and grid b is good, if not you can modify it
    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 0
    Last Post: May 31st, 2022, 11:40 AM
  2. Replies: 6
    Last Post: August 5th, 2014, 11:19 AM
  3. Replies: 7
    Last Post: January 24th, 2013, 10:41 AM
  4. Replies: 3
    Last Post: September 3rd, 2012, 11:36 AM