Example Code

Let LabVIEW NXG Choose Your NCAA Teams with the March Madness 2018 Simulator

Code and Documents



This LabVIEW NXG program simulates the outcome of March Madness 2018, starting with a full bracket of 64 teams. For those of you who (like me) do not follow college basketball too closely, this program is the perfect way to build a unique (but likely) bracket outcome!


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.


A sample run of the March Madness SimulatorA sample run of the March Madness Simulator


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 2.0 

Click here to evaluate LabVIEW NXG for free!


Steps to Implement or Execute Code

 Open the LabVIEW project. Run the "March Madness Simulator" VI. 


Additional Information or References

 For a far more nuanced way to calculate team victory, see FiveThirtyEight's guide here.

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.