Langston's Ant - MATLAB Cody - MATLAB Central

Problem 2147. Langston's Ant

Difficulty:Rate

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

43.62% Correct | 56.38% Incorrect
Last Solution submitted on Jan 02, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers35

Suggested Problems

More from this Author308

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!