Example Code

Magic

Code and Documents

Attachment

Introduction

This VI uses an algorithm which takes user feedback from four separate SubVIs to calculate a number that a user is thinking about between 1 and 15.

Description

You are capable of determining an unknown variable if there are enough equations to help solve for the variable. This example demonstrates that theory, the unknown variable is the users chosen number within the range given by the program. The questions asked by the program are the same, they just change the selection set. By using the right combination of numbers in a selection set and changing only a few numbers from one set to the next you can treat each question as an equation and solve for the chosen number using a type of matrix analysis.

Steps to Implement

1. Download the Magic.zip file and unzip it onto your computer

2. Open the Magic VI

3. Select a number between 1 and 15 and then ready hit OK

4. Follow the directions on the Front Panel until the game has ended

5. Select whether you would like to play again or not

Requirements to Run

Software

LabVIEW 8.6 or later

Hardware

N/A

Additional Images

Front Panel When First Opened

magic1.PNG

Front Panel While Running

magic2.PNG

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

Contributors