Hi,
I understand your requirement, you want to make a langton's ant using html and javascript and css. You are planning to use it for some ai backend that you have developed. Basically a langton's ant moves in a grid . The gird is has two colors (eg white and black). Initially the entire squares are white. when the langton's ant moves 90 deg right from a white square , the white squre turns black. when the langton's ant moves 90 deg left from a black square, the black square turns white.
steps to solve your problem:
1. initial state black squres=[], white squres=[], previousMove="",presentMove="";
2. comparing the presentMove and previousMove and checking the classList of the selected element, we can change the color of the tiles.
tech stack used:
html,css,javascript
Looking forward to working with you
Regards
Narasimha Sriharsha KANDURI
your friendly neighborhood fullstack js web developer.