Francesco215 / requirements_for_self-organization_video

this is the repository for the video for the paper https://francesco215.github.io/Language_CA/
1 stars 1 forks source link

Snake-ising model #17

Closed Francesco215 closed 10 months ago

Francesco215 commented 11 months ago

We need an animation that draws lots of circles in a snake pattern like the one of the website

Screenshot 2023-12-13 alle 19 08 32

As usual each node can have two possible values (0 or 1), so they can have two colors WHITE or BLACK, and we also need a function that animates the color changes. Maybe we can just reuse the update_fill function already present in the code

Each circle will be connected by a segment with the color=hamiltonian_color

i'd say that is better to put the code in a separate python file inside the project folder

Tip

In the website code i wrote a function that returns the realtive position in a $i,j$ grid of all the elements in the serpentine, i think translating this in python this will make your job easier.

I don't know how deep i have to go into the explanation of this function, but printing the output a couple of times should be enough. if you need any clarifiaction you can always ask

function Serpentine(i, nSH) {
        //nSH represents the variable numSpinsHorizontal
        if (i<nSH) return [i, 0]
        if (i==nSH) return [nSH-1, 1]
        if (i<=2*nSH) return [2*nSH-i, 2]
        if (i==2*nSH+1) return [0,3]

        let recursive=Serpentine(i%(2*(nSH+1)),nSH);
        recursive[1]+=4*Math.floor(i/(2*nSH+2));

        return recursive
}
n-shevko commented 10 months ago

Done. project/snake_ising.py functions create_snake update_snake_colors

https://github.com/Francesco215/requirements_for_self-organization_video/assets/11594789/3fbfab71-c5de-452b-af61-7a8b13bfd9c7

Francesco215 commented 10 months ago

Good job!