{"id":457517,"date":"2025-04-26T15:00:48","date_gmt":"2025-04-26T15:00:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=457517"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2025-04-26T15:00:48","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=457517","title":{"rendered":"<span>\u041a\u043e\u0434 \u043a\u0430\u043a \u043a\u0438\u0441\u0442\u044c: \u043a\u0430\u043a Python \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c Python \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c? \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043d\u0435 \u0441\u0443\u0445\u043e\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b, \u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e\u043c. \u0412 \u043d\u0435\u0439 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0445 \u043a\u0430\u0440\u0442\u0438\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u0435\u0439, \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438, \u0448\u0443\u043c\u0430 \u041f\u0435\u0440\u043b\u0438\u043d\u0430 \u0438 \u043b\u044e\u0431\u0432\u0438 \u043a \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0430\u0431\u0441\u0443\u0440\u0434\u0443. \u041c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438 \u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u0442\u044b\u0439 Python \u0438 \u0436\u0430\u0436\u0434\u0430 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/342\/b51\/502\/342b515025aa49204a6568fc380e086d.png\" width=\"1024\" height=\"1536\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/342\/b51\/502\/342b515025aa49204a6568fc380e086d.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/342\/b51\/502\/342b515025aa49204a6568fc380e086d.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u043e\u0445\u043d\u0443\u0442\u044c \u043e\u0442 API, CRUD \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432, \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0435, \u043d\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435. \u0412\u043e\u0442 \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0430\u043c\u0438. \u041a\u0442\u043e-\u0442\u043e \u0431\u0435\u0440\u0435\u0442 Blender, \u043a\u0442\u043e-\u0442\u043e \u2014 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. \u0410 \u043a\u0442\u043e-\u0442\u043e \u2014 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 <code>matplotlib<\/code> \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u0451 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0447\u0451\u0440\u0442\u043e\u0432 \u0431\u0430\u0440\u0434\u0430\u043a. \u0410 \u043f\u043e\u0442\u043e\u043c \u0432\u0434\u0440\u0443\u0433 \u2014 \u0431\u0430\u0445! \u2014 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435 \u043e\u0442\u0432\u0435\u0441\u0442\u0438 \u0433\u043b\u0430\u0437. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u043d\u0430\u0447\u0430\u043b\u0441\u044f \u044d\u0442\u043e\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442. \u041d\u0438 \u043f\u043b\u0430\u043d\u0430, \u043d\u0438 \u0446\u0435\u043b\u0438. \u0422\u043e\u043b\u044c\u043a\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0434\u0430.<\/p>\n<p>\u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430: \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u043d\u0443\u043b\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e\u043b\u044c\u043a\u043e Python \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0445\u0430\u043e\u0441\u0430. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 pre-trained \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e ML. \u0422\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0432\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u2014 \u043a\u043e\u0434 \u043a\u0430\u043a \u043a\u0438\u0441\u0442\u044c.<\/p>\n<hr\/>\n<h4>\u0427\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f<\/h4>\n<ul>\n<li>\n<p>Python 3.10+<\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438: <code>numpy<\/code>, <code>matplotlib<\/code>, <code>Pillow<\/code>, <code>noise<\/code><\/p>\n<\/li>\n<\/ul>\n<pre><code>pip install numpy matplotlib Pillow noise<\/code><\/pre>\n<h4>\u041f\u0435\u0440\u0432\u044b\u0439 \u043c\u0430\u0437\u043e\u043a: \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0438 \u0448\u0443\u043c<\/h4>\n<p>\u0426\u0438\u0444\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u043e\u0442\u043d\u043e \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u2014 \u044d\u0442\u043e \u0442\u043e\u0447\u043a\u0430 \u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 \u0438 \u0446\u0432\u0435\u0442\u043e\u043c. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0448\u0443\u043c\u0430 \u041f\u0435\u0440\u043b\u0438\u043d\u0430.<\/p>\n<pre><code class=\"python\">import numpy as np from PIL import Image from noise import pnoise2  width, height = 800, 800 scale = 100.0 image = Image.new(\"RGB\", (width, height)) pixels = image.load()  for x in range(width):     for y in range(height):         nx = x \/ scale         ny = y \/ scale         value = pnoise2(nx, ny, octaves=6)         r = int((value + 0.5) * 255) % 256         g = int((0.5 - value) * 255) % 256         b = (x * y) % 256         pixels[x, y] = (r, g, b)  image.save(\"perlin_art.png\")<\/code><\/pre>\n<p>\u0428\u0443\u043c \u041f\u0435\u0440\u043b\u0438\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0435\u0440\u043d\u0438\u0441\u0442\u043e\u0441\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u00ab\u043e\u0440\u0433\u0430\u043d\u0438\u0447\u043d\u0443\u044e\u00bb \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443.<\/p>\n<hr\/>\n<h4>\u0423\u0433\u043b\u0443\u0431\u043b\u044f\u0435\u043c\u0441\u044f: \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0445\u0430\u043e\u0441\u0430<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u043e \u0444\u043e\u0440\u043c\u0435, \u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0448\u0443\u043c\u043e\u043c. \u042d\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0432 \u0441\u0442\u0438\u043b\u0435 \u041c\u0430\u0440\u043a\u0430 \u0420\u043e\u0442\u043a\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0438\u043d\u0442\u0440\u043e\u0432\u0435\u0440\u0442\u043e\u0432 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u043e\u0439.<\/p>\n<pre><code class=\"python\">def draw_colored_field(image, center, radius, base_color, scale=30.0):     pixels = image.load()     cx, cy = center     for x in range(image.width):         for y in range(image.height):             dx, dy = x - cx, y - cy             if dx * dx + dy * dy &lt;= radius * radius:                 nx, ny = x \/ scale, y \/ scale                 noise_val = pnoise2(nx, ny, octaves=4)                 r = int((base_color[0] + noise_val * 50) % 256)                 g = int((base_color[1] + noise_val * 50) % 256)                 b = int((base_color[2] + noise_val * 50) % 256)                 pixels[x, y] = (r, g, b)  image = Image.new(\"RGB\", (800, 800), color=\"white\") draw_colored_field(image, (400, 400), 250, (100, 50, 200)) image.save(\"field_art.png\")<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0439 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u2014 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u044e\u0440\u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u0435\u0439\u0437\u0430\u0436.<\/p>\n<hr\/>\n<h4>\u0428\u0442\u0440\u0438\u0445\u0438 \u2014 \u043b\u0438\u043d\u0438\u0438 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a \u0437\u043d\u0430\u0435\u0442 \u0446\u0435\u043d\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u0443. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0442\u044c \u0435\u0433\u043e. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0435 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435 \u0440\u0438\u0442\u043c\u0430.<\/p>\n<pre><code class=\"python\">import matplotlib.pyplot as plt  fig, ax = plt.subplots(figsize=(8, 8)) ax.set_xlim(0, 100) ax.set_ylim(0, 100)  for i in range(50):     x = np.linspace(0, 100, 1000)     y = 50 + 20 * np.sin(x * 0.1 + i)     ax.plot(x, y, alpha=0.1, color='black')  ax.axis('off') plt.savefig(\"lines_art.png\", bbox_inches='tight', pad_inches=0)<\/code><\/pre>\n<h4>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u0444\u0440\u0430\u043a\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435. \u041f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0434\u0435\u0440\u0435\u0432\u043e, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0432\u0435\u0442\u043a\u0430 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0432\u0435\u0442\u043a\u0438:<\/p>\n<pre><code class=\"python\">from PIL import Image, ImageDraw import math  def draw_branch(draw, x, y, angle, depth):     if depth == 0:         return     x2 = x + int(math.cos(angle) * depth * 10.0)     y2 = y + int(math.sin(angle) * depth * 10.0)     draw.line((x, y, x2, y2), fill=(0, 100 + depth * 15, 0), width=depth)     draw_branch(draw, x2, y2, angle - 0.3, depth - 1)     draw_branch(draw, x2, y2, angle + 0.3, depth - 1)  img = Image.new(\"RGB\", (800, 600), (255, 255, 255)) draw = ImageDraw.Draw(img) draw_branch(draw, 400, 500, -math.pi \/ 2, 10) img.save(\"tree_fractal.png\")<\/code><\/pre>\n<h4>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043b\u0430\u0431\u0438\u0440\u0438\u043d\u0442\u0430<\/h4>\n<p>\u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u0441\u0442\u0440\u043e\u0433\u043e\u0435, \u043d\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u0430\u0431\u0438\u0440\u0438\u043d\u0442 \u043f\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 depth-first search.<\/p>\n<pre><code class=\"python\">import random from PIL import Image, ImageDraw  width, height = 40, 40 cell_size = 20 maze = [[0] * width for _ in range(height)]  stack = [(0, 0)] visited = set(stack)  def neighbors(x, y):     for dx, dy in [(0, -1), (1, 0), (0, 1), (-1, 0)]:         nx, ny = x + dx, y + dy         if 0 &lt;= nx &lt; width and 0 &lt;= ny &lt; height and (nx, ny) not in visited:             yield nx, ny  while stack:     x, y = stack[-1]     next_cells = list(neighbors(x, y))     if next_cells:         nx, ny = random.choice(next_cells)         visited.add((nx, ny))         stack.append((nx, ny))         maze[ny][nx] = 1     else:         stack.pop()  img = Image.new(\"RGB\", (width * cell_size, height * cell_size), \"white\") draw = ImageDraw.Draw(img) for y in range(height):     for x in range(width):         if maze[y][x] == 0:             draw.rectangle(                 [x * cell_size, y * cell_size, (x+1) * cell_size, (y+1) * cell_size], fill=\"black\")  img.save(\"maze.png\")<\/code><\/pre>\n<h4>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0437\u043e\u0440\u044b \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u043c<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u0443 \u0438\u0437 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"python\">from PIL import Image import math  w, h = 600, 600 img = Image.new(\"RGB\", (w, h)) pixels = img.load()  for x in range(w):     for y in range(h):         r = int((math.sin(x * 0.01) + 1) * 127)         g = int((math.cos(y * 0.01) + 1) * 127)         b = int((math.sin((x + y) * 0.01) + 1) * 127)         pixels[x, y] = (r, g, b)  img.save(\"formula_art.png\")<\/code><\/pre>\n<h4>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043a\u043a\u043e\u0440\u0434: \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0430 \u2014 \u044d\u0442\u043e \u043a\u0430\u043a \u0432\u0430\u0440\u043a\u0430 \u0431\u043e\u0440\u0449\u0430: \u0432\u0430\u0436\u043d\u043e \u043d\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0446\u0435\u043f\u0442\u0443, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u043a\u0443\u0441. \u0425\u043e\u0447\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e? \u0423\u0431\u0430\u0432\u044c \u0448\u0443\u043c. \u041d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442\u0430? \u041f\u0440\u043e\u0433\u043e\u043d\u0438 \u0447\u0435\u0440\u0435\u0437 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430:<\/p>\n<ol>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 \u0448\u0443\u043c\u0430 \u2014 \u0444\u043e\u043d<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0445 \u043f\u044f\u0442\u0435\u043d<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0435\u0440\u0445 \u2014 \u043b\u0438\u043d\u0438\u0438 \u0438\u043b\u0438 \u0444\u0438\u0433\u0443\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0451 \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438 \u0440\u0430\u0434\u0443\u0435\u043c\u0441\u044f<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u041b\u0438\u0447\u043d\u043e\u0435: \u0430 \u0437\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0451 \u044d\u0442\u043e?<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043e\u0442\u0432\u043b\u0435\u0447\u044c\u0441\u044f \u043e\u0442 \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u00ab\u0438\u043c\u0435\u044e\u0442 \u0441\u043c\u044b\u0441\u043b\u00bb. \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e \u2014 \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0431\u044b\u0442\u044c \u0432 \u043f\u043e\u0442\u043e\u043a\u0435, \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u0445\u0430\u043e\u0441\u043e\u043c \u0438 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u042d\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0451\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u0443\u0447\u043d\u043e\u0439, \u0430 \u043a\u043e\u0434 \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c.<\/p>\n<p>\u041a\u0442\u043e-\u0442\u043e \u0441\u043a\u0430\u0436\u0435\u0442: \u00ab\u0410 \u0437\u0430\u0447\u0435\u043c? \u042d\u0442\u043e \u0436\u0435 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u00bb. \u041d\u043e \u0432 \u0442\u043e\u043c-\u0442\u043e \u0438 \u0434\u0435\u043b\u043e. \u042d\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u2014 \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<hr\/>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438. \u041e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e \u0447\u0443\u0432\u0441\u0442\u0432\u043e. \u041f\u0440\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u0439\u0444. \u041f\u0440\u043e \u0431\u0430\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043b \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u0439.<\/p>\n<p>Python \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u044f\u0437\u044b\u043a, \u044d\u0442\u043e \u043a\u0438\u0441\u0442\u044c. \u0418 \u043a\u0430\u043a \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0442\u044b \u043e\u0442\u043a\u0440\u044b\u043b <code>PIL<\/code>, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e, \u0438 \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043f\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0441\u0435\u0431\u044f \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u043e\u043c \u2014 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432\u0441\u0451 \u043d\u0435 \u0437\u0440\u044f.<\/p>\n<hr\/>\n<p><strong>P.S.<\/strong> \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e GIF, \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e, \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>tkinter<\/code> \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u0430. \u041d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/904672\/\"> https:\/\/habr.com\/ru\/articles\/904672\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c Python \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c? \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043d\u0435 \u0441\u0443\u0445\u043e\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b, \u0430 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e\u043c. \u0412 \u043d\u0435\u0439 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0445 \u043a\u0430\u0440\u0442\u0438\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u0435\u0439, \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438, \u0448\u0443\u043c\u0430 \u041f\u0435\u0440\u043b\u0438\u043d\u0430 \u0438 \u043b\u044e\u0431\u0432\u0438 \u043a \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0430\u0431\u0441\u0443\u0440\u0434\u0443. \u041c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438 \u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u0442\u044b\u0439 Python \u0438 \u0436\u0430\u0436\u0434\u0430 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u043e\u0445\u043d\u0443\u0442\u044c \u043e\u0442 API, CRUD \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432, \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0435, \u043d\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435. \u0412\u043e\u0442 \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0430\u043c\u0438. \u041a\u0442\u043e-\u0442\u043e \u0431\u0435\u0440\u0435\u0442 Blender, \u043a\u0442\u043e-\u0442\u043e \u2014 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. \u0410 \u043a\u0442\u043e-\u0442\u043e \u2014 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 <code>matplotlib<\/code> \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u0451 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0447\u0451\u0440\u0442\u043e\u0432 \u0431\u0430\u0440\u0434\u0430\u043a. \u0410 \u043f\u043e\u0442\u043e\u043c \u0432\u0434\u0440\u0443\u0433 \u2014 \u0431\u0430\u0445! \u2014 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435 \u043e\u0442\u0432\u0435\u0441\u0442\u0438 \u0433\u043b\u0430\u0437. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u043d\u0430\u0447\u0430\u043b\u0441\u044f \u044d\u0442\u043e\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442. \u041d\u0438 \u043f\u043b\u0430\u043d\u0430, \u043d\u0438 \u0446\u0435\u043b\u0438. \u0422\u043e\u043b\u044c\u043a\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0434\u0430.<\/p>\n<p>\u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430: \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u043d\u0443\u043b\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e\u043b\u044c\u043a\u043e Python \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0445\u0430\u043e\u0441\u0430. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 pre-trained \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e ML. \u0422\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0432\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u2014 \u043a\u043e\u0434 \u043a\u0430\u043a \u043a\u0438\u0441\u0442\u044c.<\/p>\n<hr\/>\n<h4>\u0427\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f<\/h4>\n<ul>\n<li>\n<p>Python 3.10+<\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438: <code>numpy<\/code>, <code>matplotlib<\/code>, <code>Pillow<\/code>, <code>noise<\/code><\/p>\n<\/li>\n<\/ul>\n<pre><code>pip install numpy matplotlib Pillow noise<\/code><\/pre>\n<h4>\u041f\u0435\u0440\u0432\u044b\u0439 \u043c\u0430\u0437\u043e\u043a: \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0438 \u0448\u0443\u043c<\/h4>\n<p>\u0426\u0438\u0444\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u043e\u0442\u043d\u043e \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u2014 \u044d\u0442\u043e \u0442\u043e\u0447\u043a\u0430 \u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 \u0438 \u0446\u0432\u0435\u0442\u043e\u043c. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0448\u0443\u043c\u0430 \u041f\u0435\u0440\u043b\u0438\u043d\u0430.<\/p>\n<pre><code class=\"python\">import numpy as np from PIL import Image from noise import pnoise2  width, height = 800, 800 scale = 100.0 image = Image.new(\"RGB\", (width, height)) pixels = image.load()  for x in range(width):     for y in range(height):         nx = x \/ scale         ny = y \/ scale         value = pnoise2(nx, ny, octaves=6)         r = int((value + 0.5) * 255) % 256         g = int((0.5 - value) * 255) % 256         b = (x * y) % 256         pixels[x, y] = (r, g, b)  image.save(\"perlin_art.png\")<\/code><\/pre>\n<p>\u0428\u0443\u043c \u041f\u0435\u0440\u043b\u0438\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0435\u0440\u043d\u0438\u0441\u0442\u043e\u0441\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u00ab\u043e\u0440\u0433\u0430\u043d\u0438\u0447\u043d\u0443\u044e\u00bb \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443.<\/p>\n<hr\/>\n<h4>\u0423\u0433\u043b\u0443\u0431\u043b\u044f\u0435\u043c\u0441\u044f: \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0445\u0430\u043e\u0441\u0430<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u043e \u0444\u043e\u0440\u043c\u0435, \u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0448\u0443\u043c\u043e\u043c. \u042d\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u0432 \u0441\u0442\u0438\u043b\u0435 \u041c\u0430\u0440\u043a\u0430 \u0420\u043e\u0442\u043a\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0438\u043d\u0442\u0440\u043e\u0432\u0435\u0440\u0442\u043e\u0432 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u043e\u0439.<\/p>\n<pre><code class=\"python\">def draw_colored_field(image, center, radius, base_color, scale=30.0):     pixels = image.load()     cx, cy = center     for x in range(image.width):         for y in range(image.height):             dx, dy = x - cx, y - cy             if dx * dx + dy * dy &lt;= radius * radius:                 nx, ny = x \/ scale, y \/ scale                 noise_val = pnoise2(nx, ny, octaves=4)                 r = int((base_color[0] + noise_val * 50) % 256)                 g = int((base_color[1] + noise_val * 50) % 256)                 b = int((base_color[2] + noise_val * 50) % 256)                 pixels[x, y] = (r, g, b)  image = Image.new(\"RGB\", (800, 800), color=\"white\") draw_colored_field(image, (400, 400), 250, (100, 50, 200)) image.save(\"field_art.png\")<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0439 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u2014 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u044e\u0440\u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u0435\u0439\u0437\u0430\u0436.<\/p>\n<hr\/>\n<h4>\u0428\u0442\u0440\u0438\u0445\u0438 \u2014 \u043b\u0438\u043d\u0438\u0438 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a \u0437\u043d\u0430\u0435\u0442 \u0446\u0435\u043d\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u0443. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0442\u044c \u0435\u0433\u043e. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0435 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435 \u0440\u0438\u0442\u043c\u0430.<\/p>\n<pre><code class=\"python\">import matplotlib.pyplot as plt  fig, ax = plt.subplots(figsize=(8, 8)) ax.set_xlim(0, 100) ax.set_ylim(0, 100)  for i in range(50):     x = np.linspace(0, 100, 1000)     y = 50 + 20 * np.sin(x * 0.1 + i)     ax.plot(x, y, alpha=0.1, color='black')  ax.axis('off') plt.savefig(\"lines_art.png\", bbox_inches='tight', pad_inches=0)<\/code><\/pre>\n<h4>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u0444\u0440\u0430\u043a\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435. \u041f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0434\u0435\u0440\u0435\u0432\u043e, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0432\u0435\u0442\u043a\u0430 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0432\u0435\u0442\u043a\u0438:<\/p>\n<pre><code class=\"python\">from PIL import Image, ImageDraw import math  def draw_branch(draw, x, y, angle, depth):     if depth == 0:         return     x2 = x + int(math.cos(angle) * depth * 10.0)     y2 = y + int(math.sin(angle) * depth * 10.0)     draw.line((x, y, x2, y2), fill=(0, 100 + depth * 15, 0), width=depth)     draw_branch(draw, x2, y2, angle - 0.3, depth - 1)     draw_branch(draw, x2, y2, angle + 0.3, depth - 1)  img = Image.new(\"RGB\", (800, 600), (255, 255, 255)) draw = ImageDraw.Draw(img) draw_branch(draw, 400, 500, -math.pi \/ 2, 10) img.save(\"tree_fractal.png\")<\/code><\/pre>\n<h4>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043b\u0430\u0431\u0438\u0440\u0438\u043d\u0442\u0430<\/h4>\n<p>\u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u0441\u0442\u0440\u043e\u0433\u043e\u0435, \u043d\u043e \u0432\u0441\u0451 \u0435\u0449\u0451 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u0430\u0431\u0438\u0440\u0438\u043d\u0442 \u043f\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 depth-first search.<\/p>\n<pre><code class=\"python\">import random from PIL import Image, ImageDraw  width, height = 40, 40 cell_size = 20 maze = [[0] * width for _ in range(height)]  stack = [(0, 0)] visited = set(stack)  def neighbors(x, y):     for dx, dy in [(0, -1), (1, 0), (0, 1), (-1, 0)]:         nx, ny = x + dx, y + dy         if 0 &lt;= nx &lt; width and 0 &lt;= ny &lt; height and (nx, ny) not in visited:             yield nx, ny  while stack:     x, y = stack[-1]     next_cells = list(neighbors(x, y))     if next_cells:         nx, ny = random.choice(next_cells)         visited.add((nx, ny))         stack.append((nx, ny))         maze[ny][nx] = 1     else:         stack.pop()  img = Image.new(\"RGB\", (width * cell_size, height * cell_size), \"white\") draw = ImageDraw.Draw(img) for y in range(height):     for x in range(width):         if maze[y][x] == 0:             draw.rectangle(                 [x * cell_size, y * cell_size, (x+1) * cell_size, (y+1) * cell_size], fill=\"black\")  img.save(\"maze.png\")<\/code><\/pre>\n<h4>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0437\u043e\u0440\u044b \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u043c<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u0443 \u0438\u0437 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"python\">from PIL import Image import math  w, h = 600, 600 img = Image.new(\"RGB\", (w, h)) pixels = img.load()  for x in range(w):     for y in range(h):         r = int((math.sin(x * 0.01) + 1) * 127)         g = int((math.cos(y * 0.01) + 1) * 127)         b = int((math.sin((x + y) * 0.01) + 1) * 127)         pixels[x, y] = (r, g, b)  img.save(\"formula_art.png\")<\/code><\/pre>\n<h4>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043a\u043a\u043e\u0440\u0434: \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0430 \u2014 \u044d\u0442\u043e \u043a\u0430\u043a \u0432\u0430\u0440\u043a\u0430 \u0431\u043e\u0440\u0449\u0430: \u0432\u0430\u0436\u043d\u043e \u043d\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0446\u0435\u043f\u0442\u0443, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u043a\u0443\u0441. \u0425\u043e\u0447\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e? \u0423\u0431\u0430\u0432\u044c \u0448\u0443\u043c. \u041d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442\u0430? \u041f\u0440\u043e\u0433\u043e\u043d\u0438 \u0447\u0435\u0440\u0435\u0437 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430:<\/p>\n<ol>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 \u0448\u0443\u043c\u0430 \u2014 \u0444\u043e\u043d<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0445 \u043f\u044f\u0442\u0435\u043d<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0435\u0440\u0445 \u2014 \u043b\u0438\u043d\u0438\u0438 \u0438\u043b\u0438 \u0444\u0438\u0433\u0443\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0451 \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438 \u0440\u0430\u0434\u0443\u0435\u043c\u0441\u044f<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h4>\u041b\u0438\u0447\u043d\u043e\u0435: \u0430 \u0437\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0451 \u044d\u0442\u043e?<\/h4>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043e\u0442\u0432\u043b\u0435\u0447\u044c\u0441\u044f \u043e\u0442 \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u00ab\u0438\u043c\u0435\u044e\u0442 \u0441\u043c\u044b\u0441\u043b\u00bb. \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u043e \u2014 \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0431\u044b\u0442\u044c \u0432 \u043f\u043e\u0442\u043e\u043a\u0435, \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0441 \u0445\u0430\u043e\u0441\u043e\u043c \u0438 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u042d\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0451\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u0443\u0447\u043d\u043e\u0439, \u0430 \u043a\u043e\u0434 \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c.<\/p>\n<p>\u041a\u0442\u043e-\u0442\u043e \u0441\u043a\u0430\u0436\u0435\u0442: \u00ab\u0410 \u0437\u0430\u0447\u0435\u043c? \u042d\u0442\u043e \u0436\u0435 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u00bb. \u041d\u043e \u0432 \u0442\u043e\u043c-\u0442\u043e \u0438 \u0434\u0435\u043b\u043e. \u042d\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u2014 \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<hr\/>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438. \u041e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e \u0447\u0443\u0432\u0441\u0442\u0432\u043e. \u041f\u0440\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u0439\u0444. \u041f\u0440\u043e \u0431\u0430\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043b \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u0439.<\/p>\n<p>Python \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u044f\u0437\u044b\u043a, \u044d\u0442\u043e \u043a\u0438\u0441\u0442\u044c. \u0418 \u043a\u0430\u043a \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0442\u044b \u043e\u0442\u043a\u0440\u044b\u043b <code>PIL<\/code>, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e, \u0438 \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043f\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0441\u0435\u0431\u044f \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u043e\u043c \u2014 \u0437\u043d\u0430\u0447\u0438\u0442, \u0432\u0441\u0451 \u043d\u0435 \u0437\u0440\u044f.<\/p>\n<hr\/>\n<p><strong>P.S.<\/strong> \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e GIF, \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e, \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>tkinter<\/code> \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u0430. \u041d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/904672\/\"> https:\/\/habr.com\/ru\/articles\/904672\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-457517","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/457517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=457517"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/457517\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=457517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=457517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=457517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}