Example Code

Higher or Lower Game

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 project demonstrates how you can make a simple game of 'Higher or Lower' and use a picture ring to display each playing card

 

Description

This uses a state machine to realize transferring between different states of a Higher or Lower game.

 

Requirement

  1. LabVIEW 2013 (or compatible)

 

Steps to Run

  1. Run the 'Main.VI'.
  2. Click 'Start' to begin a game.
  3. A card will appear and you must guess if the next card will be higher or lower. If your guess is correct, your current score will increase by one. If you are incorrect, your current score will reset to value. Note: For this game, Ace is high and if the new card is equal to the current card, your score will be neither higher nor lower and your current score will therefore reset to zero.
  4. The game is played with 52 cards, therefore will must make 51 decisions on whether the next card will be higher or lower. If at the end of the game, you have beat the record holder, you will have the opportunity to enter your details.

How to Reset Record Holder Score

Open the text file called 'data.txt' and change the current name to a space character and the current score to zero.

 

Additional Information or References

Block Diagram

main.JPG

 

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

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