[SOLVED] CS2 -Assignment 1

30.00 $

Category:

Description

Rate this product

  Program        Design      and         Testing    

Implementing Langton’s Ant

Goals –      

  • Review of programming with arrays
  • Convert requirements (i.e. the rules) to a software design
  • Think about the testing process, before and after writing the program.

Assignment –

You will design, implement, and test a program that implements a simulation of Langton’s Ant.  For a brief explanation consider Wikipedia:  https://en.wikipedia.org/wiki/Langton%27s_ant.  Note that is can be considered a cellular automaton.  This means that you have an array or matrix of cells.  Each turn or step the value of each cell may change based upon a simple rule.  For the Ant there are two simple rules.

 

The rules are:

 

  1. In a white square, turn right 90o and change the square to black.
  2. In a black square, turn left 90o and change the square to white.

 

 

Suggested plan to design and code this project:

First.  Get a pencil and some paper.  Seriously.  Low tech but it works.  Develop an algorithm to apply the rules  Answer the questions about the Ant; knowing the direction it is moving, and saving the color of the cell it is in. You’re not finished with the design yet!

 

Now that you have your algorithms developed convert them to pseudocode or flowcharts are whatever system you chose to represent program logic.  Walk through your pseudocode.  Did you miss any details?  It’s much easier to find and fix logic errors now.

 

Now it is time to dig out the keyboard and start entering code. JJ