Example Code

Dominate your Office Bracket with the LabVIEW NXG 3.0 March Madness 2019 Simulator

Code and Documents

Attachment

Overview

Look, we get it. It's hard to follow college ball. With so many games and so little time, it can be difficult to be fully informed. You might be walking into your office bracket thinking "there's no way I can beat <rival coworker>, they live and breathe college ball!"

 

Luckily, you'd be wrong. Humans are fallible, emotional creatures. LabVIEW NXG is neither. And LabVIEW NXG wants what you want - to win it all. 

 

Let LabVIEW NXG carry your bracket to greatness. This LabVIEW NXG program simulates the outcome of March Madness 2019, starting with a full bracket of 64 teams. Let a state-of-the-art* simulator use statistics** from FiveThirtyEight generate a unique - but statistically likely - outcome. 

 

Description

This program uses rough odds found on FiveThirtyEight and a random number generator to provide weighted outcomes. Each individual match has a winner, and the bracket is filled in as the program runs. Run the program as much as you like (say, until your favorite team wins), copy down that bracket, and enjoy your new title of office soothsayer.

 

BASKETBALL.gif

 

Each team has an info cluster consisting of a team name and "Odds." These can be adjusted by scrolling down to below the bracket. The odds are a total percent chance of winning the whole tournament according to the FiveThirtyEight bracket predictions (note: for <1% chance of victory, I made some creative adjustments based on how likely that team was to win individual matches leading up to the finals). 

 

There is a "Match" subVI which pits two teams against each other. The odds are unitless - if Team 1 has a 17% chance to win the whole tournament and Team 2 has a 2% chance, the total range becomes 19. A random number is generated between 0-19. If the value is lower than 17, Team 1 wins - if it is higher, Team 2 wins. 

 

The code cuts the teams in half, displays the winners, and loops back to the beginning after a 1 second delay. 

 

Hardware and Software Requirements

LabVIEW NXG 3.0 (or just the Runtime if you run the EXE)

Click here to evaluate LabVIEW NXG for free!

 

Steps to Implement or Execute Code

In LabVIEW NXG 3.0, Open the LabVIEW project. Run the "March Madness Simulator" VI. 

To run the EXE, ensure that the LabVIEW NXG runtime is installed. Then open the EXE and press "Run."

 

Additional Information or References

*State-of-the-art can apply to any subset of a field, really. If we call this state-of-the-art for LabVIEW NXG basketball simulators, that's technically true. 

** I really took some liberties with the "statistics" on 538, using only the chance of winning the whole tournament instead of their "power" rankings. Feel free to update this code with a slightly more faithful recreation. 

Derek B. (esoDerek)
Product Marketing Engineer
National Instruments

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

Comments
Bas.v.E
Member
Member
on
I've downloaded the zip file, but when I try to run the exe I get an error that the "march Madness Simulator" requires LabVIEW NXG 2.0 Run-Time Engine. I have the 3.0.2 Runtime Engine installed. When I open the project, it runs just fine.
Contributors