Example Code

Langton's Ant - Complexity from Simple Rules

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 VI demonstrates how to get behaviors of Langton's Ant in LabVIEW.

 

Description

The rules are simple. The ant operates on a black and white grid, starting with all squares white. If on a white square, turn it black, turn 90 degrees right, and move forward one square. If on a black square, turn it white, turn 90 degrees left, and move forward one square.

 

Requirements

  • LabVIEW 2012(or compatible)

Steps to Implement or Execute Code

  1. Set the figure of delay.
  2. Run the VI.

Additional Information or References

VI Snippet

 BD.png

Notes: More information about Ant

 

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

 

Ian S
Applications Engineer CLA
National Instruments UK&Ireland

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