[Solved] CS-Assignment 1 Implementing Langtons Ant

$25

File Name: CS-Assignment_1_Implementing_Langtons_Ant.zip
File Size: 386.22 KB

SKU: [Solved] CS-Assignment 1 Implementing Langton’s Ant Category: Tag:
5/5 - (1 vote)

You will design, implement, and test a program that implements a simulation of Langtons 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.

WARNING Use the Internet to ONLY research how the game is structured and designed. Design and write your own program. Do NOT use any code that you did not write for yourself. That would be cheating. Much of what is available is more complicated or advanced than what is required here. It is harder to use it than to write your own.

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.

NOTE Think this through carefully before you start coding.

You can use a blank character for a white space. You can use the number sign (#) for black. And for the Ant? An asterisk of course (*). JJ Left ? Right? Those are relative directions! How are you going to keep track of the direction the Ant is facing? How will you remember what color the current cell occupied by the Ant is or was? You will created an Ant class to help organize, hold, and manipulate this information.

You will create your design document BEFORE you start coding. The TA will grade, in part, on how well your implementation matched your design. Remember, in your reflections document you can explain how you had to change the design because your first idea, just didnt work. Just explain what you learned. Simply stated, program design is identifying the problem to be solved, identify the inputs, specify the desired output, and then develop the algorithm(s) to convert the input into the output.

Your program will prompt the user to enter the number of rows and columns for the 2D array. Use those values to create a dynamic array of Ant objects. You should also prompt the user for the number of steps. Suggest values to the user. Notice in the Wikipedia article they mention several hundred and 10000. Use functional decomposition to develop functions to validate the input. What parameters and criteria do these functions need? You should start by asking the user for the starting location of the Ant.

You should add the option for the user to have a random starting location.

Note: You should start saving utility functions for future programs you write.

Note: For testing purposes always start the Ant at the same location. Then try different locations.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS-Assignment 1 Implementing Langtons Ant
$25