ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Loop Through 3 Slot Machines Java Program
    카테고리 없음 2021. 9. 9. 09:14


    Slot machines are the most popular game in modern casinos. If you’ve never seen one, a slot machine resembles an arcade game that has a lever on its side. For a small fee you can pull the lever, and the machine will generate a random combination of three symbols. If the correct combination appears, you can win a prize, maybe even the jackpot.

    If all three numbers on the slot machine are different, then there are no winnings. Additional Notes. To choose three random numbers in your program, you MUST use the 'generator' variable that is in the starter code, by doing something like this: int slot1, slot2, slot3; slot1 = generator.nextInt(10); slot2 = generator.nextInt(10). Write a java application program that simulates a simple slotmachine in which three numbers between 0 and 9 are randomlyselected and printed side by side. The program will allow the userto place a bet, and then make a payout if any two of the numbersare the same, or if all three numbers are the same.

    Slot machines make fantastic profits for casinos because they offer a very low payout rate. In many games, such as Blackjack and Roulette, the odds are only slightly stacked in the casino’s favor. In the long run, the casino pays back 97 to 98 cents in prizes of every dollar that a gambler spends on these games. With slot machines, it is typical for a casino to only pay back 90 to 95 cents—and the casino keeps the rest. If this seems underhanded, keep in mind that slot machines are one of the most popular games at a casino; few people seem to mind. And if you consider that state lotteries have payout rates that are much closer to 50 cents on the dollar, slot machines don’t look that bad.

    In this project, you will build a real, working slot machine modeled after some real life Video Lottery Terminals from Manitoba, Canada. The terminals were a source of scandal in the 1990s. You’ll get to the bottom of this scandal by writing a program that recreates the slot machines. You’ll then do some calculations and run some simulations that reveal the true payout rate of the machines.

    This project will teach you how to write programs and run simulations in R. You will also learn how to:

    • Use a practical strategy to design programs
    • Use if and else statements to tell R what to do when
    • Create lookup tables to find values
    • Use for, while, and repeat loops to automate repetitive operations
    • Use S3 methods, R’s version of Object-Oriented Programming
    • Measure the speed of R code
    • Write fast, vectorized R code

    Hi to everyone here! I'm a newbie! I just wanna ask help from you especially from the administrator regarding my machine problem.....

    I am asked by my proffesor to create a slot machine program.
    This is how it goes...

    The simulation starts by presenting the player with a menu of how much money to play for the round. The user has 3 options as shown in this sample run.

    Welcome to the House of Fun!
    Here, everyone is a winner!

    You've spent $0 and won $0
    How much are you going to play?
    $ 10 for regular prize
    $ 20 for increased prize value
    $ 0 to quit
    > 65
    Invalid! Enter again please...

    How much are you going to play?
    $ 10 for regular prize
    $ 20 for increased prize value
    $ 0 to quit
    > 10

    Notice that the program checks whether the player entered correct values or not. If an incorrect value is entered, the program prompts the player to enter again.

    If the player enters 10 or 20, the program will randomly generate 3 symbols. The symbols that can be generated are: APPLES, ARCHER, HEARTS, SMILES, or STARS!. However, the 5 symbols mentioned do not appear uniformly. The table that follows summarizes the statistics:

    Symbol Chances of Appearing
    STARS! appear 10 % of the time
    SMILES appear 30 % of the time
    HEARTS appear 30 % of the time
    ARCHER appear 30 % of the time
    APPLES appear 60 % of the time

    The player wins money if the 3 generated symbols result to a lucky combination. If a lucky combination is generated, the prize in the 1st Credit is awarded. If the same lucky combination is obtained for the next round, then the 2nd Credit Prize is awarded.

    Lucky Combinations

    1st Combination
    STARS!-STARS!-STARS!
    1st Credit: $500
    2nd Credit: $1000

    2nd Combination
    SMILES-SMILES-SMILES
    1st Credit: $250
    2nd Credit: $500

    3rd Combination
    HEARTS-HEARTS-HEARTS
    1st Credit: $150
    2nd Credit: $300

    4th Combination
    ARCHER-ARCHER-ARCHER
    1st Credit: $100
    2nd Credit: $200

    5th Combination
    any combination of a pair of any symbols except for APPLES
    1st Credit: $20
    2nd Credit: $40

    6th Combination
    a combination of SMILES, HEARTS and ARCHER
    Credit: Especial Event if bet is $10
    Credit: Especial Event 2 if bet is $20


    The values above only hold if the user plays for $20. If the user played for only $10, a regular prize of $50 is given for the 1st to 4th combinations, and $10 for the 5th prize. Note that there are no 1st and 2nd credits for $10 games.

    The 6th lucky combination gives the player access to a special event. This happens regardless of the user's game mode choice. There are two special events. If the user entered $10 the credit will be the special event 1 and if the user entered $20 the credit will be the special event 2( Actually my teacher said that I have the option to design whatever special the user will encounter.... since I know how to program ROCK-PAPER_SCISSORS Game and HANG-MAN GAME.... I chose them for my SPECIAL EVENT 1 & 2). If the user wins the special event 1, an award of $150 will be given to the player. If the user wins the especial event 2, an award of $300 will be given.

    All unlucky combinations offer $0.

    The program should continue to execute until the user chooses to quit (by entering 0).

    SAMPLE RUN
    Welcome to the House of Fun!
    Here, everyone is a winner!

    You've spent $0 and won $0
    How much are you going to play?
    $ 10 for regular prize
    $ 20 for increased prize value
    $ 0 to quit
    > 10

    +--------+--------+--------+
    | ARCHER | ARCHER | ARCHER |
    +--------+--------+--------+
    Congratulations! You get $50.


    You've spent $10 and won $50
    How much are you going to play?
    $ 10 for regular prize
    $ 20 for increased prize value
    $ 0 to quit
    > 20

    +--------+--------+--------+
    | STARS! | APPLES | APPLES |
    +--------+--------+--------+
    Sorry, You get $0.

    Slot

    You've spent $30 and won $50
    How much are you going to play?
    $ 10 for regular prize
    $ 20 for increased prize value
    $ 0 to quit
    > 20

    +--------+--------+--------+
    | SMILES | HEARTS | SMILES |
    +--------+--------+--------+
    Congratulations! You get P20.

    You've spent $50 and won $70
    How much are you going to play?
    $ 10 for regular prize
    $ 20 for increased prize value
    $ 0 to quit
    > 0

    You spent a total of $50 and won $70
    Thank You for Playing!

    I already know the codes on the first part of the program. I have already tested ran and debugged the first part wherein the menu is displayed.
    I mean this part....
    Welcome to the House of Fun!
    Here, everyone is a winner!

    You've spent $0 and won $0
    How much are you going to play?
    $ 10 for regular prize
    $ 20 for increased prize value
    $ 0 to quit
    > 65
    Invalid! Enter again please...

    How much are you going to play?
    $ 10 for regular prize
    $ 20 for increased prize value
    $ 0 to quit
    > 10

    Through

    Now my problem is on the part of randomizing the symbols to be displayed....
    I tried one of this codes....

    Fortunately this code worked! But my problem is: 'How am I going to edit the appearances of each symbol?' Like making the symbol 'STARS!' appear 10% of the time and 'APPLES' appear 60% of the time... is my function: 'getRandomNum()' wrong? Am I going to change it?.... or what...
    plss help me..... regarding this matter... I would really appreaciate if you could help me.... Thanks a lot!

    P.S.
    You could also send me the source code for my slot machine program.... If you think you know the shortest/ briefest way to code it..... then you could send it to me.... if you like :cheesy: .... I Would really really apreciate it! THANKS! :lol:

    Editedby __avd because:Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).
    • 6 Contributors
    • forum9 Replies
    • 971 Views
    • 5 Years Discussion Span
    • commentLatest PostLatest Postby whgeiger

    Recommended Answers

    easy, give stars a larger numeric range. since apples are hard to get, make them 0 -9, then alot 10-69 for apples. and allow the other in the 30% remaining. any number randomly generated has a greater chance of falling in the larger block then the smaller one. therefor, you …

    Jump to Post

    Well first off 60+30+30+30+10 does not equal 100 so its kind of hard to say that SMILES HEARTS AND ARCHERS happen 30% of the time.

    Group them into the 30% and then pick one out of the 3.

    This will help with the distibution with APPLES appearing most …

    Jump to Post

    Brief fix! For something posted 6 years ago? Not brief enough...

    Jump to Post

    Loop Through 3 Slot Machines Java Programmers

    All 9 Replies

    Slot Machine Simulation Java Program

    easy, give stars a larger numeric range. since apples are hard to get, make them 0 -9, then alot 10-69 for apples. and allow the other in the 30% remaining. any number randomly generated has a greater chance of falling in the larger block then the smaller one. therefor, you have just increased there chances of 'getting' that number.

    Loop Through 3 Slot Machines Java Programming

    I don't do homework or write code for people, sorry. However; I am willing to aid in any problem you are trying to solve (as long as some genuine effort is put forth). I feal the best way for someone to learn is for them to complete the project on their own merit. (THINK FOR YOUSELF) If they dont wish to learn or do the work they should not have accepted the project or taken the course!





Designed by Tistory.