The Langston's Ant Challenge is to determine the number of Black squares after K Ant moves.
An infinite white board has an Ant at the center. Direction is not required.
Movement and Affect:
1) At a white square, turn 90° right, White goes to Black, move forward one unit 2) At a black square, turn 90° left, Black goes to White, move forward one unit
After a given number of moves how many Black squares are present.
Input: K, number of moves from 100 to 12000
Output: BLK, number of Black squares
Example: K=5, BLK=3 [00000;00010;00110]
Note: After 11000 moves a pattern emerges
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers40
Suggested Problems
-
How to find the position of an element in a vector without using the find function
2818 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
651 Solvers
-
Determine Whether an array is empty
814 Solvers
-
Arrange vector in ascending order
821 Solvers
-
Determine the number of odd integers in a vector
837 Solvers
More from this Author306
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!