Page 2 of 2
Re: Langton's Ant Music
Posted: August 30th, 2022, 3:18 pm
by wirehead
breaker's glider gun wrote: August 30th, 2022, 9:15 am
404 four the syntax guide
...........................^for
...........................^but four for a joke
I converted the syntax guide to Markdown to make it easier to maintain, The new link is
https://github.com/dragoncoder047/ca-ex ... /format.md. I updated the link on the Langton-Music page itself so that should work. <s>Don't use the link in my earlier post.</s> I fixed it there too.
Re: Langton's Ant Music
Posted: August 30th, 2022, 4:32 pm
by breaker's glider gun
Idea: making load not automatically reset, and making a "reset" button
Code: Select all
bpm: 360
[Beetle langton
{1:0 => put(1) rt fd play(A#dir)}
{1:1 => put(2) lt(#dir) fd fd(#dir) play(G#dir)}
{1:2 => put(0) lt(#dir) fd(2) fd(#dir) play(G#dir) state(2)}
{2:0 => put(1) lt fd play(A#dir)}
{2:1 => put(2) rt(#dir) fd(#dir) play(G#dir)}
{2:2 => put(0) rt(#dir) bk(2) fd(#dir) play(G#dir) state(1)}
]
.[langton:1:1]
Re: Langton's Ant Music
Posted: August 30th, 2022, 8:10 pm
by wirehead
breaker's glider gun wrote: August 30th, 2022, 4:32 pm
Idea: making load not automatically reset, and making a "reset" button
But if the contents of the text box have changed, what gets overwritten by load? Either all of it or none of it (and none is useless.)
Re: Langton's Ant Music
Posted: August 31st, 2022, 11:10 am
by breaker's glider gun
wirehead wrote: August 30th, 2022, 8:10 pm
But if the contents of the text box have changed, what gets overwritten by load? Either all of it or none of it (and none is useless.)
What the ant does; so, if I make the ant "blah," and run it as langton's ant for a bit, and then edit what blah does, and load it, it keeps the previous blocks and the position of the ant, but loads what it now does, however if I change the name of the ant it will not progress, so you have to reset.
also, I've been wishing for some way to declare colors.
Re: Langton's Ant Music
Posted: August 31st, 2022, 4:39 pm
by wirehead
breaker's glider gun wrote: August 31st, 2022, 11:10 am
wirehead wrote: August 30th, 2022, 8:10 pm
But if the contents of the text box have changed, what gets overwritten by load? Either all of it or none of it (and none is useless.)
What the ant does; so, if I make the ant "blah," and run it as langton's ant for a bit, and then edit what blah does, and load it, it keeps the previous blocks and the position of the ant, but loads what it now does, however if I change the name of the ant it will not progress, so you have to reset.
Well, dump, edit, and then load again
should work, but the dumper is bugged right now!

I'd welcome any help here! (EDIT: Dumper is now fixed in V2.)
breaker's glider gun wrote: August 31st, 2022, 11:10 am
also, I've been wishing for some way to declare colors.
Me too! Initially I was hoping to use the same functionality as in Golly that uses a static list of colors, and just steps through them (so you don't get random colors that change every time the page crashes and forces you to reload) using the code
here but nobody ever found the code for that.
A lot of the bugs are probably due to me writing a terrible parser. I should probably instead redo the whole format and make it based off of XML. That way all I would have to write would be a RLE parser. Do you like that idea? (EDIT: Yes - now implemented!)
Re: Langton's Ant Music
Posted: September 1st, 2022, 2:33 pm
by breaker's glider gun
This might be tricky, but another suggestion:
make a "track ant" button, with a box for an integer to the right.
when you click on it, you then must click on a square containing an ant.
the camera will follow the ant around, and will be zoomed out enough to see a square with width 2n, where n is the int in the box.
the button will then be replaced with "stop following."
oh and also if you could make it dynamically change the size of the camera to be a rectangle with width 2n, that would be nice.
Re: Langton's Ant Music
Posted: September 1st, 2022, 3:33 pm
by wirehead
breaker's glider gun wrote: September 1st, 2022, 2:33 pm
This might be tricky, but another suggestion:
make a "track ant" button, with a box for an integer to the right.
when you click on it, you then must click on a square containing an ant.
the camera will follow the ant around, and will be zoomed out enough to see a square with width 2n, where n is the int in the box.
the button will then be replaced with "stop following."
oh and also if you could make it dynamically change the size of the camera to be a rectangle with width 2n, that would be nice.
ah yes, there's a whole lot of features that I'd like to add, but don't have the time or energy to.
The autofit mechanism doesn't work perfectly, and for small patterns it is fine to keep track of all the ants. For larger patterns the ants move slow enough to be able to pan around manually with autofit turned off.
As-is, your suggestion doesn't seem that tricky. I would probably do a pulldown menu with all the ants in it (plus a "None" option to turn off tracking) instead of "track" + click on an ant, because I haven't yet implemented the code to change mouse x/y on the canvas to which cell it is on. I put it in an
issue if you have more comments. (EDIT: implemented, and issue closed.)
I also want to be able to have a pen tool to draw ants and squares without having to fool around with the text box - but that's probably harder than track-an-ant so I'll push it off. (EDIT: that's been implemented too.)
Re: Langton's Ant Music
Posted: September 1st, 2022, 3:41 pm
by wirehead
Sorry for double posting, but I just wanted to take a moment to say that you can submit suggestions and bug reports
on Github. It saves me the time of having to copy them over myself, and also avoids bug-report clutter on this thread to make space for more meaningful discussion. If I were a moderator, I would just delete a post from here once I copied it over to GitHub, but I can't do that right now, so yeah.
Re: Langton's Ant Music Challenge
Posted: September 6th, 2022, 5:00 pm
by wirehead
Challenge time!
I'd like to offer a prize of $0 + bragging rights to the person who can create the shortest ant script that plays the "Seven Nation Army" bassline. Bonus points for drums.
Metric: Number of nonzero cells + Number of XML tags. Smallest score wins.
Re: Langton's Ant Music
Posted: September 18th, 2022, 1:27 pm
by breaker's glider gun
:}
Code: Select all
<langton>
<config name="stepCount">6603</config>
<config name="bpm">360</config>
<breed species="Beetle" name="langton">
<case state="1" cell="0">
<action>
<command name="put">1</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C2:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="1">
<action>
<command name="put">2</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A2:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="2">
<action>
<command name="put">0</command>
<command name="rt">2</command>
<command name="fd"></command>
<command name="state">2</command>
<command name="play">A4:##dir'2*3/1-;</command>
</action>
</case>
<case state="2" cell="0">
<action>
<command name="put">2</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C4:##dir'2*3/1-;</command>
</action>
</case>
<case state="2" cell="1">
<action>
<command name="put">0</command>
<command name="lt">2</command>
<command name="fd"></command>
<command name="state">1</command>
<command name="play">A4:##dir'2*3/1-;</command>
</action>
</case>
<case state="2" cell="2">
<action>
<command name="put">1</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A2:##dir'2*3/1-;</command>
</action>
</case>
</breed>
<ant id="langton-1" x="0" y="0" breed="langton" state="1" dir="0"></ant>
</langton>
I like the mega-update :)
Re: Langton's Ant Music
Posted: September 18th, 2022, 6:25 pm
by wirehead
I like it! Doesn't ever seem to form a highway.
Good, because I'm not going back to the old one.
Re: Langton's Ant Music
Posted: September 22nd, 2022, 8:26 pm
by breaker's glider gun
wirehead wrote: September 18th, 2022, 6:25 pm
I like it! Doesn't ever seem to form a highway.
40K and no highway:
Code: Select all
<langton>
<config name="stepCount">40000</config>
<config name="bpm">36000</config>
<breed species="Beetle" name="langton">
<case state="1" cell="0">
<action>
<command name="put">1</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C2:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="1">
<action>
<command name="put">2</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A2:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="2">
<action>
<command name="put">0</command>
<command name="rt">2</command>
<command name="fd"></command>
<command name="state">2</command>
<command name="play">A4:##dir'2*3/1-;</command>
</action>
</case>
<case state="2" cell="0">
<action>
<command name="put">2</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C4:##dir'2*3/1-;</command>
</action>
</case>
<case state="2" cell="1">
<action>
<command name="put">0</command>
<command name="lt">2</command>
<command name="fd"></command>
<command name="state">1</command>
<command name="play">A4:##dir'2*3/1-;</command>
</action>
</case>
<case state="2" cell="2">
<action>
<command name="put">1</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A2:##dir'2*3/1-;</command>
</action>
</case>
</breed>
<ant id="langton-1" x="6" y="-20" breed="langton" state="1" dir="2"></ant>
<rle x="-20" y="-31">$2(10.).B$2(9.)B2.AB$2(4.).B2(4.)3A2B$2(4.).2(2A)2(2.).A2.BAB2.AB$2(4.)2(.A.)2(2.)3(.B)3BA$2(4.)2(.A.)2(2.)2A3B2.ABA$2(4.)2(.A)A2.2A2(BA)A.2(2A)B.A$2(4.)2(.2B)2B2A2(B.).BA.2A2(2.)B$2(5.)B.A2(B.)A.2BA.3A3BA3.B$2(4.).BA.A3B.2A3(B.)2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A.A2BA2(.B)BA$3.A2B3A.2(2A)2(B.)2A.2BAB.2A3.A2(B.)2(BA).3AB$2(3.).B2.A.BA2.AB.A.2BAB2AB.2A2.2(3A)2.A2B.2A$2(3.)3B.A3B2.B2(2A)2.2BABA.B2.2B2.A.B2A2(BA)AB$2(4.)A2.2(3B)A2B.2(2B)AB2.BA.2A2.2(B.)BA3.AB$2(3.).2(AB)2A.B2(2.).BA2(3.)AB2(2A).2BA2B.2(2A)$2(3.)3(.B)A.2(ABA)AB3.2(3A.)2(.A)2(2.)3A.A$2(4.).BAB2(.A.A)2A2B2A.2B2(2A)AB.A3.B$2(5.)B2.2BA3B2(.B.)B.2(2A).2(2B).B2.A$2(6.)2A.A2B2.BA2.B2(2.)A3B.3B3ABA$2(6.)2(2B).2B.B2.A2B2(.B)B2(2.A)A.2AB.BA$2(6.)B2A.AB2.ABA.2(2BA).2A2(2.)A.2A2.A$2(6.)3BA2B2(.A)BA2.AB3.A2B2(.B)2AB2A$2(6.)B.BA.2BABA.B.AB2A.B.A2B2.2A.2B$2(6.)B.2(2B)3A.3BA2.2(A.2A)2ABA$2(6.)2(B.)2(A2B)2.2B.B2(.A)2.3AB2.A$2(5.)2(.B).AB2.B.2AB.A3BA2(.B)3B$2(6.).B2(A.)2A.2(2A)2(B2A).2(2B)A$2(9.)A2.B2(.A)2A.2(AB)3.B$2(9.)3(A2.)3.A.A$2(8.).B2(2A)$2(10.).B</rle>
</langton>
also, using anything in the "actions" thing speeds it up.
Re: Langton's Ant Music
Posted: September 22nd, 2022, 9:09 pm
by wirehead
breaker's glider gun wrote: September 22nd, 2022, 8:26 pm
also, using anything in the "actions" thing speeds it up.
That's interesting... not a bug, but I never noticed that. All I noticed is that changing tabs (leaving LAM running in the background) results in a speedup. I attribute this to the rendering loop using
requestAnimationFrame(), so the browser automatically shuts off the rendering thread when there's nothing to render.
Re: Langton's Ant Music
Posted: October 21st, 2022, 12:12 pm
by breaker's glider gun
Code: Select all
<langton>
<config name="stepCount">0</config>
<config name="bpm">240</config>
<breed species="Beetle" name="RRLLL">
<case state="1" cell="0">
<action>
<command name="put">1</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C2:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="1">
<action>
<command name="put">2</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">B2:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="2">
<action>
<command name="put">3</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">G3:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="3">
<action>
<command name="put">0</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A3:##dir'2*3/1-;</command>
</action>
</case>
</breed>
<ant id="RRLLL-A" x="0" y="-1" breed="RRLLL" state="1" dir="0"></ant>
</langton>
Re: Langton's Ant Music
Posted: January 19th, 2023, 5:49 pm
by wirehead
Another update to this here thing I have made.
I replaced the random color function with David Bau's seedrandom.js, so the colors for the ants and the states are at least predictable, if not the same. But you can now use "colorNN" config tags to fix the color for a particular state if you want.
I also added functionality to control the simulation using the media session API, so you can use the browser media controls on Langton's Ant Music without having the tab in the foreground as if it was a youtube video or a podcast. I don't know if anyone else really needed this functionality but it was a good exercise in debugging. (There are still bugs!!)
Re: Langton's Ant Music
Posted: January 19th, 2023, 9:52 pm
by breaker's glider gun
wirehead wrote:
Another update to this here thing I have made.
I replaced the random color function with David Bau's seedrandom.js, so the colors for the ants and the states are at least predictable, if not the same. But you can now use "colorNN" config tags to fix the color for a particular state if you want.
:claphands:
Re: Langton's Ant Music
Posted: January 27th, 2023, 9:00 am
by Sinemon
That was a bit of fun. I recently made a version of Langton's ant that supported user selectable multiple colors and direction changes. I wonder what it would sound like to assign different notes to each colour.
Re: Langton's Ant Music
Posted: January 27th, 2023, 10:15 am
by wirehead
Sinemon wrote: January 27th, 2023, 9:00 am
That was a bit of fun. I recently made a version of Langton's ant that supported user selectable multiple colors and direction changes. I wonder what it would sound like to assign different notes to each colour.
You can click on the "Edit" link at the top-right to be able to modify the colors and direction changes (to use your terminology), and assign different notes. The "Formatting" link has some help on what options are available there. You will need to know XML but the editor really helps with that part. I hope this helps!
Re: Langton's Ant Music
Posted: February 3rd, 2023, 1:57 pm
by BokaBB
Hi there. It might be a crazy idea but... what if not all cells produced music, but only some of them? Perhaps only just boen ones, or only surviving ones, or only dying ones, some kind of mixing between those and such? Maybe even there can be that only cells having some number of neighbours in some formations (like those different possible neighbourhoods used for non-totalistic rules)?
Good morning/afternoon/evening/night and sweet dreams!
Enjoy your life and all the best! May THE LORD help you!
Have a suuuuperior day (and this all also to your own)!
BokaBB
Re: Langton's Ant Music
Posted: February 4th, 2023, 6:53 pm
by wirehead
BokaBB wrote: February 3rd, 2023, 1:57 pm
what if not all cells produced music, but only some of them? Perhaps only just boen ones, or only surviving ones, or only dying ones, some kind of mixing between those and such? Maybe even there can be that only cells having some number of neighbours in some formations (like those different possible neighbourhoods used for non-totalistic rules)?
Something like this could probably be implemented using extremely complicated state tables using the ants already. I'm hesitant to add any sort of CA rule underlay to the world because this is just supposed to be Langton's Ant and related stuff.
Re: Langton's Ant Music
Posted: July 28th, 2023, 2:01 pm
by breaker's glider gun
breaker's glider gun wrote: October 21st, 2022, 12:12 pm
Code: Select all
<langton>
<config name="stepCount">0</config>
<config name="bpm">240</config>
<breed species="Beetle" name="RRLLL">
<case state="1" cell="0">
<action>
<command name="put">1</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C2:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="1">
<action>
<command name="put">2</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">B2:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="2">
<action>
<command name="put">3</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">G3:##dir'2*3/1-;</command>
</action>
</case>
<case state="1" cell="3">
<action>
<command name="put">0</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A3:##dir'2*3/1-;</command>
</action>
</case>
</breed>
<ant id="RRLLL-A" x="0" y="-1" breed="RRLLL" state="1" dir="0"></ant>
</langton>
Better:
Code: Select all
<langton>
<config name="stepCount">1126</config>
<config name="bpm">293</config>
<breed species="Beetle" name="RRLLL">
<case state="1" cell="0">
<action>
<command name="put">1</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C2:##dir'2*3/1-;</command>
<command name="state">2</command>
</action>
</case>
<case state="1" cell="1">
<action>
<command name="put">2</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">B2:##dir'2*3/1-;</command>
<command name="state">2</command>
</action>
</case>
<case state="1" cell="2">
<action>
<command name="put">3</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">G3:##dir'2*3/1-;</command>
<command name="state">2</command>
</action>
</case>
<case state="1" cell="3">
<action>
<command name="put">0</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A3:##dir'2*3/1-;</command>
<command name="state">2</command>
</action>
</case>
<case state="2" cell="1">
<action>
<command name="put">2</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">B4:##dir'2*3/1-;</command>
<command name="state">1</command>
</action>
</case>
<case state="2" cell="2">
<action>
<command name="put">3</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">G4:##dir'2*3/1-;</command>
<command name="state">1</command>
</action>
</case>
<case state="2" cell="3">
<action>
<command name="put">0</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A4:##dir'2*3/1-;</command>
<command name="state">1</command>
</action>
</case>
<case state="2" cell="0">
<action>
<command name="put">1</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C4:##dir'2*3/1-;</command>
<command name="state">1</command>
</action>
</case>
</breed>
<ant id="" x="3" y="-4" breed="RRLLL" state="1" dir="0"></ant>
</langton>
Re: Langton's Ant Music
Posted: July 30th, 2023, 9:19 am
by wirehead
breaker's glider gun wrote: July 28th, 2023, 2:01 pm
Better:
Code: Select all
<langton>
<config name="stepCount">1126</config>
<config name="bpm">293</config>
<breed species="Beetle" name="RRLLL">
<case state="1" cell="0">
<action>
<command name="put">1</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C2:##dir'2*3/1-;</command>
<command name="state">2</command>
</action>
</case>
<case state="1" cell="1">
<action>
<command name="put">2</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">B2:##dir'2*3/1-;</command>
<command name="state">2</command>
</action>
</case>
<case state="1" cell="2">
<action>
<command name="put">3</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">G3:##dir'2*3/1-;</command>
<command name="state">2</command>
</action>
</case>
<case state="1" cell="3">
<action>
<command name="put">0</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A3:##dir'2*3/1-;</command>
<command name="state">2</command>
</action>
</case>
<case state="2" cell="1">
<action>
<command name="put">2</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">B4:##dir'2*3/1-;</command>
<command name="state">1</command>
</action>
</case>
<case state="2" cell="2">
<action>
<command name="put">3</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">G4:##dir'2*3/1-;</command>
<command name="state">1</command>
</action>
</case>
<case state="2" cell="3">
<action>
<command name="put">0</command>
<command name="lt"></command>
<command name="fd"></command>
<command name="play">A4:##dir'2*3/1-;</command>
<command name="state">1</command>
</action>
</case>
<case state="2" cell="0">
<action>
<command name="put">1</command>
<command name="rt"></command>
<command name="fd"></command>
<command name="play">C4:##dir'2*3/1-;</command>
<command name="state">1</command>
</action>
</case>
</breed>
<ant id="" x="3" y="-4" breed="RRLLL" state="1" dir="0"></ant>
</langton>
It's very nice and also very strange. You have to run it for more than 1500 steps before it escapes an 8x8 bounding box. Weird!!