{"id":470369,"date":"2025-08-12T03:01:19","date_gmt":"2025-08-12T03:01:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=470369"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=470369","title":{"rendered":"<span>\u041e\u0442 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043a GUI: \u041a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0433\u0440\u0443 \u00ab\u0421\u0430\u043f\u0451\u0440\u00bb \u043d\u0430 Python \u0441 \u043d\u0443\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u0438 (\u0447\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f)<\/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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0438\u0433\u0440\u0443 &#171;\u0421\u0430\u043f\u0451\u0440&#187; \u0441 \u043d\u0443\u043b\u044f, \u0442\u043e \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f\u00a0\u0432\u0430\u0441. \u041c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0432\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u044d\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u0433\u0440\u044b \u043d\u0430\u00a0\u044f\u0437\u044b\u043a\u0435 Python. \u0417\u0434\u0435\u0441\u044c \u043d\u0435\u00a0\u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0441\u043e\u0431\u044b\u0445 \u0437\u043d\u0430\u043d\u0438\u0439\u00a0\u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c, \u0438 \u0432\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u0442\u0435 \u0441\u0432\u043e\u044e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u00ab\u0421\u0430\u043f\u0451\u0440\u0430\u00bb.<\/p>\n<h3>\u0427\u0442\u043e\u00a0\u0442\u0430\u043a\u043e\u0435 \u00ab\u0421\u0430\u043f\u0451\u0440\u00bb \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0430 \u0438\u0433\u0440\u0430?<\/h3>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/984\/40b\/d05\/98440bd05ed25eba1f1ea1c067fc7410.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0433\u0440\u044b &quot;\u0421\u0430\u043f\u0451\u0440&quot;\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0433\u0440\u044b &quot;\u0421\u0430\u043f\u0451\u0440&quot;\" width=\"251\" height=\"201\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/984\/40b\/d05\/98440bd05ed25eba1f1ea1c067fc7410.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/984\/40b\/d05\/98440bd05ed25eba1f1ea1c067fc7410.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0433\u0440\u044b &#171;\u0421\u0430\u043f\u0451\u0440&#187;<\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0433\u0440\u0430 &#171;\u0421\u0430\u043f\u0451\u0440&#187; \u2014 \u044d\u0442\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u0433\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0433\u0440\u043e\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043a\u043b\u0435\u0442\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u0435, \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043c\u0438\u043d \u0438 \u0443\u0433\u0430\u0434\u044b\u0432\u0430\u044f, \u0433\u0434\u0435 \u043e\u043d\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b.  \u0421\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f Python:  <\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044e \u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 GUI (<span class=\"habrahidden\">ps \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c<\/span>)<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Python (\u0432\u0435\u0440\u0441\u0438\u044f 3.6 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435). \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0435\u0451 \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 <a href=\"http:\/\/python.org\" rel=\"noopener noreferrer nofollow\">python.org<\/a>.  <\/p>\n<h3>\u0428\u0430\u0433 1: \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u0430\u0440\u0442\u044b<\/h3>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0443, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u043a\u043b\u0435\u0442\u043a\u0430\u043c\u0438 \u0438 \u043c\u0438\u043d\u0430\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>Generator_Map<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u043d\u0430 \u043d\u0451\u043c \u043c\u0438\u043d\u044b. (<span class=\"habrahidden\">\u0431\u0443\u0434\u0443 \u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438 \u0432 \u043a\u043e\u0434\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u0435\u0451 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439<\/span>)<\/p>\n<pre><code class=\"python\">import random # \u0418\u043c\u043f\u043e\u0440\u0442 \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438    def Generator_Map(mines):     \"\"\"\u041c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u044b\"\"\"     # \u0417\u0430\u0434\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f (\u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0430\u043f\u0451\u0440 - 9x9)     size = 9     # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438     # \u041f\u0440\u043e\u0431\u0435\u043b \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u0443\u0441\u0442\u0443\u044e \u043a\u043b\u0435\u0442\u043a\u0443 \u0431\u0435\u0437 \u043c\u0438\u043d \u0438 \u0447\u0438\u0441\u0435\u043b     map = [[' ' for _ in range(size)] for _ in range(size)]     mines_count = mines      mines = set()  # \u0443\u0431\u0440\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b     # \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043c\u0438\u043d     while len(mines) &lt; mines_count:         # \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043f\u043e\u043b\u044f         x, y = random.randint(0, size - 1), random.randint(0, size - 1)  # \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e N, \u0433\u0434\u0435 a \u2264 N \u2264 b         mines.add((x, y))         # \u041f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u043a\u043b\u0435\u0442\u043a\u0443 \u0441 \u043c\u0438\u043d\u043e\u0439         map[x][y] = 'M'      # \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0447\u0438\u0441\u043b\u0430\u043c\u0438 (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u043d \u0432\u043e\u043a\u0440\u0443\u0433) - \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 8 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u043a\u043b\u0435\u0442\u043e\u043a:     directions = [(-1, -1), (-1, 0), (-1, 1),# \u0412\u0435\u0440\u0445\u043d\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u0438                   (0, -1), (0, 1),           # \u0411\u043e\u043a\u043e\u0432\u044b\u0435 \u0441\u043e\u0441\u0435\u0434\u0438                   (1, -1), (1, 0), (1, 1)]   # \u041d\u0438\u0436\u043d\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u0438     # \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u043a\u043b\u0435\u0442\u043a\u0430\u043c \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b     for x in range(size):         for y in range(size):             if map[x][y] != 'M':                 count = 0 # \u0421\u0447\u0435\u0442\u0447\u0438\u043a \u043c\u0438\u043d \u0432\u043e\u043a\u0440\u0443\u0433                 for dx, dy in directions:                     nx, ny = x + dx, y + dy                     if 0 &lt;= nx &lt; size and 0 &lt;= ny &lt; size:                         if map[nx][ny] == 'M':                             count += 1                 if count &gt; 0:                     map[x][y] = str(count)      map_mines = [[' '] + list(range(1, size + 1))]     for i in range(size):         map_mines.append([i + 1] + map[i])     # \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435     return map_mines<\/code><\/pre>\n<h3>\u0428\u0430\u0433 2: \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u0440\u0442\u044b<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u0440\u0442\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0435\u0451 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>print_map<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b.<\/p>\n<pre><code class=\"python\">def print_map(map, flags=None):     \"\"\"\u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438\"\"\"     if flags is None:         flags = set()     # \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0441 \u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438     for i, row in enumerate(map):         printed_row = []         for j, cell in enumerate(row):            # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u0444\u043b\u0430\u0433 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 (\u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f)             if (i - 1, j - 1) in flags and cell == 'M':                 printed_row.append('F')                 # \u0415\u0441\u043b\u0438 \u0444\u043b\u0430\u0433 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0438\u043d\u0435 - \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c 'F' (\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u043c\u0435\u0442\u043a\u0430)             elif (i - 1, j - 1) in flags:                # \u0415\u0441\u043b\u0438 \u0444\u043b\u0430\u0433 \u0441\u0442\u043e\u0438\u0442 \u043d\u0435 \u043d\u0430 \u043c\u0438\u043d\u0435 - \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c '?' (\u043e\u0448\u0438\u0431\u043a\u0430 \u0438\u0433\u0440\u043e\u043a\u0430)                 printed_row.append('?')             else:               # \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 \u043a\u0430\u043a \u0435\u0441\u0442\u044c                 printed_row.append(str(cell))         # \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044f \u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c         print(' '.join(printed_row))<\/code><\/pre>\n<\/p>\n<h3>\u0428\u0430\u0433 3: \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430<\/h3>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u0433\u0440\u043e\u043a \u043c\u043e\u0433 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0438\u0433\u0440\u043e\u0439, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>get_bomb_count<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0443 \u043d\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u043d.<\/p>\n<pre><code class=\"python\">def get_bomb_count():     \"\"\"\u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u0438\u043d\"\"\"     while True:         count_of_bomb = int(input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e - \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u043d \u043e\u0442 1-80 \u0448\u0442.\\n\"))         if count_of_bomb &lt; 1 or count_of_bomb &gt; 80:             continue         return count_of_bomb         break<\/code><\/pre>\n<h4>\u0428\u0430\u0433 4: \u041b\u043e\u0433\u0438\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043b\u0435\u0442\u043e\u043a<\/h4>\n<p>\u0421\u0435\u0440\u0434\u0446\u0435 \u0438\u0433\u0440\u044b \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>reveal_cells()<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0443\u0441\u0442\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:  <\/p>\n<pre><code class=\"python\">def reveal_cells(map, player_map, display_map, x, y, size):     \"\"\"\u0420\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438\"\"\"     # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043f\u043e\u043b\u044f \u0438 \u043a\u043b\u0435\u0442\u043a\u0430 \u0435\u0449\u0435 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0430     if not (0 &lt;= x &lt; size and 0 &lt;= y &lt; size) or player_map[x][y] != '-':         return      # \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043a\u043b\u0435\u0442\u043a\u0443     player_map[x][y] = map[x + 1][y + 1]  # +1 \u0438\u0437-\u0437\u0430 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0432 map     display_map[x + 1][y + 1] = player_map[x][y]  # \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u0443\u044e \u043a\u0430\u0440\u0442\u0443      # \u0415\u0441\u043b\u0438 \u043a\u043b\u0435\u0442\u043a\u0430 \u043f\u0443\u0441\u0442\u0430\u044f (\u043d\u0435 \u0447\u0438\u0441\u043b\u043e \u0438 \u043d\u0435 \u043c\u0438\u043d\u0430), \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0441\u0435\u0434\u0435\u0439     if player_map[x][y] == ' ':         directions = [(-1, -1), (-1, 0), (-1, 1),                       (0, -1), (0, 1),                       (1, -1), (1, 0), (1, 1)]          for dx, dy in directions:             reveal_cells(map, player_map, display_map, x + dx, y + dy, size)<\/code><\/pre>\n<h4>\u0428\u0430\u0433 5: \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u043b\u0430\u0433\u043e\u0432<\/h4>\n<p>\u0418\u0433\u0440\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0435 \u043c\u0438\u043d\u044b \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0<code>get_action()<\/code>:  <\/p>\n<pre><code class=\"python\">def get_action():     \"\"\"\u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f: \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c\"\"\"     while True:         action = input(\"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (d - \u043e\u0442\u043a\u0440\u044b\u0442\u044c, f - \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0444\u043b\u0430\u0433\u043e\u043c): \").lower()         if action in ('d', 'f'):             return action         print(\"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 'd' \u0438\u043b\u0438 'f'!\")<\/code><\/pre>\n<h3>\u0428\u0430\u0433 6: \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0432\u043e\u0434\u0430<\/h3>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0447\u0438\u0441\u0435\u043b (1-9)<\/p>\n<pre><code class=\"python\">def get_coordinates():     \"\"\"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439\"\"\"     while True:         try:           # \u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0432\u0432\u043e\u0434 \u0438 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e '-'             coords = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (\u0444\u043e\u0440\u043c\u0430\u0442 Y-X): \").split('-')             if len(coords) != 2:                 raise ValueError             x, y = map(int, coords)# \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432 \u0447\u0438\u0441\u043b\u0430             # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 (1-9)             if abs(x - 5.5) &gt; 4.5 or abs(y - 5.5) &gt; 4.5:                 print(\"\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0442 1 \u0434\u043e 9!\")                 continue             return x - 1, y - 1  # \u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430         except ValueError:             print(\"\u041e\u0448\u0438\u0431\u043a\u0430! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0444\u043e\u0440\u043c\u0430\u0442 'Y-X' (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 3-5)\")<\/code><\/pre>\n<h4>\u0428\u0430\u0433 7: \u0417\u0430\u043f\u0443\u0441\u043a \u0438\u0433\u0440\u044b \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 <\/h4>\n<p>\u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 main() \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0433\u0440\u043e\u0432\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c: <\/p>\n<pre><code class=\"python\">def main():     # \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445     dictionary_for_x_y = {'y': [], 'x': []}  # \u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0445\u043e\u0434\u043e\u0432     bomb_count = get_bomb_count()             # \u0417\u0430\u043f\u0440\u043e\u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u0438\u043d     hidden_map = Generator_Map(bomb_count)    # \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u044f \u0441 \u043c\u0438\u043d\u0430\u043c\u0438     player_map = [['-' for _ in range(9)] for _ in range(9)]  # \u0412\u0438\u0434\u0438\u043c\u043e\u0435 \u043f\u043e\u043b\u0435     flags = set()               # \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u043b\u0430\u0433\u043e\u0432     correct_flags = set()       # \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438      # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0439 \u043a\u0430\u0440\u0442\u044b \u0441 \u043d\u043e\u043c\u0435\u0440\u0430\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\/\u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432     display_map = []     display_map.append([' '] + list(range(1, 10)))     for i in range(9):         display_map.append([i + 1] + player_map[i])      # \u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b     while True:         print(\"\\n\u0422\u0435\u043a\u0443\u0449\u0430\u044f \u043a\u0430\u0440\u0442\u0430:\")         print_map(display_map, flags)                  # \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442         action = get_action()         x, y = get_coordinates()          # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0443\u0436\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0443\u044e \u043a\u043b\u0435\u0442\u043a\u0443         if player_map[x][y] != '-':             print(\"\u042d\u0442\u0430 \u043a\u043b\u0435\u0442\u043a\u0430 \u0443\u0436\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0430!\")             continue          # \u041b\u043e\u0433\u0438\u043a\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\/\u0441\u043d\u044f\u0442\u0438\u044f \u0444\u043b\u0430\u0433\u0430         if action == 'f':             if (x, y) in flags:                 flags.remove((x, y))                 if hidden_map[x + 1][y + 1] == 'M':                     correct_flags.remove((x, y))             else:                 flags.add((x, y))                 if hidden_map[x + 1][y + 1] == 'M':                     correct_flags.add((x, y))              # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0431\u0435\u0434\u044b \u043f\u043e \u0444\u043b\u0430\u0433\u0430\u043c             if len(correct_flags) == bomb_count and len(flags) == bomb_count:                 print(\"\\n\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c! \u0412\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u043b\u0438 \u0432\u0441\u0435 \u043c\u0438\u043d\u044b!\")                 print(\"\u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435:\")                 print_map(hidden_map)                 break             continue          # \u041b\u043e\u0433\u0438\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043b\u0435\u0442\u043a\u0438         if (x, y) in flags:             print(\"\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u043b\u0430\u0433 \u0441 \u044d\u0442\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u0438!\")             continue          if hidden_map[x + 1][y + 1] == 'M':             print(\"\\nBOOM! \u0412\u044b \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u043d\u0430 \u043c\u0438\u043d\u0443!\")             print(\"\u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435:\")             print_map(hidden_map)             break          # \u0420\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u043b\u0435\u0442\u043e\u043a         reveal_cells(hidden_map, player_map, display_map, x, y, 9)          # \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0445\u043e\u0434\u043e\u0432         dictionary_for_x_y['y'].append(x + 1)         dictionary_for_x_y['x'].append(y + 1)         print(x + 1, y + 1, dictionary_for_x_y)          # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0431\u0435\u0434\u044b \u043f\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u0435\u0442\u043a\u0430\u043c         if all(player_map[i][j] != '-' or hidden_map[i + 1][j + 1] == 'M'                for i in range(9) for j in range(9)):             print(\"\\n\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c! \u0412\u044b \u043e\u0442\u043a\u0440\u044b\u043b\u0438 \u0432\u0441\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438!\")             print(\"\u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435:\")             print_map(hidden_map)             break  main() # \u0437\u0430\u043f\u0443\u0441\u043a \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438          <\/code><\/pre>\n<h4>\u0418\u0442\u043e\u0433: \u0427\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438?<\/h4>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/286\/4bf\/88f\/2864bf88f13a0878482962e498badd2f.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430  \" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430  \" width=\"758\" height=\"564\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/286\/4bf\/88f\/2864bf88f13a0878482962e498badd2f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/286\/4bf\/88f\/2864bf88f13a0878482962e498badd2f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430  <\/figcaption><\/div>\n<\/figure>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f &#171;\u0421\u0430\u043f\u0451\u0440\u0430&#187;<\/p>\n<\/li>\n<li>\n<p>\u0427\u0438\u0441\u0442\u044b\u0439 \u043a\u043e\u0434 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0438 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0413\u0438\u0431\u043a\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u0439\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0440\u043e\u0432\u043d\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043d\u0430 GUI (Tkinter\/PyQt)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/strong>\u00a0\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u00a0<a href=\"https:\/\/github.com\/Novelros\/Minesweeper_python_game\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitHub<\/a>.<\/p>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 \u0438\u0434\u0435\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438! \u0412\u0430\u0448 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p><em>P.S. \u0415\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0431\u0430\u0433\u0438 \u2014 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u0435, \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044e<\/em><\/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\/936038\/\"> https:\/\/habr.com\/ru\/articles\/936038\/<\/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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0438\u0441\u044c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0438\u0433\u0440\u0443 &#171;\u0421\u0430\u043f\u0451\u0440&#187; \u0441 \u043d\u0443\u043b\u044f, \u0442\u043e \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f\u00a0\u0432\u0430\u0441. \u041c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0432\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u00a0\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u044d\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u0433\u0440\u044b \u043d\u0430\u00a0\u044f\u0437\u044b\u043a\u0435 Python. \u0417\u0434\u0435\u0441\u044c \u043d\u0435\u00a0\u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0441\u043e\u0431\u044b\u0445 \u0437\u043d\u0430\u043d\u0438\u0439\u00a0\u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c, \u0438 \u0432\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u0442\u0435 \u0441\u0432\u043e\u044e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u00ab\u0421\u0430\u043f\u0451\u0440\u0430\u00bb.<\/p>\n<h3>\u0427\u0442\u043e\u00a0\u0442\u0430\u043a\u043e\u0435 \u00ab\u0421\u0430\u043f\u0451\u0440\u00bb \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0430 \u0438\u0433\u0440\u0430?<\/h3>\n<figure class=\"\">\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0433\u0440\u044b &#171;\u0421\u0430\u043f\u0451\u0440&#187;<\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0433\u0440\u0430 &#171;\u0421\u0430\u043f\u0451\u0440&#187; \u2014 \u044d\u0442\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u0433\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0433\u0440\u043e\u043a \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043a\u043b\u0435\u0442\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u0435, \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043c\u0438\u043d \u0438 \u0443\u0433\u0430\u0434\u044b\u0432\u0430\u044f, \u0433\u0434\u0435 \u043e\u043d\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b.  \u0421\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f Python:  <\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044e \u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 GUI (<span class=\"habrahidden\">ps \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c<\/span>)<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Python (\u0432\u0435\u0440\u0441\u0438\u044f 3.6 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435). \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0435\u0451 \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 <a href=\"http:\/\/python.org\" rel=\"noopener noreferrer nofollow\">python.org<\/a>.  <\/p>\n<h3>\u0428\u0430\u0433 1: \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u0430\u0440\u0442\u044b<\/h3>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0443, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u043a\u043b\u0435\u0442\u043a\u0430\u043c\u0438 \u0438 \u043c\u0438\u043d\u0430\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>Generator_Map<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u043d\u0430 \u043d\u0451\u043c \u043c\u0438\u043d\u044b. (<span class=\"habrahidden\">\u0431\u0443\u0434\u0443 \u0441\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438 \u0432 \u043a\u043e\u0434\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u0435\u0451 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439<\/span>)<\/p>\n<pre><code class=\"python\">import random # \u0418\u043c\u043f\u043e\u0440\u0442 \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438    def Generator_Map(mines):     \"\"\"\u041c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u0440\u0442\u044b\"\"\"     # \u0417\u0430\u0434\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f (\u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0430\u043f\u0451\u0440 - 9x9)     size = 9     # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438     # \u041f\u0440\u043e\u0431\u0435\u043b \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u0443\u0441\u0442\u0443\u044e \u043a\u043b\u0435\u0442\u043a\u0443 \u0431\u0435\u0437 \u043c\u0438\u043d \u0438 \u0447\u0438\u0441\u0435\u043b     map = [[' ' for _ in range(size)] for _ in range(size)]     mines_count = mines      mines = set()  # \u0443\u0431\u0440\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b     # \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043c\u0438\u043d     while len(mines) &lt; mines_count:         # \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043f\u043e\u043b\u044f         x, y = random.randint(0, size - 1), random.randint(0, size - 1)  # \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e N, \u0433\u0434\u0435 a \u2264 N \u2264 b         mines.add((x, y))         # \u041f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u043a\u043b\u0435\u0442\u043a\u0443 \u0441 \u043c\u0438\u043d\u043e\u0439         map[x][y] = 'M'      # \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0447\u0438\u0441\u043b\u0430\u043c\u0438 (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u043d \u0432\u043e\u043a\u0440\u0443\u0433) - \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 8 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u043a\u043b\u0435\u0442\u043e\u043a:     directions = [(-1, -1), (-1, 0), (-1, 1),# \u0412\u0435\u0440\u0445\u043d\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u0438                   (0, -1), (0, 1),           # \u0411\u043e\u043a\u043e\u0432\u044b\u0435 \u0441\u043e\u0441\u0435\u0434\u0438                   (1, -1), (1, 0), (1, 1)]   # \u041d\u0438\u0436\u043d\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u0438     # \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u043a\u043b\u0435\u0442\u043a\u0430\u043c \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b     for x in range(size):         for y in range(size):             if map[x][y] != 'M':                 count = 0 # \u0421\u0447\u0435\u0442\u0447\u0438\u043a \u043c\u0438\u043d \u0432\u043e\u043a\u0440\u0443\u0433                 for dx, dy in directions:                     nx, ny = x + dx, y + dy                     if 0 &lt;= nx &lt; size and 0 &lt;= ny &lt; size:                         if map[nx][ny] == 'M':                             count += 1                 if count &gt; 0:                     map[x][y] = str(count)      map_mines = [[' '] + list(range(1, size + 1))]     for i in range(size):         map_mines.append([i + 1] + map[i])     # \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435     return map_mines<\/code><\/pre>\n<h3>\u0428\u0430\u0433 2: \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u0430\u0440\u0442\u044b<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u0440\u0442\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0435\u0451 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>print_map<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u0433\u0440\u044b.<\/p>\n<pre><code class=\"python\">def print_map(map, flags=None):     \"\"\"\u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438\"\"\"     if flags is None:         flags = set()     # \u041f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0441 \u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438     for i, row in enumerate(map):         printed_row = []         for j, cell in enumerate(row):            # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u0444\u043b\u0430\u0433 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 (\u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f)             if (i - 1, j - 1) in flags and cell == 'M':                 printed_row.append('F')                 # \u0415\u0441\u043b\u0438 \u0444\u043b\u0430\u0433 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0438\u043d\u0435 - \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c 'F' (\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u043c\u0435\u0442\u043a\u0430)             elif (i - 1, j - 1) in flags:                # \u0415\u0441\u043b\u0438 \u0444\u043b\u0430\u0433 \u0441\u0442\u043e\u0438\u0442 \u043d\u0435 \u043d\u0430 \u043c\u0438\u043d\u0435 - \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c '?' (\u043e\u0448\u0438\u0431\u043a\u0430 \u0438\u0433\u0440\u043e\u043a\u0430)                 printed_row.append('?')             else:               # \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 \u043a\u0430\u043a \u0435\u0441\u0442\u044c                 printed_row.append(str(cell))         # \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044f \u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c         print(' '.join(printed_row))<\/code><\/pre>\n<\/p>\n<h3>\u0428\u0430\u0433 3: \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430<\/h3>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u0433\u0440\u043e\u043a \u043c\u043e\u0433 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0438\u0433\u0440\u043e\u0439, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>get_bomb_count<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0443 \u043d\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u043d.<\/p>\n<pre><code class=\"python\">def get_bomb_count():     \"\"\"\u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u0438\u043d\"\"\"     while True:         count_of_bomb = int(input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e - \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u043d \u043e\u0442 1-80 \u0448\u0442.\\n\"))         if count_of_bomb &lt; 1 or count_of_bomb &gt; 80:             continue         return count_of_bomb         break<\/code><\/pre>\n<h4>\u0428\u0430\u0433 4: \u041b\u043e\u0433\u0438\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043b\u0435\u0442\u043e\u043a<\/h4>\n<p>\u0421\u0435\u0440\u0434\u0446\u0435 \u0438\u0433\u0440\u044b \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>reveal_cells()<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0443\u0441\u0442\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:  <\/p>\n<pre><code class=\"python\">def reveal_cells(map, player_map, display_map, x, y, size):     \"\"\"\u0420\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438\"\"\"     # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043f\u043e\u043b\u044f \u0438 \u043a\u043b\u0435\u0442\u043a\u0430 \u0435\u0449\u0435 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0430     if not (0 &lt;= x &lt; size and 0 &lt;= y &lt; size) or player_map[x][y] != '-':         return      # \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043a\u043b\u0435\u0442\u043a\u0443     player_map[x][y] = map[x + 1][y + 1]  # +1 \u0438\u0437-\u0437\u0430 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0432 map     display_map[x + 1][y + 1] = player_map[x][y]  # \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u0443\u044e \u043a\u0430\u0440\u0442\u0443      # \u0415\u0441\u043b\u0438 \u043a\u043b\u0435\u0442\u043a\u0430 \u043f\u0443\u0441\u0442\u0430\u044f (\u043d\u0435 \u0447\u0438\u0441\u043b\u043e \u0438 \u043d\u0435 \u043c\u0438\u043d\u0430), \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0441\u0435\u0434\u0435\u0439     if player_map[x][y] == ' ':         directions = [(-1, -1), (-1, 0), (-1, 1),                       (0, -1), (0, 1),                       (1, -1), (1, 0), (1, 1)]          for dx, dy in directions:             reveal_cells(map, player_map, display_map, x + dx, y + dy, size)<\/code><\/pre>\n<h4>\u0428\u0430\u0433 5: \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u043b\u0430\u0433\u043e\u0432<\/h4>\n<p>\u0418\u0433\u0440\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0435 \u043c\u0438\u043d\u044b \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0<code>get_action()<\/code>:  <\/p>\n<pre><code class=\"python\">def get_action():     \"\"\"\u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f: \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c\"\"\"     while True:         action = input(\"\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (d - \u043e\u0442\u043a\u0440\u044b\u0442\u044c, f - \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0444\u043b\u0430\u0433\u043e\u043c): \").lower()         if action in ('d', 'f'):             return action         print(\"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 'd' \u0438\u043b\u0438 'f'!\")<\/code><\/pre>\n<h3>\u0428\u0430\u0433 6: \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0432\u043e\u0434\u0430<\/h3>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0447\u0438\u0441\u0435\u043b (1-9)<\/p>\n<pre><code class=\"python\">def get_coordinates():     \"\"\"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439\"\"\"     while True:         try:           # \u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0432\u0432\u043e\u0434 \u0438 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e '-'             coords = input(\"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (\u0444\u043e\u0440\u043c\u0430\u0442 Y-X): \").split('-')             if len(coords) != 2:                 raise ValueError             x, y = map(int, coords)# \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432 \u0447\u0438\u0441\u043b\u0430             # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 (1-9)             if abs(x - 5.5) &gt; 4.5 or abs(y - 5.5) &gt; 4.5:                 print(\"\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0442 1 \u0434\u043e 9!\")                 continue             return x - 1, y - 1  # \u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430         except ValueError:             print(\"\u041e\u0448\u0438\u0431\u043a\u0430! \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0444\u043e\u0440\u043c\u0430\u0442 'Y-X' (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 3-5)\")<\/code><\/pre>\n<h4>\u0428\u0430\u0433 7: \u0417\u0430\u043f\u0443\u0441\u043a \u0438\u0433\u0440\u044b \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 <\/h4>\n<p>\u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 main() \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0433\u0440\u043e\u0432\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c: <\/p>\n<pre><code class=\"python\">def main():     # \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445     dictionary_for_x_y = {'y': [], 'x': []}  # \u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0445\u043e\u0434\u043e\u0432     bomb_count = get_bomb_count()             # \u0417\u0430\u043f\u0440\u043e\u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u0438\u043d     hidden_map = Generator_Map(bomb_count)    # \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u044f \u0441 \u043c\u0438\u043d\u0430\u043c\u0438     player_map = [['-' for _ in range(9)] for _ in range(9)]  # \u0412\u0438\u0434\u0438\u043c\u043e\u0435 \u043f\u043e\u043b\u0435     flags = set()               # \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u043b\u0430\u0433\u043e\u0432     correct_flags = set()       # \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438      # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0439 \u043a\u0430\u0440\u0442\u044b \u0441 \u043d\u043e\u043c\u0435\u0440\u0430\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\/\u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432     display_map = []     display_map.append([' '] + list(range(1, 10)))     for i in range(9):         display_map.append([i + 1] + player_map[i])      # \u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0446\u0438\u043a\u043b     while True:         print(\"\\n\u0422\u0435\u043a\u0443\u0449\u0430\u044f \u043a\u0430\u0440\u0442\u0430:\")         print_map(display_map, flags)                  # \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442         action = get_action()         x, y = get_coordinates()          # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0443\u0436\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0443\u044e \u043a\u043b\u0435\u0442\u043a\u0443         if player_map[x][y] != '-':             print(\"\u042d\u0442\u0430 \u043a\u043b\u0435\u0442\u043a\u0430 \u0443\u0436\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0430!\")             continue          # \u041b\u043e\u0433\u0438\u043a\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\/\u0441\u043d\u044f\u0442\u0438\u044f \u0444\u043b\u0430\u0433\u0430         if action == 'f':             if (x, y) in flags:                 flags.remove((x, y))                 if hidden_map[x + 1][y + 1] == 'M':                     correct_flags.remove((x, y))             else:                 flags.add((x, y))                 if hidden_map[x + 1][y + 1] == 'M':                     correct_flags.add((x, y))              # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0431\u0435\u0434\u044b \u043f\u043e \u0444\u043b\u0430\u0433\u0430\u043c             if len(correct_flags) == bomb_count and len(flags) == bomb_count:                 print(\"\\n\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c! \u0412\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u043b\u0438 \u0432\u0441\u0435 \u043c\u0438\u043d\u044b!\")                 print(\"\u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435:\")                 print_map(hidden_map)                 break             continue          # \u041b\u043e\u0433\u0438\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u043a\u043b\u0435\u0442\u043a\u0438         if (x, y) in flags:             print(\"\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u043b\u0430\u0433 \u0441 \u044d\u0442\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u0438!\")             continue          if hidden_map[x + 1][y + 1] == 'M':             print(\"\\nBOOM! \u0412\u044b \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u043d\u0430 \u043c\u0438\u043d\u0443!\")             print(\"\u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435:\")             print_map(hidden_map)             break          # \u0420\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u043b\u0435\u0442\u043e\u043a         reveal_cells(hidden_map, player_map, display_map, x, y, 9)          # \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0445\u043e\u0434\u043e\u0432         dictionary_for_x_y['y'].append(x + 1)         dictionary_for_x_y['x'].append(y + 1)         print(x + 1, y + 1, dictionary_for_x_y)          # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0431\u0435\u0434\u044b \u043f\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u0435\u0442\u043a\u0430\u043c         if all(player_map[i][j] != '-' or hidden_map[i + 1][j + 1] == 'M'                for i in range(9) for j in range(9)):             print(\"\\n\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c! \u0412\u044b \u043e\u0442\u043a\u0440\u044b\u043b\u0438 \u0432\u0441\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438!\")             print(\"\u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435:\")             print_map(hidden_map)             break  main() # \u0437\u0430\u043f\u0443\u0441\u043a \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438          <\/code><\/pre>\n<h4>\u0418\u0442\u043e\u0433: \u0427\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438?<\/h4>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430  <\/figcaption><\/div>\n<\/figure>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f &#171;\u0421\u0430\u043f\u0451\u0440\u0430&#187;<\/p>\n<\/li>\n<li>\n<p>\u0427\u0438\u0441\u0442\u044b\u0439 \u043a\u043e\u0434 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0438 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0413\u0438\u0431\u043a\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u0439\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0440\u043e\u0432\u043d\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043d\u0430 GUI (Tkinter\/PyQt)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/strong>\u00a0\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u00a0<a href=\"https:\/\/github.com\/Novelros\/Minesweeper_python_game\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitHub<\/a>.<\/p>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 \u0438\u0434\u0435\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438! \u0412\u0430\u0448 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p><em>P.S. \u0415\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0431\u0430\u0433\u0438 \u2014 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u0435, \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044e<\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!-\n<\/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-470369","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/470369","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=470369"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/470369\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=470369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=470369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=470369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}