# AoCG2021 Day 15: Langton's Hexa-Virus [tag:code-golf] [tag:hexagonal-grid] [tag:sequence] The story continues from [AoC2017 Day 22](https://adventofcode.com/2017/day/22), Part 2. --- The damn virus that was infecting a grid computing cluster now has jumped to a *hexagonal* computing cluster! In this cluster, the computers are connected in the honeycomb-like shape, and each computer has three neighbors. ``` .. .. .. . .. .. . .. .. .. . .. .. . .. .x .. . .. .. . .. .. .. . .. .. . .. .. .. ``` Initially, the cluster is completely clean, and the virus is at `x`, facing east. At each tick, the virus moves in the following manner: * If the current computer is clean, infect it, turn left (60 degrees), and move forward once (move to the neighboring computer in that direction). * Otherwise (the current computer is infected), clean it, turn right, and move forward once. Some initial iterations look like this (generated using [this program](https://tio.run/##jVNdj5swEHz3rxgpqoDG9DC5plcqHvrWh/6ASohKCEwOCTmRw6lUVX57umvz1aqV7sXrmd2dtc1w@Tk8n83hft/hix6r09lUPb5W5jScTXDFZzOIHepeVyZDZ1pdD6hMg@HFGvS6HT5NrG4yX7ambXd6HoRodItLeLJdI1G/WOvWOsoE2rOFpX5YmqfD@FHiPfMuUW8SR4mjS6BrnQbynDp5EmsxqjNcbGeGMPgWcFVoZR2xBA@G7q8awRhIaNPkQRCxlu5dHfYI672KHh7SCG@QslqyqL39r9q7v9WueunCHzlP0m7eiBE5ikRCSaQSBwm@Ol1yXj9IPEl8dOuyV9ygfNxCUlCHTSQtRTKKdBQ1q6cpbjH1p4mPW5zygdIpviK/YJqbPk7xNfkZ0znTYymE/6jT10Qi3DvnuGp@rqbjXMjniQRbyzmLqF/EqShDqChIHxyKJxg7nEw4mXA8F8RqZWZi6lDRzY1ij/OkZWwxltnoHDqyIRb@JpjrVtf22oRjxLb9h/sFdt4MXMVZmr5s2YFj0ZVUZfQPf/tiPoxcR5ZFuJGc7VkW1FEKb9Xv/EiuyNXchP999vmkXCSl8K@@UoooP9QT4n7/DQ); `.` is clean, `*` is infected, `x` is the virus at a clean computer, and `X` is the virus at an infected one): ``` .. .. .. . .. .. . .. .. .. . .. .. . .. .x .. . .. .. . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. .. .. . .. x. . .. .* .. . .. .. . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. .x .. . .. *. . .. .* .. . .. .. . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. x* .. . .. *. . .. .* .. . .. .. . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. ** .. . .x *. . .. .* .. . .. .. . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. ** .. . .* *. . .. x* .. . .. .. . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. ** .. . .* *. . .. *X .. . .. .. . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. ** .. . .* *. . .. *. .. . .. x. . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. ** .. . .* *. . .. *. .. . .. *x . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. ** .. . .* *. . .. *. x. . .. ** . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. ** .. . .* *x . .. *. *. . .. ** . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. ** .. . .* X* . .. *. *. . .. ** . .. .. .. . .. .. . .. .. .. .. .. .. . .. .. . .. *X .. . .* .* . .. *. *. . .. ** . .. .. .. . .. .. . .. .. .. .. .. .. . .. x. . .. *. .. . .* .* . .. *. *. . .. ** . .. .. .. . .. .. . .. .. .. .. .x .. . .. *. . .. *. .. . .* .* . .. *. *. . .. ** . .. .. .. . .. .. . .. .. .. ``` A better visualization can be seen [here (pdf)](https://oeis.org/A269757/a269757.pdf). The number of infected computers at each iteration is [A269757](https://oeis.org/A269757): ``` 0, 1, 2, 3, 4, 5, 6, 5, 6, 7, 8, 9, 8, 7, 8, 9, 10, 11, 10, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 18, 17, 16, 17, 18, 19, 20, 19, 18, 19, 20, 21, 22, 21, 20, 19, 18, 19, 20, 21, 22, 21, 20, 21, 22, 23, 24, 23, 22, 21, 20, 21, 22, 23, 24, 23, 22, 23, 24, 25, 26, ... ``` Your task is to output the sequence. Standard [tag:code-golf] rules and [tag:sequence] [I/O methods](https://codegolf.stackexchange.com/tags/sequence/info) apply. (0-based and 1-based indexing allowed.) The shortest code in bytes wins.