Challenge Time Slot Machine

  1. Challenge Time Slot Machine
  2. 12 Times Slot Machine Games
  3. Five Line Free Slot Machines
  4. Best Slot Machines To Play

It’s time to reveal the Trivia Challenge answer! A bat is a mammal that is able to fly and associated with Halloween! Everyone in the comments earlier was really on top of their trivia game because we received over 2,500 comments with the correct answer!

Have you ever wished that slot machines dispensed money as easily as an ATM? Well so did [Scotty Allen] from Strange Parts, so in collaboration with his friend [Matt] decided to combine the two. After a four-month journey fraught with magic smoke and frustration, they managed to build a fully functional ATM slot machine.

The basic idea is that you insert your card and enter your pin like on a normal ATM, select your winning amount, and pull the lever. This sets wheels spinning, which come to a stop with three-of-a-kind every time, and you win your own money as a bucket load of coins with all the accompanying fanfare. The project took way longer than [Scotty] expected, and he ended up missing his original deadline to show off the machine at DEF CON.

They started with an old broken Japanese slot machine, and replaced the control board with an Arduino Due after a lot of reverse engineering and hacking. [Scotty] did a cool video just on getting the original vacuum fluorescent display working. Integrating the ATM parts proved to be the biggest challenge, with number of very expensive parts releasing their magic smoke or getting bricked in the process. [Scotty] came up with an ingeniously simple hack to interface the ATM hardware with the Arduino. The cash note dispenser uses multiple sensors to detect if there are notes loaded and if one is successfully dispensed. These were spoofed by the Arduino, which controls two coin hoppers instead to dispense appropriate amount of quarters or pennies. The build was rounded off with some very neat custom graphics on the glass panels, and the machine was finally showed off at a local arcade.

This was an awesome project, and we can appreciate the fact that [Scotty] made no attempt to hide the real emotional roller coaster that anyone who has worked on a large project knows, but is rarely documented in logs. [Scotty] has made a name for himself by building his own iPhone from parts and touring Shenzhen’s many factories. Check out the videos after the break

[ Course Schedule ] [ Syllabus ]

ITEC 120
SlotMachine

Objectives

You will make any necessary fixes to your SlotMachine class, then run it many times and gather some statistics.

Assignment

Write a test driver for your working SlotMachine that spins it a million times and counts how many jackpots and pairs are spun.

Correct your SlotMachine class

If you need to make corrections to your slot machine class, the problem description, with added notes, is at the bottom of this page.

What are the odds?

Currently you have a driver that spins your slot machine until a jackpot is spun. You print the slot machine after each spin. If your driver works, then you know you spun at least one jackpot.

But now, let's look closer at how often your slot machine will produce a jackpot. Write a new driver which spins the jackpot a million times and counts the number of pairs and jackpots that were spun. You will compare your results to the mathematical odds of spinning jackpots and pairs.

Assuming 3 slots with 7 possibilities for each slot, for 1 million spins:

Does your slot machine come close to that? How close?

printing takes a lot of time

Computers are fast. You can spin your slot machine a million times in under a second. But, you can't print it a million times in under a second. I/O, or Input/Output, takes a lot of time. As you develop your driver, you probably want to run it a smaller number of times, i.e. 100, printing each spin. Once you think it is working correctly, remove the print statement and run it a million times, and just print the results (counts of pairs and jackpots).

Questions to consider

How close are your results to the mathematical results? How does that change if you raise or lower the number or trials run?

Challenge exercise (optional)

Submit Your Assignment

Submit your SlotMachine.java and your test driver (whatever you called it) to the Lab Submission Folder on D2L.

Lab Quiz problem description with notes

Write a class called SlotMachine representing a simple slot machine.

Your slot machine will have 3 slots (integers) which are only accessible from within the class.

Challenge Time Slot Machine

The constructor will create a new instance of the class with three randomly generated slots in the range [0,6]. (Remember to import java.util.Random at the top of your class.) The constructor has NO parameters because the data in this class is randomly generated.

There are no getters or setters for this class. There are no getters and setters because they are not needed. Think about a real slot machine - should you be able to set one of the slots manually? No! The only way you can change the state of the slot machine is to spin it. Should you be able to 'get' the value of slots individually? No - not necessary. The 'display' (toString) of the machine shows you the value of all slots at the same time.

Best slot machines to play

The spin method simulates the spinning of slot machine by randomly generating each slot. Each slot is in the range [0,6]. No parameters for this method!This method is a void method. It's purpose is to change the state of the slot machine.

The isJackpot method answers if the slot machine is showing a jackpot, in other words, all three slots are the same. This is a boolean method.

12 Times Slot Machine Games

The isPair method answers if the slot machine is showing a pair, i.e. two slots are the same, but the other one is different. This is also known as Two of a Kind. This is a boolean method.

The toString method formats the slot machine as a String. It needs to contain the current value of each 'slot'.

Five Line Free Slot Machines

Write a driver which creates a SlotMachine and spins it until a jackpot is spun. Print the slot machine after each spin. For every spin, call the isPair method and print a message if there is a pair. Print a jackpot message when a jackpot is spun.

The driver should also count how many spins it took until a jackpot was spun, and print that out at the end. The driver does all the printing. The SlotMachine class does NO printing.

Best Slot Machines To Play

[ Course Schedule ] [ Syllabus ]