Example Code

Multi-User Slot Machine Game using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This example VI is a slot machine game built with LabVIEW.


Description
When Slot Main 2012 NIVerified.vi is started, the VI prompts the user for their name.  If the name is found, the VI will retrieve their number of credits; if no entry is found, it will give the user 500 credits to start.  Should a user run out of credits, the user can reset their number of credits to 250 by clicking the "Reset Credits" button and entering the passwork "admin".

Every time a bet is placed, the new number of credits is written to the "User Data.txt" file.  If the text file does not exist (i.e. the first time the VI is run) it will make one.

 

How to Win:      Match all three numbers and win up to 200 times what you bet

                         Match two numbers and win up to 15 times what you bet

 

If no items match you can still win back some of what you bet, or lose all of what you bet

 


Requirements

  • LabVIEW Base Development System 2012 (or compatible)


Steps to Implement or Execute Code

  1. Unzip the attached folder to your computer
  2. Open the LabVIEW Project "Slot Machine 2012 NIVerified.lvproj"
  3. Open the VI "Slot Main 2012 NIVerified.vi"
  4. Run the program

 

Additional Information or References
VI Front Panel

Slot Machine FP.PNG

 

VI Block Diagram

 b.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Brandon L.
Automation Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.