I'm working on a project where there are four turtles in the middle of a circle, and they each follow a random path until one of them gets out. The last part is that if two or more turtles bump into each other, they go two steps back towards the center. I have everything except that, and I'm not sure how to proceed. Below is the code I have so far. Can anyone help? Thanks!

```
from random import randrange
import matplotlib.pyplot as plt
import numpy as np

def turtle1234():
    x_points = []
    y_points = []
    x2_points = []
    y2_points = []
    x3_points = []
    y3_points = []
    x4_points = []
    y4_points = []
    x = 0
    y = 0
    x2 = 0
    y2 = 0
    x3 = 0
    y3 = 0
    x4 = 0
    y4 = 0
    while True:
        x = x + randrange(-1,2)
        y = y + randrange(-1,2) 
        x2 = x2 + randrange(-1,2)
        y2 = y2 + randrange(-1,2) 
        x3 = x3 + randrange(-1,2)
        y3 = y3 + randrange(-1,2) 
        x4 = x4 + randrange(-1,2)
        y4 = y4 + randrange(-1,2) 
        x_points.append(x)
        y_points.append(y)
        x2_points.append(x2)
        y2_points.append(y2)
        x3_points.append(x3)
        y3_points.append(y3)
        x4_points.append(x4)
        y4_points.append(y4)
        if x**2+y**2 > 100**2:
            print(x,y)
            print('Turtle 1 is outside the circle first')
            break
        if x2**2+y2**2 > 100**2:
            print(x2,y2)
            print('Turtle 2 is outside the circle first')
            break
        if x3**2+y3**2 > 100**2:
            print(x3,y3)
            print('Turtle 3 is outside the circle first')
            break
        if x4**2+y4**2 > 100**2:
            print(x4,y4)
            print('Turtle 4 is outside the circle first')
            break
    plt.plot(x_points,y_points)
    plt.plot(x2_points,y2_points)
    plt.plot(x3_points,y3_points) 
    plt.plot(x4_points,y4_points) 
x = np.linspace(-100,100,1000)
turtle1234()

plt.plot(x,-np.sqrt(100**2-x**2), color = 'b')
plt.plot(x, np.sqrt(100**2-x**2), color = 'b')

```
['https://Stackoverflow.com/questions/68651869', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16440183/']
You can't run background jobs on Cloud Run. Wrap it in a webserver as proposed by MBHA if the process take less than 1h.

Else you can you GKE Autopilot to run your container for a while. you pay only when your container run. And the first cluster is free. You can have a try on it!

As hack you can run your container in Cloud Build also, or in Vertex AI custom container training.
I've run in to a similar issue with building custom image on MAC + deploying in to Cloud Run. In my case, it turned out to be the docker platform causing the problem. The way I isolated this was by building the same image in Cloud Shell and that would work perfectly fine in Cloud Run.

Now, if you need to build it locally on MAC go ahead and test it by changing the Docker platform:

```
export DOCKER_DEFAULT_PLATFORM=linux/amd64
docker build -t mytag:myver .

```

Once the image has been built, you can inspect the architecture:

```
docker image inspect mytag:myver | grep -i Architecture

```

Then deploy it to Cloud Run.