Tjurmite HQ, Langton's ant nest and some glider's hive (...60% work in progress...)

Basic algorithm is very simple:
array field[width][height]

//ant can walk on it

color= field[ant.x][ant.y]

//ant get color of field at his position

...

//ant react on this state, usually rotates right or left

...

//ant goes to next position according to his direction


Next I will show what can be done with development of this.
Firstly i had investigated performance and usability of available technologies. Examples for all languages available in repository. For most ant types comfortable visualisation speed is 50k~500k opetations per sec (1k~20k op/frame), so any language except python are good and SINGLE ant will use less than 4ms per frame for walking. Walking of single ant can't be parallelised, so I don't expect speedup after implement all in GPU shaders, until number of ants more than 20~30. Preparing 1024*1024 pixels to drawing (compute R,G,B, zoom) usually slowest part for CPU but GPU compute it very fast. So now GPU is for drawing but only.
tec: time of 10M steps of ant, lower is better draw time 1024*1024px including filling texture if need, lower is better pros cons
java script 220ms easy to share, crossplatform, easy to start, easy to make GUI refactoring is not easy, code quality can and will suffer. Performance will degrade, especiaaly if using non-vanilla frameworks
js HTML draw (table, div, itc) 220ms slower
js canvas 220ms 40~70ms, calculate each px color every frame is slowest part, this have to be done on GPU
js p5js 220ms a bit slower than vanilla js canvas easiest to start, you will like Code Train videos
js webGL 220ms 10~20ms steep learning curve not fast to implement new capabilities
js webAssembly TBD probably 140-180 not easy to setup interaction js-webasm-GLSL
Java (processing) 120ms 30~40ms
easy to setup, many libraries to made sound, itc not easy to setup debugging if you use only Processing IDE
Python very slow, don't try to run 1M or more slow i did not try openGL lib to draw because overal performance less than 100x of other
C# 110ms 10~60ms (calculate each px colors every frame without GL is slowest part, i was implement parallel.For to get comfortable FPS easy to make GUI, will be cross platform starting from
.NET5
not easy to implement GPU processing without external engines
C# .NET 5 TBD, probably few% speedup
C# Unity TBD need to install toolchain
C++ 120ms need to review why slower than C# probably 10~40ms, Need to review approach have to be faster, but I cant reach hard to setup draw routine
C++ openframeworks TBD need to install toolchain
TODO Examples of this chapter available in JS app, but need to link here.

0,1.

Firstly I read about ant in Scientific American article 1989-11. There was described simple ants as in wiki article. It was easy for me to implement in BASIC language on paper.
Geting PC in 2001 i found the BASIC language outdated but Java Script was good, and still good after 20+ years. There was no canvas but good speed could be achieved with Java embedded apps.

I was interested how ant behave on field that is not solid, but filled with some patterns. For example
rows battern [[b,b],[w,w]]

checkers pattern [[b,w],[w,b]]

[[b,b],[b,w]]

2. Playing with direction

Basic ant can rotate in discrate steps and has 4 direction according to field 2D axis. It is easy to make 8 directions and move diagonally

Bsic ant changes his direction by increment or decrement that classifyes him as relative direction ant. Next simple ant change direction to absolute numbers

And the Direction is simply a number, so it is possible to make it any and assign any action to this numbers

3. Floating point ants

Now it is time to make direction a floating point number. Because of this there are 2 possibilities instead of switch(dir):
a) switch(~~dir) //or switch(dir>>0)

a1) switch(Math.floor(dir))

a2) switch(~-dir)

b) check intervals
if(dir>.. && dir<..)


4. The sound of turmite, the Langton's ant

....TODO To faster choose what can be useful it is better to make some visual and see how parameters changes in time and space:

5. More Visualisation

Write visit count to addition aray. arrayVisits[pos]++;

Write time of visit. To simplify I wrote ant step № instead of time

Detect and show repetitive patterns (roads)
Write and display any other ant state, like direction. (see this in one of full JS apps below)

6. What next

a) Multiple field, using aray of history of directins, visits, its
b) Walls, reverseble ants
c) other dimensions and grids
it is not easy to implement Display of hex or some Graph


Next are current apps and galleries of saved ants.
Dont judge me for naming buttons like "rAudioFreq_mul" but not "Transpose audio": this is by design to fast copy and search in source

open with w=1024&h=1024

open with w=1980&h=1080

open with w=800&h=600

open with w=32&h=512


open TjurmitsHQ.htm to save presets click gear, copy, paste to file and edit it to fit old format (add starting with

  function getPresetJSON() {
	return{
	
and
	};
	
before the last brace. TODO improve this ssave/load
Select saved presets in the top of menu 🡆


Java Processing basic functionality, benchmark
Java Processing app with 3 separate fields, non-self-describing GUI: just parameters

C# app, not feature rich, just implement basic functionality, benchmark
C++ attempt
python trial
p5js java script. Basic functionality, benchmark
TODO make main btn

TODO...examples
haotic: never spawn structures or become some non-haotic form
symmetric: 2,3, n-axis of symmetry
roads: spawn roads (repeating pattern) TODO example of int and float roads
non-haotic but nor symmetric and nor road
still loop: endless loop of pattern on the same finite area without change field state, only area near ant changes
living loop: endless loop of pattern on the same finite area, field changes each loop, looks as amimation
oscillator: loop that erase previous history and restore initial state of field.
reversable/non-reversable: possible to make changes in ant state (easiest way - to make some wall TODO example) to it goes in reverse, restoring initial field state

Type of ant depends of field pattern: e.g. ant can be perfect on checkers but haotic on black

You can send settings, your code findings, itc. via github system 88888 or to pavel.b.kr12@gmail.com I have no payed job now, so if you have any for me or can support - it will be good.