├── README.md ├── o1 test1.html ├── o1 test2.py ├── o1 test3.py ├── r1 test1.html ├── r1 test2.py └── r1 test3.py /README.md: -------------------------------------------------------------------------------- 1 | # مستودع اختبارات نماذج الذكاء الاصطناعي بالعربية وأكوادها 2 | 3 | **وصف:** هذا المستودع مخصص لتجميع **تلقينات** (prompts) لاختبار نماذج الذكاء الاصطناعي المتقدمة، مع التركيز على التلقينات **باللغة العربية**. يهدف المستودع إلى توفير مجموعة متنوعة من الاختبارات التي يمكن استخدامها لتقييم أداء النماذج المختلفة، بالإضافة إلى عرض الأكواد الناتجة عن هذه التلقينات. ندعو الجميع للمساهمة بإضافة المزيد من التلقينات والأكواد لإثراء هذا المورد. 4 | 5 | ## مقدمة 6 | 7 | تهدف هذه المبادرة إلى إنشاء مورد مفتوح المصدر يضم مجموعة من التلقينات (prompts) المصممة خصيصًا لاختبار قدرات نماذج الذكاء الاصطناعي المتطورة مثل Deepseek R1 و OpenAI O1 وغيرها. نركز بشكل خاص على التلقينات التي تتحدى النماذج في فهم اللغة العربية وإنتاج أكواد برمجية متنوعة. 8 | 9 | ## التلقينات (Prompts) 10 | 11 | ### الاختبار الأول: الحركة والارتداد داخل مربع 12 | 13 | > " write a python script for a bouncing yellow ball within a square, make sure to handle collision detection properly. make the square slowly rotate. implement it in python. make sure ball stays within the square" 14 | 15 | ### الاختبار الثاني: الحركة والارتداد داخل شكل معقد 16 | 17 | > "write a script for a bouncing yellow ball within a Rhombicosidodecahedron, make sure to handle collision detection properly. make the Rhombicosidodecahedron slowly rotate. make sure ball stays within the Rhombicosidodecahedron. implement it in p5.js" 18 | 19 | ### الاختبار الثالث: الإبداع في الرسوم الكسرية 20 | 21 | > "be creative and write python code to generate moving fractals" 22 | 23 | ### الاختبار الرابع: قصة عربية حول مفهوم ضمني 24 | 25 | > ``` 26 | > """ 27 | > أنشئ قصة بالعربي الفصيح حيث يجب أن تكون كل جملة مكونة من عشر كلمات بالضبط، ويجب أن توصل القصة مفهوم 'السفر عبر الزمن' دون ذكره مباشرة. قم بتضمين تعليقات تشرح كيف ضمنت عدد الكلمات وأوصلت المفهوم. 28 | > """ 29 | > ``` 30 | 31 | ## المساهمة 32 | 33 | نحن نرحب بمساهماتكم لإثراء هذا المستودع! يمكنكم المساهمة عن طريق: 34 | 35 | * **إضافة تلقينات جديدة:** اقترحوا تلقينات مبتكرة لاختبار نماذج الذكاء الاصطناعي، سواء كانت باللغة العربية أو الإنجليزية أو لغات أخرى. نرحب بشكل خاص بالتلقينات التي تستهدف اللغة العربية وقدرات النماذج على فهمها وإنتاج محتوى إبداعي بها. 36 | * **مشاركة الأكواد الناتجة:** إذا قمتم بتجربة أي من التلقينات الموجودة أو تلقينات جديدة، شاركونا بالأكواد التي تم إنتاجها بواسطة نماذج الذكاء الاصطناعي المختلفة. يمكنكم إضافة الأكواد في مجلدات منفصلة لكل اختبار. 37 | * **تحسين المستودع:** إذا كان لديكم أفكار لتحسين تنظيم المستودع أو إضافة أقسام جديدة أو تحسين طريقة عرض التلقينات والأكواد، فنحن نرحب بمقترحاتكم. 38 | 39 | **كيفية المساهمة:** 40 | 41 | 1. قم بإنشاء تفرع (Fork) من المستودع. 42 | 2. قم بإجراء التغييرات التي ترغب بها. 43 | 3. أرسل طلب سحب (Pull Request) لدمج تغييراتك في المستودع الرئيسي. 44 | 45 | نأمل أن يكون هذا المستودع مصدرًا قيمًا للمهتمين باختبار نماذج الذكاء الاصطناعي وتطويرها! 46 | -------------------------------------------------------------------------------- /o1 test1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Rhombicosidodecahedron with Bouncing Ball (p5.js) 6 | 7 | 8 | 9 | 10 | 182 | 183 | -------------------------------------------------------------------------------- /o1 test2.py: -------------------------------------------------------------------------------- 1 | import pygame 2 | import math 3 | import sys 4 | 5 | # ------------------------------------------------------------------------------ 6 | # Utility functions 7 | # ------------------------------------------------------------------------------ 8 | 9 | def rotate_points(points, angle_degrees, center): 10 | """ 11 | Rotate a list of (x, y) points by the specified angle_degrees around 'center'. 12 | Returns a new list of rotated points. 13 | """ 14 | angle = math.radians(angle_degrees) 15 | cos_a = math.cos(angle) 16 | sin_a = math.sin(angle) 17 | cx, cy = center 18 | 19 | rotated = [] 20 | for x, y in points: 21 | # Translate point so center is (0, 0) 22 | tx, ty = x - cx, y - cy 23 | # Rotate 24 | rx = tx * cos_a - ty * sin_a 25 | ry = tx * sin_a + ty * cos_a 26 | # Translate back 27 | rx += cx 28 | ry += cy 29 | rotated.append((rx, ry)) 30 | 31 | return rotated 32 | 33 | def reflect_velocity(vel, p1, p2): 34 | """ 35 | Reflect velocity vector 'vel' across the line defined by 'p1' -> 'p2'. 36 | Returns the new velocity vector after reflection. 37 | """ 38 | # Line vector 39 | line_dx = p2[0] - p1[0] 40 | line_dy = p2[1] - p1[1] 41 | 42 | # Normalize line direction 43 | line_len_sq = line_dx * line_dx + line_dy * line_dy 44 | if abs(line_len_sq) < 1e-12: 45 | return vel # Avoid division by zero, no reflection 46 | 47 | line_len = math.sqrt(line_len_sq) 48 | nx = line_dx / line_len 49 | ny = line_dy / line_len 50 | 51 | # We need normal to the line. For a line (nx, ny), 52 | # a normal can be (ny, -nx) or (-ny, nx). 53 | # Check which normal we should use by projecting velocity. 54 | # We'll take one normal, measure dot product, see if we need to flip sign. 55 | # Let's choose normal = (ny, -nx). 56 | # Dot product: 57 | dot = vel[0] * ny + vel[1] * (-nx) 58 | # If dot < 0, flip normal 59 | if dot < 0: 60 | ny = -ny 61 | nx = nx 62 | 63 | # Actually, let's define normal = (ny, -nx) or (-ny, nx) consistently: 64 | norm_x, norm_y = ny, -nx 65 | # Now reflect v = v - 2(v·n)n 66 | # Must normalize n 67 | n_len_sq = norm_x * norm_x + norm_y * norm_y 68 | if abs(n_len_sq) < 1e-12: 69 | return vel 70 | 71 | # Make n unit length 72 | n_len = math.sqrt(n_len_sq) 73 | ux = norm_x / n_len 74 | uy = norm_y / n_len 75 | 76 | # Dot product of vel with the normal 77 | vdotn = vel[0]*ux + vel[1]*uy 78 | 79 | # Reflection 80 | rx = vel[0] - 2.0 * vdotn * ux 81 | ry = vel[1] - 2.0 * vdotn * uy 82 | 83 | return (rx, ry) 84 | 85 | def point_line_dist_sq(px, py, x1, y1, x2, y2): 86 | """ 87 | Returns the squared distance from the point (px, py) 88 | to the line segment (x1, y1)-(x2, y2). 89 | """ 90 | # Adapted from typical "closest point on line segment" algorithms 91 | vx = x2 - x1 92 | vy = y2 - y1 93 | wx = px - x1 94 | wy = py - y1 95 | 96 | c1 = wx * vx + wy * vy 97 | c2 = vx * vx + vy * vy 98 | if c2 < 1e-10: 99 | # Line segment is effectively a point 100 | return (px - x1)**2 + (py - y1)**2 101 | 102 | b = c1 / c2 103 | if b < 0: 104 | # Closest to (x1, y1) 105 | return (px - x1)**2 + (py - y1)**2 106 | elif b > 1: 107 | # Closest to (x2, y2) 108 | return (px - x2)**2 + (py - y2)**2 109 | 110 | # Closest to a point between (x1, y1) and (x2, y2) 111 | cx = x1 + b * vx 112 | cy = y1 + b * vy 113 | 114 | dx = px - cx 115 | dy = py - cy 116 | return dx*dx + dy*dy 117 | 118 | # ------------------------------------------------------------------------------ 119 | # Main script (pygame) 120 | # ------------------------------------------------------------------------------ 121 | 122 | def main(): 123 | pygame.init() 124 | screen_width, screen_height = 800, 600 125 | screen = pygame.display.set_mode((screen_width, screen_height)) 126 | pygame.display.set_caption("Bouncing Ball within a Rotating Square") 127 | 128 | clock = pygame.time.Clock() 129 | 130 | # Ball properties 131 | ball_radius = 10 132 | ball_pos = [400, 300] # center of screen 133 | ball_vel = [5, 3] # initial velocity 134 | 135 | # Square properties 136 | square_center = (screen_width//2, screen_height//2) 137 | square_size = 200 138 | half = square_size / 2 139 | # base square corners (unrotated) 140 | # Note that these are corners around the center 141 | square_corners = [ 142 | (square_center[0] - half, square_center[1] - half), 143 | (square_center[0] + half, square_center[1] - half), 144 | (square_center[0] + half, square_center[1] + half), 145 | (square_center[0] - half, square_center[1] + half) 146 | ] 147 | 148 | rotation_angle = 0 149 | rotation_speed = 1 # degrees per frame 150 | 151 | running = True 152 | while running: 153 | dt = clock.tick(60) / 1000.0 # delta time in seconds (not used heavily here) 154 | 155 | for event in pygame.event.get(): 156 | if event.type == pygame.QUIT: 157 | running = False 158 | 159 | # Update rotation 160 | rotation_angle = (rotation_angle + rotation_speed) % 360 161 | 162 | # Move the ball 163 | ball_pos[0] += ball_vel[0] 164 | ball_pos[1] += ball_vel[1] 165 | 166 | # Rotate square corners 167 | rot_corners = rotate_points(square_corners, rotation_angle, square_center) 168 | 169 | # Build edges of the square from the rotated corners 170 | edges = [] 171 | for i in range(len(rot_corners)): 172 | p1 = rot_corners[i] 173 | p2 = rot_corners[(i + 1) % len(rot_corners)] 174 | edges.append((p1, p2)) 175 | 176 | # Check collision with edges 177 | # If the center of the ball is within ball_radius of an edge, reflect 178 | # velocity. To avoid "sticking" in the wall, we can do a simple approach: 179 | # After reflection, move the ball slightly away along the new velocity. 180 | # This prevents repeated collisions in the same frame. 181 | px, py = ball_pos 182 | for p1, p2 in edges: 183 | dist_sq = point_line_dist_sq(px, py, p1[0], p1[1], p2[0], p2[1]) 184 | if dist_sq <= (ball_radius**2 + 1e-6): 185 | # We have a collision 186 | ball_vel = reflect_velocity(ball_vel, p1, p2) 187 | # Move the ball a bit along the new velocity to avoid re-collision 188 | length_v = math.hypot(ball_vel[0], ball_vel[1]) 189 | if length_v > 1e-6: 190 | # Move a fraction of the radius away from the wall 191 | # to minimize repeated collision detection in same frame 192 | ball_pos[0] += (ball_vel[0] / length_v) * 2 193 | ball_pos[1] += (ball_vel[1] / length_v) * 2 194 | 195 | # Draw everything 196 | screen.fill((0, 0, 0)) # black background 197 | 198 | # Draw the rotating square 199 | pygame.draw.polygon(screen, (255, 255, 255), rot_corners, width=2) 200 | 201 | # Draw the ball 202 | pygame.draw.circle(screen, (255, 255, 0), (int(ball_pos[0]), int(ball_pos[1])), ball_radius) 203 | 204 | pygame.display.flip() 205 | 206 | pygame.quit() 207 | sys.exit() 208 | 209 | if __name__ == "__main__": 210 | main() 211 | 212 | # No external files are being created or modified in this script. -------------------------------------------------------------------------------- /o1 test3.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | import matplotlib.animation as animation 4 | 5 | def julia_set(xmin, xmax, ymin, ymax, width, height, c, max_iter=200): 6 | """ 7 | Generate a 2D array of a Julia set fractal for a specific complex parameter c. 8 | 9 | :param xmin: Minimum x-value in the complex plane 10 | :param xmax: Maximum x-value in the complex plane 11 | :param ymin: Minimum y-value in the complex plane 12 | :param ymax: Maximum y-value in the complex plane 13 | :param width: Number of points along the x-axis for computing 14 | :param height: Number of points along the y-axis for computing 15 | :param c: Complex parameter for the Julia set 16 | :param max_iter: Maximum number of iterations 17 | :return: 2D NumPy array representing the fractal 18 | """ 19 | x = np.linspace(xmin, xmax, width) 20 | y = np.linspace(ymin, ymax, height) 21 | Zx, Zy = np.meshgrid(x, y) 22 | Z = Zx + 1j * Zy 23 | 24 | output = np.zeros(Z.shape, dtype=int) 25 | 26 | # For each point, iterate and see how quickly it diverges 27 | for i in range(max_iter): 28 | mask = np.abs(Z) <= 4 29 | Z[mask] = Z[mask] * Z[mask] + c 30 | output[mask] = i 31 | 32 | return output 33 | 34 | # Animation setup 35 | fig, ax = plt.subplots(figsize=(6, 6)) 36 | plt.axis('off') 37 | 38 | # These define the region of the complex plane we visualize 39 | xmin, xmax = -1.5, 1.5 40 | ymin, ymax = -1.5, 1.5 41 | 42 | width, height = 800, 800 43 | max_iter = 200 44 | 45 | # Initial complex parameter c 46 | c_start = complex(-0.8, 0.156) 47 | # Final complex parameter c 48 | c_end = complex(0.4, -0.3) 49 | 50 | # Generate an initial frame 51 | fractal_data = julia_set(xmin, xmax, ymin, ymax, width, height, c_start, max_iter) 52 | im = ax.imshow(fractal_data, extent=[xmin, xmax, ymin, ymax], origin='lower', cmap='hot') 53 | 54 | def update(frame): 55 | """ 56 | Update function for the animation. We gradually move from c_start to c_end 57 | using linear interpolation over frames to create the “moving” effect. 58 | """ 59 | t = frame / 100 # choose how quickly c changes over frames 60 | c_current = (1 - t) * c_start + t * c_end 61 | 62 | data = julia_set(xmin, xmax, ymin, ymax, width, height, c_current, max_iter) 63 | im.set_data(data) 64 | return [im] 65 | 66 | # Create the animation 67 | ani = animation.FuncAnimation(fig, update, frames=101, interval=50, blit=True) 68 | 69 | # If you want to save the animation (GIF), uncomment the next two lines: 70 | # ani.save("fractal_animation.gif", writer="pillow") 71 | # print("Created/Modified files during execution:\nfractal_animation.gif") 72 | 73 | plt.show() -------------------------------------------------------------------------------- /r1 test1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 78 | 79 | -------------------------------------------------------------------------------- /r1 test2.py: -------------------------------------------------------------------------------- 1 | import pygame 2 | import math 3 | import sys 4 | 5 | # Initialize Pygame 6 | pygame.init() 7 | screen_size = 600 8 | screen = pygame.display.set_mode((screen_size, screen_size)) 9 | clock = pygame.time.Clock() 10 | 11 | # Square parameters 12 | square_center = (screen_size//2, screen_size//2) 13 | square_size = 500 14 | half_square = square_size // 2 15 | square_angle = 0 16 | rotation_speed = 0.5 # Degrees per frame 17 | 18 | # Ball parameters 19 | ball_radius = 20 20 | ball_pos = [screen_size//2, screen_size//2] 21 | ball_vel = [3, 3.5] 22 | ball_color = (255, 255, 0) # Yellow 23 | 24 | def rotate_point(point, angle, center=(0, 0)): 25 | """Rotate a point around a center point by given angle in degrees""" 26 | angle_rad = math.radians(angle) 27 | x, y = point[0] - center[0], point[1] - center[1] 28 | new_x = x * math.cos(angle_rad) - y * math.sin(angle_rad) 29 | new_y = x * math.sin(angle_rad) + y * math.cos(angle_rad) 30 | return (new_x + center[0], new_y + center[1]) 31 | 32 | def check_collision(ball_pos, square_center, square_angle, half_size, radius): 33 | # Convert ball position to square's local coordinate system 34 | dx = ball_pos[0] - square_center[0] 35 | dy = ball_pos[1] - square_center[1] 36 | local_pos = rotate_point((ball_pos[0], ball_pos[1]), -square_angle, square_center) 37 | 38 | # Get local coordinates relative to square center 39 | local_x = local_pos[0] - square_center[0] 40 | local_y = local_pos[1] - square_center[1] 41 | 42 | collisions = [] 43 | 44 | # Check collisions with all walls 45 | if local_x > half_size - radius: 46 | collisions.append(('right', local_x - (half_size - radius))) 47 | elif local_x < -half_size + radius: 48 | collisions.append(('left', local_x - (-half_size + radius))) 49 | 50 | if local_y > half_size - radius: 51 | collisions.append(('bottom', local_y - (half_size - radius))) 52 | elif local_y < -half_size + radius: 53 | collisions.append(('top', local_y - (-half_size + radius))) 54 | 55 | return collisions 56 | 57 | running = True 58 | while running: 59 | for event in pygame.event.get(): 60 | if event.type == pygame.QUIT: 61 | running = False 62 | 63 | # Update square rotation 64 | square_angle += rotation_speed 65 | if square_angle >= 360: 66 | square_angle -= 360 67 | 68 | # Update ball position 69 | ball_pos[0] += ball_vel[0] 70 | ball_pos[1] += ball_vel[1] 71 | 72 | # Check collisions 73 | collisions = check_collision(ball_pos, square_center, square_angle, half_square, ball_radius) 74 | 75 | for collision in collisions: 76 | wall, overlap = collision 77 | 78 | # Calculate collision normal in world coordinates 79 | if wall in ('left', 'right'): 80 | angle = square_angle if wall == 'right' else square_angle + 180 81 | normal = pygame.math.Vector2(1, 0).rotate(angle) 82 | else: 83 | angle = square_angle + 90 if wall == 'bottom' else square_angle - 90 84 | normal = pygame.math.Vector2(1, 0).rotate(angle) 85 | 86 | normal = normal.normalize() 87 | 88 | # Reflect velocity 89 | ball_vel = pygame.math.Vector2(ball_vel) 90 | ball_vel = ball_vel.reflect(normal) 91 | ball_vel = list(ball_vel) 92 | 93 | # Position correction 94 | correction_vec = pygame.math.Vector2(normal) * overlap 95 | ball_pos[0] -= correction_vec.x 96 | ball_pos[1] -= correction_vec.y 97 | 98 | # Draw everything 99 | screen.fill((0, 0, 0)) 100 | 101 | # Draw rotating square 102 | square_surface = pygame.Surface((square_size, square_size), pygame.SRCALPHA) 103 | pygame.draw.rect(square_surface, (255, 255, 255), (0, 0, square_size, square_size), 2) 104 | rotated_square = pygame.transform.rotate(square_surface, square_angle) 105 | rect = rotated_square.get_rect(center=square_center) 106 | screen.blit(rotated_square, rect.topleft) 107 | 108 | # Draw ball 109 | pygame.draw.circle(screen, ball_color, (int(ball_pos[0]), int(ball_pos[1])), ball_radius) 110 | 111 | pygame.display.flip() 112 | clock.tick(60) 113 | 114 | pygame.quit() 115 | sys.exit() 116 | 117 | # Created/Modified files during execution: 118 | # No files are created or modified on disk; all rendering is done in memory and displayed on screen. -------------------------------------------------------------------------------- /r1 test3.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | import matplotlib.animation as animation 4 | 5 | def julia_set(width, height, c, x_range=(-2, 2), y_range=(-2, 2), max_iter=100): 6 | """Generate Julia set fractal array""" 7 | x = np.linspace(x_range[0], x_range[1], width) 8 | y = np.linspace(y_range[0], y_range[1], height) 9 | X, Y = np.meshgrid(x, y) 10 | Z = X + 1j * Y 11 | fractal = np.zeros(Z.shape, dtype=np.float32) 12 | 13 | for i in range(max_iter): 14 | mask = np.abs(Z) < 10 # Escape radius 15 | Z[mask] = Z[mask]**2 + c 16 | fractal += mask.astype(np.float32) 17 | 18 | return np.log(fractal + 1) 19 | 20 | # Figure setup 21 | fig, ax = plt.subplots(figsize=(8, 8)) 22 | ax.axis('off') 23 | img = ax.imshow(np.random.rand(400, 400), cmap='twilight_shifted', 24 | interpolation='bicubic', vmin=0, vmax=5) 25 | 26 | # Animation parameters 27 | params = { 28 | 'width': 400, 29 | 'height': 400, 30 | 'max_iter': 70, 31 | 'x_range': (-1.5, 1.5), 32 | 'y_range': (-1.5, 1.5) 33 | } 34 | 35 | def init(): 36 | """Initialize animation frame""" 37 | theta = 0 38 | c = 0.7885 * np.exp(1j * theta) 39 | img.set_data(julia_set(c=c, **params)) 40 | return [img] 41 | 42 | def animate(frame): 43 | """Update frame with new Julia set parameters""" 44 | theta = 2 * np.pi * frame / 100 45 | c = 0.7885 * np.exp(1j * theta) 46 | img.set_data(julia_set(c=c, **params)) 47 | return [img] 48 | 49 | # Create animation 50 | anim = animation.FuncAnimation(fig, animate, init_func=init, 51 | frames=100, interval=50, blit=True) 52 | 53 | # Save animation 54 | anim.save('julia_fractal_animation.mp4', writer='ffmpeg', 55 | fps=20, dpi=100, bitrate=2000) 56 | 57 | plt.show() 58 | 59 | # Created/Modified files during execution: 60 | print("julia_fractal_animation.mp4") --------------------------------------------------------------------------------