roulette java program

Discussion in 'Computers and The Internet' started by Trotsky311, Mar 7, 2005.

  1. Trotsky311

    Trotsky311 Supporters HipForums Supporter

    Messages:
    749
    Likes Received:
    0
    /*
    I wrote this program to test the idea that, at a roulette table you could
    consistently win money. I ignore the possiblity of 0 and 00, as it was just easier.
    And I didn't feel those would make a overly important difference.

    The idea is, a $15 minimum table, with no max. You bet $15, and if you lose
    you double your bet.
    ie:
    bet 15 and lose
    bet 30 and lose
    bet 60 and win --> net gain of 15.

    reset your bet to 15, and repeat

    */



    import java.util.Random;

    public class casino
    {
    public static void main (String[] args)
    {
    int totalmoney = 5000; //Start your wallet with $5000
    int bet = 15; //Minimum bet of $15
    int ball; //1 for red, 0 for black
    int counter = 0; // keeps track of #times you have made a bet
    int lose=0; //how many times you lost
    int win = 0; //how may times you win
    double averagebet = 0;//what was your average bet


    Random randnumber = new Random();

    do
    {
    ball = randnumber.nextInt(2); //Sets ball to 1 or 0

    if(ball == 1) //Always bet red.
    {
    win++;
    totalmoney +=bet; //add your bet to your winnings
    System.out.println("Win: " + totalmoney + " ball was " + ball + " bet was " + bet);
    bet = 15; //reset bet when you win.
    }
    else //ball was 2, so you lost.
    {
    lose++;
    totalmoney -=bet; //remove bet from winnings
    System.out.println("Lose: " + totalmoney + " ball was " + ball + " bet was " + bet);
    bet *=2; //double your bet
    }
    counter++; //increment counter
    averagebet +=bet;
    }while(counter < 100); //bet that many times

    System.out.println("\nAveragebet was " + (averagebet/counter));
    System.out.println("#times won was " + win);
    System.out.println("#times loss was " + lose);
    System.out.println("Total Net profit: " + (totalmoney-5000));
    }
    }




    I gave it quite a few test runs, and it SEEMS, like this works.

    Comments, ideas, places where I messed up?

    [edit]with a few small modifications, i made it run 50,000 times. It came up with an average net profit of $700.[/edit]
     
  2. Syntax

    Syntax Senior Member

    Messages:
    1,161
    Likes Received:
    3
    Yeah, this system works in a theoretical casino, but in the real world they set limits on your bets and make sure that you can't use such a simple algorithm to win. And besides, you'd need a -lot- of money to use this system.
     
  3. Soulless||Chaos

    Soulless||Chaos SelfInducedExistence

    Messages:
    19,814
    Likes Received:
    7
    Haha I had read about that before... Always wondered if it would actualy work in a real world situation.. :D
     
  4. Billy Brown

    Billy Brown Member

    Messages:
    198
    Likes Received:
    0
    thats a cool idea, but like syntax said, you'll need a lot of money. if you miss seven bets in a row (i've done it) you're already up to an almost two thousand dollar bet. run out of a bank roll and you're fucked, which seems risky considering you're only looking at a fifteen dollar profit each go.
     
  5. Dude111

    Dude111 An Awesome Dude

    Messages:
    11,087
    Likes Received:
    1,472
    I once made a program on my Commodore 64 that was an EXACT COPY of the lottery game "Quick Draw"....

    I didnt rig anything,i used standard randomisation routines and i didnt ever get more than $50 winning!

    For those who think the lottery is rigged,I DONT THINK IT IS... Randomisation is a VERY POWERFUL THING.... I didnt ever get ANY BIG WINNINGS from my program AND I DIDNT RIG ANYTHING :D

    How do you make this run??

    I copied the script in the OP,saved it as a .JAR file (JAVA) and it says it is corrupt when i try to run it!!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice