>>102109370
I tried it with Meta's 405b instruct Q6_K, the prompt was based on the description in your URL:
>I need a pygame implementation of a 3D surface plot of the function z = sin(sqrt(x2+y2)) where the height of the surface is determined from the sine of the distance from the z axis.
and it spat out this:
import pygame
import numpy as np
# Define the function
def func(x, y):
return np.sin(np.sqrt(x**2 + y**2))
# Create a 3D grid of points
x = np.linspace(-10, 10, 100)
y = np.linspace(-10, 10, 100)
X, Y = np.meshgrid(x, y)
Z = func(X, Y)
# Initialize Pygame
pygame.init()
screen = pygame.display.set_mode((800, 600))
# Define some colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
# Function to rotate a point around the x-axis
def rotate_x(point, angle):
return [point[0], point[1]*np.cos(angle) - point[2]*np.sin(angle), point[1]*np.sin(angle) + point[2]*np.cos(angle)]
# Function to rotate a point around the y-axis
def rotate_y(point, angle):
return [point[0]*np.cos(angle) + point[2]*np.sin(angle), point[1], -point[0]*np.sin(angle) + point[2]*np.cos(angle)]
# Main loop
angle = 0
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
screen.fill(WHITE)
# Draw the 3D surface plot
for i in range(len(X)):
for j in range(len(Y)):
point = [X[i, j], Y[i, j], Z[i, j]]
point = rotate_x(point, angle)
point = rotate_y(point, angle)
x = int(point[0]*20 + 400)
y = int(-point[1]*20 + 300)
pygame.draw.circle(screen, BLACK, (x, y), 2)
pygame.display.flip()
angle += 0.01
pygame.quit()
It kinda looks right at a glance but I'm a retard so idk.