public void Update()
    {
        for (int i = 0; i < tail.Count - 1; i++)
        {
            tail[i] = tail[i + 1];
        }
        if (tail.Count < total)
        {
            tail.Add(new Vector2(x, y));
        }
        else if (tail.Count >= 1)
        {
            tail[tail.Count - 1] = new Vector2(x, y);
        }
        Debug.Log(tail.Count);

        x = x + xspeed * TheSnakeGame.scl;
        y = y + yspeed * TheSnakeGame.scl;

        x = P5JSExtension.constrain(x, 0, P5JSExtension.width - TheSnakeGame.scl);
        y = P5JSExtension.constrain(y, 0, P5JSExtension.height - TheSnakeGame.scl);
    }
    void Update()
    {
        for (int x = 1; x < P5JSExtension.width - 1; x++)
        {
            for (var y = 1; y < P5JSExtension.height - 1; y++)
            {
                var a = grid[x][y].a;
                var b = grid[x][y].b;
                next[x][y].a = a +
                               (dA * laplaceA(x, y)) -
                               (a * b * b) +
                               (feed * (1 - a));
                next[x][y].b = b +
                               (dB * laplaceB(x, y)) +
                               (a * b * b) -
                               ((k + feed) * b);

                next[x][y].a = P5JSExtension.constrain(next[x][y].a, 0, 1);
                next[x][y].b = P5JSExtension.constrain(next[x][y].b, 0, 1);
            }
        }

        for (int x = 0; x < P5JSExtension.width; x++)
        {
            for (var y = 0; y < P5JSExtension.height; y++)
            {
                var a = next[x][y].a;
                var b = next[x][y].b;
                var c = Mathf.Floor((a - b) * 255);
                c = P5JSExtension.constrain(c, 0, 255);
                texture.SetPixel(x, y, new Color32((byte)c, (byte)c, (byte)c, 255));
            }
        }
        texture.Apply();
        swap();
    }