{"id":348736,"date":"2023-06-14T03:00:41","date_gmt":"2023-06-14T03:00:41","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=348736"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=348736","title":{"rendered":"<span>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u041f\u0435\u0449\u0435\u0440<\/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<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0435\u0449\u0435\u0440 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043b\u0435\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430<\/h2>\n<blockquote>\n<p><strong>\u041a\u043b\u0435\u0442\u043e\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442<\/strong>\u00a0\u2014 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c, \u0438\u0437\u0443\u0447\u0430\u0435\u043c\u0430\u044f \u0432\u00a0\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435, \u0442\u0435\u043e\u0440\u0438\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c\u043e\u0441\u0442\u0438, \u0444\u0438\u0437\u0438\u043a\u0435, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0438\u00a0\u0438 \u043c\u0438\u043a\u0440\u043e\u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0435. \u041e\u0441\u043d\u043e\u0432\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043f\u0440\u0438\u043b\u0435\u0433\u0430\u044e\u0449\u0438\u0445 \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 \u043a\u043b\u0435\u0442\u043e\u043a (\u044f\u0447\u0435\u0435\u043a), \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 \u0440\u0435\u0448\u0451\u0442\u043a\u0443. \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u00a0<em>\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439<\/em>\u00a0(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 1 \u0438 0). <\/p>\n<\/blockquote>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/570\/ccd\/602\/570ccd60268a71f9a301d099e800cea4.png\" width=\"672\" height=\"826\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/570\/ccd\/602\/570ccd60268a71f9a301d099e800cea4.png\"\/><\/figure>\n<blockquote>\n<p><strong>\u0418\u0433\u0440\u0430 \u00ab\u0416\u0438\u0437\u043d\u044c\u00bb<\/strong>\u00a0(<em>Game of Life<\/em>)\u00a0\u2014\u00a0\u043a\u043b\u0435\u0442\u043e\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442, \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0439 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u043c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u043e\u043c\u00a0\u0414\u0436\u043e\u043d\u043e\u043c \u041a\u043e\u043d\u0432\u0435\u0435\u043c \u0432 1970 \u0433\u043e\u0434\u0443. \u042d\u0442\u043e \u0438\u0433\u0440\u0430 \u0431\u0435\u0437 \u0438\u0433\u0440\u043e\u043a\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u043b\u0438\u0448\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442 \u0437\u0430 \u0435\u0451 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435\u043c.  <\/p>\n<\/blockquote>\n<h2>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0433\u0440\u044b &#171;\u0416\u0438\u0437\u043d\u044c&#187;<\/h2>\n<ul>\n<li>\n<p>\u041c\u0435\u0441\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438\u0433\u0440\u044b\u00a0\u2014 \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d\u043d\u0430\u044f \u043d\u0430 \u043a\u043b\u0435\u0442\u043a\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0435\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0439, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u043d\u0430 \u044d\u0442\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438\u00a0\u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0441\u0435\u043c\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439, \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0438\u0445 \u0435\u0451, \u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0434\u0432\u0443\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u0445: \u0431\u044b\u0442\u044c \u00ab\u0436\u0438\u0432\u043e\u0439\u00bb (\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439) \u0438\u043b\u0438 \u00ab\u043c\u0451\u0440\u0442\u0432\u043e\u0439\u00bb (\u043f\u0443\u0441\u0442\u043e\u0439).<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0436\u0438\u0432\u044b\u0445 \u043a\u043b\u0435\u0442\u043e\u043a \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438\u0433\u0440\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435\u043c. \u041a\u0430\u0436\u0434\u043e\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u043e \u0442\u0430\u043a\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c:<\/p>\n<ul>\n<li>\n<p>\u0432 \u043f\u0443\u0441\u0442\u043e\u0439 (\u043c\u0435\u0440\u0442\u0432\u043e\u0439) \u043a\u043b\u0435\u0442\u043a\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0441\u0435\u0434\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0440\u0438 \u0436\u0438\u0432\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438, \u0437\u0430\u0440\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0436\u0438\u0437\u043d\u044c<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0443 \u0436\u0438\u0432\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u0438 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0438\u043b\u0438 \u0442\u0440\u0438 \u0436\u0438\u0432\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0430, \u043a\u043b\u0435\u0442\u043a\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0441\u0432\u043e\u044e \u0436\u0438\u0437\u043d\u044c, \u0438\u043d\u0430\u0447\u0435 \u0443\u043c\u0438\u0440\u0430\u0435\u0442<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/h2>\n<ol>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0428\u0430\u043d\u0441 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043b\u0435\u0442\u043a\u0438 (\u0436\u0438\u0432\u0430\u044f \u0438\u043b\u0438 \u043c\u0435\u0440\u0442\u0432\u0430\u044f)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0435\u043b\u044b &#171;\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f&#187; \u0438 &#171;\u0432\u044b\u0436\u0438\u0432\u0430\u043d\u0438\u044f&#187; (\u043e\u0442 0 \u0434\u043e 8)<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0439<\/p>\n<\/li>\n<\/ol>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0421++<\/h2>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a \u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<pre><code class=\"cpp\">struct GenerationSettings final {       value_type rows, cols, live_chance, generation_count;       std::pair &lt;value_type, value_type> live_limit, born_limit; };<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 value_type?<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p>value_type \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e int<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">using value_type = int;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u041b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0435\u0449\u0435\u0440\u044b<\/h2>\n<ol>\n<li>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440\u044b \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0428\u0430\u043d\u0441 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043b\u0435\u0442\u043a\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u044b\u0448\u0435 40%<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0442 5 \u0434\u043e 8<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 4 \u0434\u043e 8<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438 \u0442\u0430\u043a\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043e\u0442 20-40 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0439 \u0434\u043e \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u043a\u043b\u0435\u0442\u043a\u0438 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0436\u0438\u0432\u044b\u043c\u0438<\/p>\n<\/li>\n<\/ol>\n<h2>\u041f\u0435\u0440\u0432\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435<\/h2>\n<ul>\n<li>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0448\u0430\u043d\u0441\u0430 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0435\u0442\u043a\u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u043a\u0430\u043a\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0436\u0438\u0432\u043e\u0439 \u0430 \u043a\u0430\u043a\u0430\u044f \u043c\u0435\u0440\u0442\u0432\u043e\u0439<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430 \u0448\u0430\u043d\u0441 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f live_chance<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0435\u0449\u0435\u0440\u044b \u0438 \u0448\u0430\u043d\u0441 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 &lt;random> C++11<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">return_type InitializeRandom(value_type rows, value_type cols, value_type live_chance) {     std::default_random_engine re(std::chrono::system_clock::now().time_since_epoch().count());     std::uniform_int_distribution &lt;value_type> dist(0, 100);      \/\/ data_type -> std::vector&lt;value_type>     return_type::data_type generation(rows * cols);     std::generate(generation.begin(), generation.end(), [&amp;dist, &amp;re, live_chance] {         value_type chance = dist(re);         return chance &lt;= live_chance ? 1 : 0;     });     return {generation, rows, cols}; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u041a\u043b\u0435\u0442\u043a\u0443 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0436\u0438\u0432\u043e\u0439, \u0435\u0441\u043b\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435 live_chance<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u043f\u0441\u0435\u0432\u0434\u043e-)\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0434\u0432\u0438\u0436\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f seed&#8217;\u043e\u043c, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u043c \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 &lt;chrono><\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 return_type?<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p>return_type \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>DataWrapper \u0437\u043d\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 c \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">template &lt;> struct DataWrapper&lt;kCave> final {     using value_type = int;     using data_type = std::vector&lt;value_type>;      data_type data;     value_type rows = 0, cols = 0;      int &amp;operator()(std::size_t row, std::size_t col) {         return data[row * cols + col];     }      int  operator()(std::size_t row, std::size_t col) const {         if (row >= rows or col >= cols)             return 1;         return data[row * cols + col];     } }; <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<\/div>\n<\/details>\n<h2>\u041f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f<\/h2>\n<ul>\n<li>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u043d\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u043d\u0435\u0435 \u0436\u0438\u0432\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043b\u0435\u0442\u043a\u0438 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 (\u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a) \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0436\u0438\u0442\u044c \u043a\u043b\u0435\u0442\u043a\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0436\u0438\u0432\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/278\/30a\/6a8\/27830a6a8ba4ee9fe85e4645e281f52b.png\" width=\"643\" height=\"452\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/278\/30a\/6a8\/27830a6a8ba4ee9fe85e4645e281f52b.png\"\/><\/figure>\n<blockquote>\n<p>\u041e\u043a\u0440\u0435\u0301\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u041c\u0443\u0301\u0440\u0430 \u043a\u043b\u0435\u0442\u043a\u0438 (\u0430\u043d\u0433\u043b. Moore neighborhood) \u2014 \u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014\u00a0<strong>\u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0441\u044c\u043c\u0438 \u043a\u043b\u0435\u0442\u043e\u043a \u043d\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u0430\u0440\u043a\u0435\u0442\u0435, \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043e\u0431\u0449\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u0443 \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u043e\u0439<\/strong>.  <\/p>\n<\/blockquote>\n<ul>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">value_type CountLiveNeighbours(value_type row, value_type col, const return_type &amp;cave) {     value_type count = 0;     for (auto item: {cave(row, col - 1), cave(row, col + 1), cave(row - 1, col), cave(row + 1, col),                      cave(row - 1, col - 1), cave(row - 1, col + 1), cave(row + 1, col - 1),                      cave(row + 1, col + 1)})         if (item != 0)             count++;     return count; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u0436\u0438\u0432\u0430 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0435 live_limit, \u0442\u043e \u043a\u043b\u0435\u0442\u043a\u0430 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0436\u0438\u0432\u043e\u0439, \u0438\u043d\u0430\u0447\u0435 \u0443\u043c\u0438\u0440\u0430\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">std::pair&lt;value_type, value_type> live_limit<\/code><\/pre>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u043c\u0435\u0440\u0442\u0432\u0430 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0435 born_limit, \u0442\u043e \u043a\u043b\u0435\u0442\u043a\u0430 \u043e\u0436\u0438\u0432\u0430\u0435\u0442, \u0438\u043d\u0430\u0447\u0435 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0440\u0442\u0432\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">std::pair&lt;value_type, value_type> born_limit<\/code><\/pre>\n<ul>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u0438, \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435, \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 (\u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0439)<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/h2>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">return_type Generate(const GenerationSettings &amp;s) {     return_type cave{InitializeRandom(s.rows, s.cols, s.live_chance)}, tmp = cave;     value_type generation = 0;     while (generation++ != s.generation_count) {         for (value_type row = 0; row != cave.rows; ++row) {             for (value_type col = 0; col != cave.cols; ++col) {                 value_type count = CountLiveNeighbours(row, col, cave);                 if (cave(row, col) == 1 and (count &lt; s.live_limit.first or count > s.live_limit.second))                     tmp(row, col) = 0;                 else if (cave(row, col) == 0 and (count >= s.born_limit.first and count &lt;= s.born_limit.second))                     tmp(row, col) = 1;             }         }         std::copy(tmp.data.begin(), tmp.data.end(), cave.data.begin());     }     return cave; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u0435\u0449\u0435\u0440\u0430<\/h2>\n<ul>\n<li>\n<p>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a                            500<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432                     500<\/p>\n<\/li>\n<li>\n<p>\u0448\u0430\u043d\u0441 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438  49<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0439                   30<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0435\u0434\u0435\u043b \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438                   [4-8]<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0435\u0434\u0435\u043b \u0440\u043e\u0436\u0434\u0430\u0435\u043c\u043e\u0441\u0442\u0438                     [5-8]<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/849\/0e6\/5f1\/8490e65f18e95a4e9d5aaa743c6f176d.png\" width=\"1768\" height=\"1017\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/849\/0e6\/5f1\/8490e65f18e95a4e9d5aaa743c6f176d.png\"\/><\/figure>\n<\/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\/741564\/\"> https:\/\/habr.com\/ru\/articles\/741564\/<\/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<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0435\u0449\u0435\u0440 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043b\u0435\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430<\/h2>\n<blockquote>\n<p><strong>\u041a\u043b\u0435\u0442\u043e\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442<\/strong>\u00a0\u2014 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c, \u0438\u0437\u0443\u0447\u0430\u0435\u043c\u0430\u044f \u0432\u00a0\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435, \u0442\u0435\u043e\u0440\u0438\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043c\u043e\u0441\u0442\u0438, \u0444\u0438\u0437\u0438\u043a\u0435, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0438\u00a0\u0438 \u043c\u0438\u043a\u0440\u043e\u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0435. \u041e\u0441\u043d\u043e\u0432\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043f\u0440\u0438\u043b\u0435\u0433\u0430\u044e\u0449\u0438\u0445 \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 \u043a\u043b\u0435\u0442\u043e\u043a (\u044f\u0447\u0435\u0435\u043a), \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 \u0440\u0435\u0448\u0451\u0442\u043a\u0443. \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u00a0<em>\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439<\/em>\u00a0(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 1 \u0438 0). <\/p>\n<\/blockquote>\n<figure class=\"full-width\"><\/figure>\n<blockquote>\n<p><strong>\u0418\u0433\u0440\u0430 \u00ab\u0416\u0438\u0437\u043d\u044c\u00bb<\/strong>\u00a0(<em>Game of Life<\/em>)\u00a0\u2014\u00a0\u043a\u043b\u0435\u0442\u043e\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442, \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d\u043d\u044b\u0439 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u043c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u043e\u043c\u00a0\u0414\u0436\u043e\u043d\u043e\u043c \u041a\u043e\u043d\u0432\u0435\u0435\u043c \u0432 1970 \u0433\u043e\u0434\u0443. \u042d\u0442\u043e \u0438\u0433\u0440\u0430 \u0431\u0435\u0437 \u0438\u0433\u0440\u043e\u043a\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u043b\u0438\u0448\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442 \u0437\u0430 \u0435\u0451 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435\u043c.  <\/p>\n<\/blockquote>\n<h2>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0433\u0440\u044b &#171;\u0416\u0438\u0437\u043d\u044c&#187;<\/h2>\n<ul>\n<li>\n<p>\u041c\u0435\u0441\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438\u0433\u0440\u044b\u00a0\u2014 \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d\u043d\u0430\u044f \u043d\u0430 \u043a\u043b\u0435\u0442\u043a\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0435\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0439, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u043d\u0430 \u044d\u0442\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438\u00a0\u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0441\u0435\u043c\u044c \u0441\u043e\u0441\u0435\u0434\u0435\u0439, \u043e\u043a\u0440\u0443\u0436\u0430\u044e\u0449\u0438\u0445 \u0435\u0451, \u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0434\u0432\u0443\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u0445: \u0431\u044b\u0442\u044c \u00ab\u0436\u0438\u0432\u043e\u0439\u00bb (\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439) \u0438\u043b\u0438 \u00ab\u043c\u0451\u0440\u0442\u0432\u043e\u0439\u00bb (\u043f\u0443\u0441\u0442\u043e\u0439).<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0436\u0438\u0432\u044b\u0445 \u043a\u043b\u0435\u0442\u043e\u043a \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438\u0433\u0440\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435\u043c. \u041a\u0430\u0436\u0434\u043e\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u043e \u0442\u0430\u043a\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c:<\/p>\n<ul>\n<li>\n<p>\u0432 \u043f\u0443\u0441\u0442\u043e\u0439 (\u043c\u0435\u0440\u0442\u0432\u043e\u0439) \u043a\u043b\u0435\u0442\u043a\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0441\u0435\u0434\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0440\u0438 \u0436\u0438\u0432\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438, \u0437\u0430\u0440\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0436\u0438\u0437\u043d\u044c<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0443 \u0436\u0438\u0432\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u0438 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0438\u043b\u0438 \u0442\u0440\u0438 \u0436\u0438\u0432\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0430, \u043a\u043b\u0435\u0442\u043a\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0441\u0432\u043e\u044e \u0436\u0438\u0437\u043d\u044c, \u0438\u043d\u0430\u0447\u0435 \u0443\u043c\u0438\u0440\u0430\u0435\u0442<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/h2>\n<ol>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0428\u0430\u043d\u0441 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043b\u0435\u0442\u043a\u0438 (\u0436\u0438\u0432\u0430\u044f \u0438\u043b\u0438 \u043c\u0435\u0440\u0442\u0432\u0430\u044f)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0435\u043b\u044b &#171;\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f&#187; \u0438 &#171;\u0432\u044b\u0436\u0438\u0432\u0430\u043d\u0438\u044f&#187; (\u043e\u0442 0 \u0434\u043e 8)<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0439<\/p>\n<\/li>\n<\/ol>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0421++<\/h2>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a \u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<pre><code class=\"cpp\">struct GenerationSettings final {       value_type rows, cols, live_chance, generation_count;       std::pair &lt;value_type, value_type> live_limit, born_limit; };<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 value_type?<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p>value_type \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e int<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">using value_type = int;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u041b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0435\u0449\u0435\u0440\u044b<\/h2>\n<ol>\n<li>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440\u044b \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0428\u0430\u043d\u0441 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043b\u0435\u0442\u043a\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u044b\u0448\u0435 40%<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0442 5 \u0434\u043e 8<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 4 \u0434\u043e 8<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438 \u0442\u0430\u043a\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043e\u0442 20-40 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0439 \u0434\u043e \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u043a\u043b\u0435\u0442\u043a\u0438 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0436\u0438\u0432\u044b\u043c\u0438<\/p>\n<\/li>\n<\/ol>\n<h2>\u041f\u0435\u0440\u0432\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435<\/h2>\n<ul>\n<li>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0448\u0430\u043d\u0441\u0430 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0435\u0442\u043a\u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u043a\u0430\u043a\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0436\u0438\u0432\u043e\u0439 \u0430 \u043a\u0430\u043a\u0430\u044f \u043c\u0435\u0440\u0442\u0432\u043e\u0439<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430 \u0448\u0430\u043d\u0441 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f live_chance<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0435\u0449\u0435\u0440\u044b \u0438 \u0448\u0430\u043d\u0441 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 &lt;random> C++11<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">return_type InitializeRandom(value_type rows, value_type cols, value_type live_chance) {     std::default_random_engine re(std::chrono::system_clock::now().time_since_epoch().count());     std::uniform_int_distribution &lt;value_type> dist(0, 100);      \/\/ data_type -> std::vector&lt;value_type>     return_type::data_type generation(rows * cols);     std::generate(generation.begin(), generation.end(), [&amp;dist, &amp;re, live_chance] {         value_type chance = dist(re);         return chance &lt;= live_chance ? 1 : 0;     });     return {generation, rows, cols}; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u041a\u043b\u0435\u0442\u043a\u0443 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0436\u0438\u0432\u043e\u0439, \u0435\u0441\u043b\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435 live_chance<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u043f\u0441\u0435\u0432\u0434\u043e-)\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0434\u0432\u0438\u0436\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f seed&#8217;\u043e\u043c, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u043c \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 &lt;chrono><\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 return_type?<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p>return_type \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>DataWrapper \u0437\u043d\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 c \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">template &lt;> struct DataWrapper&lt;kCave> final {     using value_type = int;     using data_type = std::vector&lt;value_type>;      data_type data;     value_type rows = 0, cols = 0;      int &amp;operator()(std::size_t row, std::size_t col) {         return data[row * cols + col];     }      int  operator()(std::size_t row, std::size_t col) const {         if (row >= rows or col >= cols)             return 1;         return data[row * cols + col];     } }; <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<\/div>\n<\/details>\n<h2>\u041f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f<\/h2>\n<ul>\n<li>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u043d\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u043d\u0435\u0435 \u0436\u0438\u0432\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043b\u0435\u0442\u043a\u0438 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 (\u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a) \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0436\u0438\u0442\u044c \u043a\u043b\u0435\u0442\u043a\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0436\u0438\u0432\u044b\u0445 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"full-width\"><\/figure>\n<blockquote>\n<p>\u041e\u043a\u0440\u0435\u0301\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u041c\u0443\u0301\u0440\u0430 \u043a\u043b\u0435\u0442\u043a\u0438 (\u0430\u043d\u0433\u043b. Moore neighborhood) \u2014 \u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014\u00a0<strong>\u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0441\u044c\u043c\u0438 \u043a\u043b\u0435\u0442\u043e\u043a \u043d\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u0430\u0440\u043a\u0435\u0442\u0435, \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043e\u0431\u0449\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u0443 \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u043e\u0439<\/strong>.  <\/p>\n<\/blockquote>\n<ul>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0441\u0435\u0434\u0435\u0439<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">value_type CountLiveNeighbours(value_type row, value_type col, const return_type &amp;cave) {     value_type count = 0;     for (auto item: {cave(row, col - 1), cave(row, col + 1), cave(row - 1, col), cave(row + 1, col),                      cave(row - 1, col - 1), cave(row - 1, col + 1), cave(row + 1, col - 1),                      cave(row + 1, col + 1)})         if (item != 0)             count++;     return count; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u0436\u0438\u0432\u0430 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0435 live_limit, \u0442\u043e \u043a\u043b\u0435\u0442\u043a\u0430 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0436\u0438\u0432\u043e\u0439, \u0438\u043d\u0430\u0447\u0435 \u0443\u043c\u0438\u0440\u0430\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">std::pair&lt;value_type, value_type> live_limit<\/code><\/pre>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u043c\u0435\u0440\u0442\u0432\u0430 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0435 born_limit, \u0442\u043e \u043a\u043b\u0435\u0442\u043a\u0430 \u043e\u0436\u0438\u0432\u0430\u0435\u0442, \u0438\u043d\u0430\u0447\u0435 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0440\u0442\u0432\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">std::pair&lt;value_type, value_type> born_limit<\/code><\/pre>\n<ul>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u0438, \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435, \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 (\u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0439)<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/h2>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">return_type Generate(const GenerationSettings &amp;s) {     return_type cave{InitializeRandom(s.rows, s.cols, s.live_chance)}, tmp = cave;     value_type generation = 0;     while (generation++ != s.generation_count) {         for (value_type row = 0; row != cave.rows; ++row) {             for (value_type col = 0; col != cave.cols; ++col) {                 value_type count = CountLiveNeighbours(row, col, cave);                 if (cave(row, col) == 1 and (count &lt; s.live_limit.first or count > s.live_limit.second))                     tmp(row, col) = 0;                 else if (cave(row, col) == 0 and (count >= s.born_limit.first and count &lt;= s.born_limit.second))                     tmp(row, col) = 1;             }         }         std::copy(tmp.data.begin(), tmp.data.end(), cave.data.begin());     }     return cave; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u0435\u0449\u0435\u0440\u0430<\/h2>\n<ul>\n<li>\n<p>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a                            500<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432                     500<\/p>\n<\/li>\n<li>\n<p>\u0448\u0430\u043d\u0441 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438  49<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0439                   30<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0435\u0434\u0435\u043b \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u0438                   [4-8]<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0435\u0434\u0435\u043b \u0440\u043e\u0436\u0434\u0430\u0435\u043c\u043e\u0441\u0442\u0438                     [5-8]<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><\/figure>\n<\/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\/741564\/\"> https:\/\/habr.com\/ru\/articles\/741564\/<\/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-348736","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/348736","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=348736"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/348736\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=348736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=348736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=348736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}