{"id":350865,"date":"2023-07-27T15:00:53","date_gmt":"2023-07-27T15:00:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=350865"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=350865","title":{"rendered":"<span>\u041a\u0440\u0435\u0441\u0442\u0438\u043a\u0438-\u041d\u043e\u043b\u0438\u043a\u0438 (Tic Tac Toe) \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u043d\u0430 Python. \u0427\u0430\u0441\u0442\u044c 2: \u0448\u0430\u0433 \u043a ML<\/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. \u042f \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044c Python \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u043e\u043b\u0433\u043e \u043e\u0441\u0432\u0430\u0438\u0432\u0430\u044e \u044f\u0437\u044b\u043a \u0432\u0441\u0435\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u041c\u043e\u044f \u0446\u0435\u043b\u044c &#8212; \u043f\u043e\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0435\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c \u0441 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c\u044e. \u041d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u043f\u044b\u0442\u0430 \u0432 IT \u043d\u0435 \u0438\u043c\u0435\u043b, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0438\u0437\u043b\u0430\u0433\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0435\u0439, \u043d\u0435 \u0441\u0443\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u0433\u043e. \u041c\u043e\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f (\u043e\u043f\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0442\u0440\u0430\u0432\u043c\u0430\u0442\u043e\u043b\u043e\u0433, \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 \u043d\u0430\u0443\u043a), \u0434\u0430\u043b\u0435\u043a\u0430 \u043e\u0442 IT, \u043d\u043e \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043d\u0435\u0435 \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043d\u0435\u0434\u0440\u044f\u044e\u0442\u0441\u044f AI \u0438 ML. <\/p>\n<p><em>\u0425\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u0435\u0434\u0438\u0446\u0438\u043d\u044b \u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0438\u043b \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a-\u0442\u043e \u043d\u0430\u0447\u0430\u0442\u044c IT \u043f\u043e\u0440\u0442\u0444\u043e\u043b\u0438\u043e \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u043c\u0443 &#171;\u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439&#187;.<\/em><\/p>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/articles\/748586\/\" rel=\"noopener noreferrer nofollow\"><u>\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/u><\/a> \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u043e \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0438\u0433\u0440\u044b \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u00ab\u0425\u00bb \u0438\u043b\u0438 \u00ab\u041e\u00bb \u0438\u0433\u0440\u043e\u043a\u0430, \u0438\u0437\u0431\u0435\u0433\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u00ab\u0434\u0435\u0440\u0435\u0432\u0430 \u0434\u043b\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0445\u043e\u0434\u043e\u0432\u00bb. \u0426\u0435\u043b\u044c &#8212; \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044f \u0438 \u0432\u044b\u0431\u043e\u0440 &#171;\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0445\u043e\u0434\u0430&#187;. <\/p>\n<p>\u0412\u043e <em><u>\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/u><\/em> &#171;\u043b\u0443\u0447\u0448\u0438\u0439 \u0445\u043e\u0434&#187; \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438\u0437 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 <strong><em>.csv<\/em><\/strong> \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 50000 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0438\u0433\u0440 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0441 \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0431\u043e\u0439. \u041f\u0440\u0438\u0447\u0435\u043c \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0433\u0440\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043c\u0430\u0448\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0432\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u0432 \u0444\u0430\u0439\u043b, \u0435\u0441\u043b\u0438 \u0440\u0430\u043d\u0435\u0435 \u0438\u0445 \u0442\u0430\u043c \u043d\u0435 \u0431\u044b\u043b\u043e. \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u044f \u0432\u0437\u044f\u043b \u0438\u0437 ML \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u044b\u0445 \u0434\u0432\u0438\u0436\u043a\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 DB \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438\u0433\u0440 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u043e\u0432 \u0437\u0430 \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0432\u0435\u043a\u0430. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0432\u0435\u043b, \u0441\u044b\u0433\u0440\u0430\u0432 100 \u0438\u0433\u0440 \u0441 <a href=\"https:\/\/www.google.com\/search?q=tic+tac+toe&amp;oq=&amp;gs_lcrp=EgZjaHJvbWUqCQgEEEUYOxjCAzIJCAAQIxgnGOoCMgkIARAjGCcY6gIyDwgCEC4YJxjHARjqAhjRAzIJCAMQRRg7GMIDMgkIBBBFGDsYwgMyCQgFEEUYOxjCAzIJCAYQRRg7GMID0gENMjY3MjkzMzRqMGoxNagCB7ACAQ&amp;sourceid=chrome&amp;ie=UTF-8\" rel=\"noopener noreferrer nofollow\"><u>web Tic-Tac-Toe \u043e\u0442 Google<\/u><\/a>, \u0432\u044b\u0431\u0440\u0430\u0432 \u0440\u043e\u043b\u044c \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c \u0438 \u043c\u043e\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u043d\u0430 Python.\u00a0<\/p>\n<p><strong>\u041a\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b:<\/strong>\u00a0\u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044f\u043c Python, \u043b\u043e\u0433\u0438\u043a\u0438, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u0412 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043e\u0431\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u043e\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c.<\/p>\n<p><strong>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438: <\/strong><\/p>\n<ol>\n<li>\n<p>\u0412\u0430\u0436\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u0433\u0440 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0441 \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0431\u043e\u0439. <\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0438\u0441\u043a \u00ab\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0445\u043e\u0434\u0430\u00bb \u0432 DB. <\/p>\n<\/li>\n<li>\n<p>\u042d\u0442\u043e \u043b\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0438 ML? \u0412\u044b\u0432\u043e\u0434\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ol>\n<p>\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u043e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0432\u0441\u0435\u043c\u0438 \u0441\u0438\u043b\u0430\u043c\u0438 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0438 \u0434\u043e\u043d\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c. \u0417\u0430\u0434\u0430\u0447\u0430 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u043b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438. <\/p>\n<h3>\u0412\u0430\u0436\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438<\/h3>\n<ol>\n<li>\n<p>\u0412 \u043e\u0434\u043d\u043e\u0439 \u0438\u0433\u0440\u0435 \u0434\u043e \u043f\u043e\u0431\u0435\u0434\u044b &#171;\u041a\u0440\u0435\u0441\u0442\u0438\u043a\u043e\u0432&#187; \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 5, 7 \u0438\u043b\u0438 9 \u0445\u043e\u0434\u043e\u0432 (\u0441\u0442\u0430\u0434\u0438\u0439 \u0438\u0433\u0440\u044b), \u0430 \u0434\u043b\u044f \u043f\u043e\u0431\u0435\u0434\u044b &#171;\u041d\u043e\u043b\u0438\u043a\u043e\u0432&#187; 6 \u0438\u043b\u0438 8. \u041d\u0438\u0447\u044c\u044f (&#171;Draw&#187;) &#8212; \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 9-\u0439 \u0445\u043e\u0434. <\/p>\n<\/li>\n<li>\n<p>\u0412 \u043e\u0434\u043d\u043e\u0439 \u0438\u0433\u0440\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442 5 \u0434\u043e 9 \u0441\u0442\u0430\u0434\u0438\u0439 (\u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u0445 \u0445\u043e\u0434\u043e\u0432 \u0425 \u0438 \u041e).<\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 <strong><em>TTT[ ]<\/em><\/strong> (\u0441\u043c. <a href=\"https:\/\/habr.com\/ru\/articles\/748586\/\" rel=\"noopener noreferrer nofollow\"><u>\u0447\u0430\u0441\u0442\u044c 1<\/u><\/a>). <\/p>\n<\/li>\n<li>\n<p>\u041f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043d\u0451\u043c \u043b\u0435\u0433\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0447\u0435\u0439 \u0445\u043e\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437 9 \u0446\u0438\u0444\u0440 (=9 \u043a\u043b\u0435\u0442\u043e\u043a \u043f\u043e\u043b\u044f) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u0432 DB.   <\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u0437 50000 \u0438\u0433\u0440 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u0441\u043c. <a href=\"https:\/\/habr.com\/ru\/articles\/748586\/\" rel=\"noopener noreferrer nofollow\"><u>\u0447\u0430\u0441\u0442\u044c 1<\/u><\/a>) \u0434\u043b\u044f &#171;\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0445\u043e\u0434\u0430&#187; \u043f\u0440\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043b\u0438\u043d\u0438\u0438 \u0425\u0425_ (\u0425_\u0425) \u0438\u043b\u0438 \u041e\u041e_ (\u041e_\u041e), \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u043e\u0439 \u043d\u0435 \u0431\u044b\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d, \u0442\u043e \u0445\u043e\u0434 \u0431\u044b\u043b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c. \u0418\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 9! \u0445\u043e\u0434\u043e\u0432 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0434\u043b\u044f &#171;\u0447\u0438\u0441\u0442\u043e\u0442\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430&#187;.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0438\u0433\u0440\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b &#171;\u043f\u043e\u0441\u0442\u0430\u0434\u0438\u0439\u043d\u043e&#187; (\u043e\u0442 5 \u0434\u043e 9), \u043a\u0430\u0436\u0434\u043e\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u0437 10-\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u043d\u043e\u0441\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 (\u0441\u043c. \u043d\u0438\u0436\u0435).<\/p>\n<\/li>\n<\/ol>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u0433\u0440 \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<p><u>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438:<\/u><\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c (\u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c), \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0435\u0441\u0430 (<strong><em>W<sub>n<\/sub><\/em><\/strong>) \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. <\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <em>&#171;\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434&#187;<\/em> \u0432 \u043e\u0434\u0438\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u043f\u043e\u043b\u0435\u043c (<strong><em>TTT[ ]<\/em><\/strong>), \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0441\u0432\u043e\u0439 \u0437\u043d\u0430\u043a (&#171;-&#187; \u0434\u043b\u044f \u0425, &#171;+&#187; \u0434\u043b\u044f \u041e). \u0426\u0435\u043b\u044c &#8212; \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0438\u0434\u0438\u0442 \u0432 DB \u0438 \u043f\u043e\u043b\u0435 \u0438 \u043a\u0430\u043a\u043e\u0439 \u0445\u043e\u0434 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0438\u0433\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <em>&#171;\u041a\u043e\u0433\u0434\u0430 \u0438 \u043a\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0438\u0433\u0440\u0430&#187;<\/em> \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0442\u043e\u0442 \u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a. \u0426\u0435\u043b\u044c &#8212; \u0447\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0441\u0442\u0430\u0434\u0438\u0439 (\u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0445\u043e\u0434\u043e\u0432), \u0442\u0435\u043c \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u0440\u0438\u0432\u0435\u043b \u0425 \u0438\u043b\u0438 \u041e \u043a \u043f\u043e\u0431\u0435\u0434\u0435 (\u0438\u043b\u0438 \u043d\u0438\u0447\u044c\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u0449\u0438\u0442\u044b).<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 DB, \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043f\u043e\u0441\u043b\u0435 \u0441\u0430\u043c\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435.<\/p>\n<\/li>\n<\/ol>\n<p><u>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/u><\/p>\n<p><strong>for_file()<\/strong>. \u0412\u043d\u043e\u0441\u0438\u0442 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432\u0441\u0435 \u0441\u0442\u0430\u0434\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u0433\u0440\u044b \u0432 \u0441\u043f\u0438\u0441\u043e\u043a <strong><em>game_save[ ]<\/em><\/strong> \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0430\u043d\u0430\u043b\u0438\u0437\u0435. \u041e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 &#8212; <strong><em>TTT2 = copy.deepcopy(TTT)<\/em><\/strong> \u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 (<strong><em>TTT<\/em><\/strong>). \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432 \u0444\u0430\u0439\u043b \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <em>&#171;\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434&#187;<\/em> \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0441\u0442\u0430\u0434\u0438\u044e \u0432 \u0432\u0438\u0434\u0435 -9&#8230;-1 (\u0434\u043b\u044f &#171;\u0425&#187;) \u0438 1&#8230;9 (\u0434\u043b\u044f &#171;\u041e&#187;) (\u0432\u043c\u0435\u0441\u0442\u043e 0&#8230;8 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u043a\u043b\u0435\u0442\u043a\u0438 \u043f\u043e\u043b\u044f \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 <em>\u0447\u0430\u0441\u0442\u0438 1<\/em>).<\/p>\n<pre><code class=\"python\">def for_file(): # save all stages of one game to game_save=[] list with formula     global TTT, game_save, move     if TTT2.count(0)&lt;=8:         TTT2.append((move + 1) * XO)  # add future move to the 9th position in TTT old field &amp; XO gives its sign (+\/-)                                       # so nums[9]=-5 is X's move, nums[9]=2 is O's move                                       # To simplify the check inside the DB file, we display the move number in the DB                                       # from the 1st (1...9), and not from the 0th as in the list (0...8)         TTT3 = copy.deepcopy(TTT2)  # to avoid changing inside temporary store game_save when TTT2.pop()         game_save.append(TTT3)  # add protected from any changing TTT3         TTT2.pop()  # clear last (move's) number from working field list<\/code><\/pre>\n<p><strong><em>game_save_length()<\/em><\/strong>. \u0414\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0430\u0434\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u0433\u0440\u044b (\u0441\u043f\u0438\u0441\u043a\u0438) \u0432 <strong><em>game_save[ ]<\/em><\/strong> \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c <em>&#171;\u041a\u043e\u0433\u0434\u0430 \u0438 \u043a\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0438\u0433\u0440\u0430&#187;. <\/em><\/p>\n<pre><code class=\"python\">def game_save_length(): # number of stages in one won game (game_save[...,9-next move, 10-number of moves before winning]     # Consciously counting starts from the 2nd move.     # Therefore, the O's victory always ends in an odd (5, 7), and X's - even (4, 6, 8) move.     # Draw always ends 9 move and is saved in nums[10] position.     # The last (9th) stage of each game is not in game_save[], because we don't need it for comparing and choose smth.     global game_save, XO     for item in game_save:         if draw is True: # we must divide X's win and Draw situations. Let's Draw is 9 moves totally.             item.append(9)  # or len(game_save)+1 = 9 (constantly)         else:             item.append(len(game_save)) # each stage will be added [10] position (4 ... 8)<\/code><\/pre>\n<p><strong>into_file()<\/strong>. \u041d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0444\u0430\u0439\u043b <strong><em>data.csv<\/em><\/strong>) \u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u0432\u0443\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439: <em><u>&#171;\u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u043e\u043b\u0435&#187;<\/u> + <u>&#171;\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434&#187;<\/u> + <u>&#171;\u043a\u043e\u0433\u0434\u0430 \u0438 \u043a\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u044d\u0442\u0430 \u0438\u0433\u0440\u0430&#187;<\/u><\/em>.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0444\u0430\u0439\u043b \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0434\u0432\u0435 \u0444\u0430\u0437\u044b: \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 <strong><em>game_save[ ]<\/em> <\/strong>\u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u0430 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 (\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043f\u0438\u0441\u043e\u043a) \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 10 \u0446\u0438\u0444\u0440, \u0442\u043e &#171;\u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0439&#187; \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<pre><code class=\"python\">def into_file(): # saving all games with all stages in file with formula (but without duplicates!)     global game_save     game_save_length() # creating final version of game_save[]     # We must divide using the same file only step by step      filename = \"data.csv\"     with open(filename, \"r\") as file: # opening and reading only         reader = csv.reader(file)         for row_file in reader: # reading all the lines apart             nums = list(map(int, row_file)) # one line is writing to a variable nums             for item in game_save: # iterate through all nested lists                 if item==nums:                     game_save.remove(item) # we need only unique lists = lines in DB file     file.close() # preparing move to next step      with open(filename, \"a\", newline=\"\") as file:         writer = csv.writer(file)         for item in game_save:             writer.writerow(item)  # save in DB only unique lists (lines)     file.close()     game_save.clear()  # clearing list after stored in file<\/code><\/pre>\n<p>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 <em>\u0420\u0438\u0441.1<\/em>. \u0416\u0435\u043b\u0442\u044b\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u043d\u0435\u0435 \u0441\u044b\u0433\u0440\u0430\u043d\u043d\u043e\u0439 \u0438\u0433\u0440\u044b (\u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 <strong><em>TTT[ ]<\/em><\/strong>). \u0412 \u044f\u0447\u0435\u0439\u043a\u0435 <em>J<\/em> &#8212; \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434 \u0434\u043b\u044f &#171;\u0425&#187; (-1), \u0430 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 <em>K<\/em> &#8212; \u044d\u0442\u0430 \u0438\u0433\u0440\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0431\u0435\u0434\u043e\u0439 &#171;\u041e&#187; \u043d\u0430 7\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 (\u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 8\u0439 \u0445\u043e\u0434). \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438 \u0432 \u0437\u0435\u043b\u0435\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435, \u043d\u043e \u0434\u043b\u044f \u0445\u043e\u0434\u0430 &#171;\u041e&#187;, \u043f\u0440\u0438 \u043f\u043e\u0431\u0435\u0434\u0435 &#171;\u0425&#187;.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/3f1\/aa0\/f3c\/3f1aa0f3cac3a534468f386a39d92d48.jpg\" alt=\"\u0420\u0438\u0441. 1. \u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0444\u0430\u0439\u043b\u0430 &quot;data.csv&quot; (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435). \" title=\"\u0420\u0438\u0441. 1. \u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0444\u0430\u0439\u043b\u0430 &quot;data.csv&quot; (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435). \" width=\"1018\" height=\"299\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3f1\/aa0\/f3c\/3f1aa0f3cac3a534468f386a39d92d48.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0420\u0438\u0441. 1. \u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0444\u0430\u0439\u043b\u0430 &#171;data.csv&#187; (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435). <\/figcaption><\/div>\n<\/figure>\n<h3>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0441 \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0431\u043e\u0439<\/h3>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0438\u0437 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0438\u0433\u0440 (gm&lt;=50000) \u0437\u0430 3,5 \u0447\u0430\u0441\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043e\u043a\u043e\u043b\u043e 372 \u0442. \u0441\u0442\u0440\u043e\u0447\u0435\u043a. \u041f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u0441\u0442\u0440\u043e\u043a  \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043e\u043a\u043e\u043b\u043e 20000. \u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0434\u0443\u043c\u0438\u0439 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0431\u0430\u0437\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 10000 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0445\u043e\u0434\u043e\u0432.<\/p>\n<p>\u041a \u0441\u043b\u043e\u0432\u0443, \u044f \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0446\u0438\u043a\u043b \u0437\u0430\u043f\u0438\u0441\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u0440\u0435\u0448\u0438\u0432 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0438\u0445 \u0432\u0441\u0435. \u041f\u0440\u043e\u0433\u043e\u043d\u044f\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c\u0438 20&#8230;100 \u0442. \u0438\u0433\u0440 &#8212; \u044d\u0442\u043e \u043e\u043a\u043e\u043b\u043e 762 \u0442. \u0441\u0442\u0440. \u0438 \u0434\u043e 7 \u043d\u043e\u0447\u043d\u044b\u0445 \u0447\u0430\u0441\u043e\u0432. \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0443\u0434\u0430\u043b\u044f\u043b \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432 Excel (<em>\u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0441\u0435, Data, Remove Duplicates<\/em>), \u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0432 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u043e\u0434\u043e\u043c, \u0441\u0442\u0430\u0440\u044b\u0439 \u0443\u0434\u0430\u043b\u044f\u043b. \u0426\u0435\u043b\u044c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0431\u044b\u043b\u0430 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u0445\u0432\u0430\u0442\u0438\u0442 \u043b\u0438 \u0442\u0440\u0435\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0435\u0432, \u0438\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 &#171;\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0445\u043e\u0434\u0430&#187;, \u043a\u0430\u043a\u043e\u0439 \u0432\u0435\u0441 <strong><em>W<sub>n<\/sub><\/em><\/strong> \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0442\u043a\u0438 (\u0441\u043c. <em>\u0420\u0438\u0441. 2<\/em>).<\/p>\n<pre><code class=\"python\">def comp_training(): # computer trains itself using random choice, checking algorithm and saves all unique moves to DB     global TTT, TTT2, XO, move, winner, draw, gm     while gm&lt;=50000:  # run the game loop forever for specific numbers of games (gm)         for event in pg.event.get():             if event.type == QUIT:                 pg.quit()                 sys.exit()          if winner is None:             TTT2 = copy.deepcopy(TTT)  # store the last TTT field             check_moves()  # check for XX, X_X, OO, O_O             if move is None:                 while True:                     move = random.randint(0, 8)                     if TTT[move] == 0:                         break             # additional conditions for computer training - it were turned off for current DB                     # if XO==1 and TTT[4] == 0:  # protection from the fool (when a rival makes typical triangle of \"X\")                     #     move = 4                     #     break                     # else:  # a move for good luck, gives a chance to play fair without algorithm                     #     move = random.randint(0, 8)                     #     if TTT[move] == 0:                     #         break             DrawXO()<\/code><\/pre>\n<h3>\u041f\u043e\u0438\u0441\u043a \u00ab\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0445\u043e\u0434\u0430\u00bb \u0432 DB<\/h3>\n<p><strong>from_file()<\/strong>. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 &#171;\u043b\u0443\u0447\u0448\u0438\u0439 \u0445\u043e\u0434&#187; \u043f\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 \u043d\u0430 <em>\u0420\u0438\u0441.2.<\/em> \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0441\u043e\u0432 <strong><em>W<sub>n<\/sub><\/em><\/strong><sub> <\/sub>\u043c\u0435\u0436\u0434\u0443 4-\u043c\u044f \u044d\u0442\u0430\u043f\u0430\u043c\u0438. <\/p>\n<ol>\n<li>\n<p>\u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0432 \u0438\u0433\u0440\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 <strong><em>TTT=[ ]<\/em><\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 \u0441 \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0430\u0434\u0438\u044f\u043c\u0438 \u0438\u0433\u0440 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u044f \u043f\u043e\u043b\u0435\u0439 (<strong><em>\u0432\u0435\u0441 W<sub>1 <\/sub>= 1<\/em><\/strong>), \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044f \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c <strong><em>nums[:9]<\/em><\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e 4-\u0433\u043e \u0445\u043e\u0434\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &#171;\u041a\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0438\u0433\u0440\u0430&#187; (<strong><em>nums[10]<\/em><\/strong>) \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0441\u043f\u0438\u0441\u043e\u043a <strong><em>stage[ ]<\/em><\/strong>, \u0430 \u043a\u0430\u043a\u043e\u0439 \u0431\u044b\u043b \u043f\u0440\u0438 \u044d\u0442\u043e\u043c &#171;\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434&#187; (<strong><em>nums[9]<\/em><\/strong>) &#8212; \u0432 \u0441\u043f\u0438\u0441\u043e\u043a <strong><em>move_stage[ ] <\/em><\/strong><em>\u043d\u0430 \u0442\u0443 \u0436\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u044e.<\/em>  <\/p>\n<\/li>\n<li>\n<p>\u0418\u0437 \u0432\u0441\u0435\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0443\u0441\u043f\u0435\u0448\u043d\u0435\u0435 \u0431\u044b\u043b\u0430 \u0442\u0430 \u0438\u0433\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0431\u0435\u0434\u043e\u0439 \u0438 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0435\u0439 \u0441\u0442\u0430\u0434\u0438\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 <strong><em>stage[ ] <\/em><\/strong>\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 <strong><em>q<\/em><\/strong> (<strong><em>\u0432\u0435\u0441 W<sub>2 <\/sub>= 1)<\/em><\/strong>.<\/p>\n<\/li>\n<li>\n<p> \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044e \u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0445\u043e\u0434\u043e\u0432 \u0438\u0437 <strong><em>move_stage[ ] <\/em><\/strong><em>\u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435<\/em><strong><em> moves[ ], <\/em><\/strong>\u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0442\u0443\u0434\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f <em>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/em> \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u043d\u0430 \u0440\u0430\u043d\u043d\u0438\u0445 \u0441\u0442\u0430\u0434\u0438\u044f\u0445 (\u0434\u043e 4\u0439) \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0434\u043e 8 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0438 \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0441\u0442\u0430\u0434\u0438\u044f, \u0442\u0435\u043c \u0432\u044b\u0431\u043e\u0440 &#171;\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0445\u043e\u0434\u0430&#187; \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b \u0432\u0435\u0441 \u043a\u0430\u043a \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0438\u0439 (<strong><em>W<sub>3 <\/sub>= 0,125&#8230;1)<\/em><\/strong><em>.<\/em><\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043f\u043e\u0431\u0435\u0434\u0443 \u043b\u0438\u0431\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043b\u0438\u0431\u043e \u0441\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0430\u0434\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u0433\u0440\u044b \u0441 \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b, \u0430 \u0438\u0433\u0440\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/b85\/911\/8b5\/b859118b51546f87f203ffa0f775db21.jpg\" alt=\"\u0420\u0438\u0441. 2. \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441 \u0432\u0435\u0441\u043e\u043c Wn = 1 \u043d\u0430 \u0432\u0441\u0435\u0445 \u044d\u0442\u0430\u043f\u0430\u0445 (\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435).\" title=\"\u0420\u0438\u0441. 2. \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441 \u0432\u0435\u0441\u043e\u043c Wn = 1 \u043d\u0430 \u0432\u0441\u0435\u0445 \u044d\u0442\u0430\u043f\u0430\u0445 (\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435).\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b85\/911\/8b5\/b859118b51546f87f203ffa0f775db21.jpg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0420\u0438\u0441. 2. \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441 \u0432\u0435\u0441\u043e\u043c W<sub>n <\/sub>= 1 \u043d\u0430 \u0432\u0441\u0435\u0445 \u044d\u0442\u0430\u043f\u0430\u0445 (\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435).<\/figcaption><\/div>\n<\/figure>\n<pre><code class=\"python\">def from_file(): # taking \"best next move\" from DB (2nd step in ALGORYTHM of machine learning)     global TTT, move, XO     filename = \"data.csv\"  # main DB file     with open(filename, \"r\") as file:         reader = csv.reader(file)         for row_file in reader:             nums = list(map(int, row_file))  # one line is one list with description of one game's stage             if nums[:9] == TTT and nums[10]!=9:  # if current field (TTT[]) is equal with the same in DB (nums[:9])                 stage.append(nums[10])  # list with all numbers of stages in DB which is fitted current field (TTT[])                 move_stage.append(abs(nums[9])) # list with \"next move\" in DB which is fitted (TTT[]) and stage                                # Valuables' position in the both lists is the same. For example, stage[2] fits with move_stage[2]          if len(stage)==0: # if X and O lists are empty (because \"DRAW\"), lists fills out from nums[10]==9             for row_file in reader:                 nums = list(map(int, row_file))                 if nums[:9] == TTT and nums[10]==9:                     stage.append(nums[10])                     move_stage.append(abs(nums[9]))          for q in range(0, len(stage), 1):             if stage[q] == min(stage): # find the minimum value of stage [q] because it gives the best \"next move\"                 moves.append(move_stage[q]) # the best \"next move\" fills out moves[] with move_stage[q] (it fits)                  if len(moves)==0: # if empty (didn't find best move)             move = None # way for random cell in the field         elif len(moves)==1:             move = moves[0]-1         else: # if there are several the best \"next moves\", then the machine chooses one of them randomly             while True:                 move = moves[random.randint(0, len(moves)-1)]-1                 if TTT[move] == 0:  # insurance of busy but it's not nessary                     break         stage.clear()         move_stage.clear()         moves.clear()<\/code><\/pre>\n<h3>\u042d\u0442\u043e \u043b\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0438 ML? \u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<ol>\n<li>\n<p>\u0421 \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 &#171;\u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f&#187; \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0448\u043b\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 (<strong><em>W<sub>3 <\/sub>= 0,125&#8230;1<\/em><\/strong>) \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u0438\u0433\u0440\u044b (<strong><em>\u0448\u0430\u0433 4<\/em><\/strong> \u043d\u0430 <em>\u0420\u0438\u0441.2<\/em>) \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0445\u043e\u0434\u0430 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043d\u0435 \u0434\u0430\u0441\u0442 &#171;\u0437\u0430\u0441\u0443\u0448\u0438\u0442\u044c&#187; \u0438\u0433\u0440\u0443 \u0438 \u0432\u043d\u0435\u0441\u0435\u0442 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u043f\u0440\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f &#171;\u041a\u0440\u0435\u0441\u0442\u0438\u043a\u043e\u0432&#187; \u0438 &#171;\u041d\u043e\u043b\u0438\u043a\u043e\u0432&#187; \u043d\u0430 \u043f\u043e\u043b\u0435 \u0432 \u043b\u044e\u0431\u0443\u044e \u0438\u0437 \u0441\u0442\u0430\u0434\u0438\u0439 \u043b\u044e\u0431\u043e\u0439 \u0438\u0433\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0431\u044f \u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0432 \u0444\u0430\u0439\u043b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c &#8212; \u044d\u0442\u043e  ML.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b, \u0441\u044b\u0433\u0440\u0430\u0432 100 \u0438\u0433\u0440 \u0441 <a href=\"https:\/\/www.google.com\/search?q=tic+tac+toe&amp;oq=&amp;gs_lcrp=EgZjaHJvbWUqCQgEEEUYOxjCAzIJCAAQIxgnGOoCMgkIARAjGCcY6gIyDwgCEC4YJxjHARjqAhjRAzIJCAMQRRg7GMIDMgkIBBBFGDsYwgMyCQgFEEUYOxjCAzIJCAYQRRg7GMID0gENMjY3MjkzMzRqMGoxNagCB7ACAQ&amp;sourceid=chrome&amp;ie=UTF-8\" rel=\"noopener noreferrer nofollow\"><u>web Tic-Tac-Toe \u043e\u0442 Google<\/u><\/a> \u0432 \u0440\u043e\u043b\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c \u0438 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 &#8212; \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0432\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0431\u0435\u0434 \u0438 \u043f\u043e\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u043f\u0440\u0438 \u0438\u0433\u0440\u0435 \u0437\u0430 &#171;\u0425&#187; \u0438 \u0437\u0430 &#171;\u041e&#187;.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c (\u0441\u043c. <a href=\"https:\/\/habr.com\/ru\/articles\/748586\/\" rel=\"noopener noreferrer nofollow\"><u>\u0447\u0430\u0441\u0442\u044c 1<\/u><\/a><u>)<\/u> &#8212; \u0438\u043c\u0435\u0435\u0442 \u0437\u0430\u0449\u0438\u0442\u043d\u0443\u044e \u0442\u0430\u043a\u0442\u0438\u043a\u0443, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u0434\u0435\u0431\u044e\u0442\u043d\u044b\u0435 \u0445\u043e\u0434\u044b (\u0434\u043e 4-\u0433\u043e) \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e. \u0410 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0438\u0447\u044c\u044f \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0436\u0435 \u0432 3 \u0440\u0430\u0437\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u0442\u043e\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u043d\u0430 \u043f\u0440\u043e\u0433\u043e\u043d\u043a\u0435 100 \u0442. \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0438\u0433\u0440, \u0443\u043b\u0443\u0447\u0448\u0438\u0432 \u0432\u0435\u0441 <strong><em>W<sub>3 <\/sub><\/em><\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0432 &#171;\u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438&#187; \u0438 &#171;\u043b\u0435\u0440\u043d\u0438\u043d\u0433\u043e\u0432\u043e\u0441\u0442\u0438&#187; \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0443. <\/p>\n<\/li>\n<\/ol>\n<h3>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/h3>\n<p>\u041f\u0430\u043f\u043a\u0430 \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0438 \u0438\u0433\u0440\u044b \u0441 \u043d\u0438\u043c, \u0444\u0430\u0439\u043b DB \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f <a href=\"https:\/\/drive.google.com\/drive\/folders\/1K9HFmL-ZgbRTaNjJCsR_m28ROh9bNSXX?usp=sharing\" rel=\"noopener noreferrer nofollow\"><strong><em><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/em><\/strong><\/a>, \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438 <a href=\"https:\/\/drive.google.com\/file\/d\/1gn8ctg_xWYZCLwXpfTE1qj3FjOqi0LtY\/view?usp=sharing\" rel=\"noopener noreferrer nofollow\"><em><u>\u0430\u0440\u0445\u0438\u0432\u043e\u043c<\/u><\/em><\/a>. <\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b. \u0412\u0441\u0435\u043c \u0443\u0434\u0430\u0447\u0438!<\/p>\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\/750832\/\"> https:\/\/habr.com\/ru\/articles\/750832\/<\/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. \u042f \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044c Python \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u043e\u043b\u0433\u043e \u043e\u0441\u0432\u0430\u0438\u0432\u0430\u044e \u044f\u0437\u044b\u043a \u0432\u0441\u0435\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u041c\u043e\u044f \u0446\u0435\u043b\u044c &#8212; \u043f\u043e\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0435\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c \u0441 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c\u044e. \u041d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u043f\u044b\u0442\u0430 \u0432 IT \u043d\u0435 \u0438\u043c\u0435\u043b, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0438\u0437\u043b\u0430\u0433\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0435\u0439, \u043d\u0435 \u0441\u0443\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u0433\u043e. \u041c\u043e\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f (\u043e\u043f\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0442\u0440\u0430\u0432\u043c\u0430\u0442\u043e\u043b\u043e\u0433, \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442 \u043d\u0430\u0443\u043a), \u0434\u0430\u043b\u0435\u043a\u0430 \u043e\u0442 IT, \u043d\u043e \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043d\u0435\u0435 \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043d\u0435\u0434\u0440\u044f\u044e\u0442\u0441\u044f AI \u0438 ML. <\/p>\n<p><em>\u0425\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u0435\u0434\u0438\u0446\u0438\u043d\u044b \u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0438\u043b \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a-\u0442\u043e \u043d\u0430\u0447\u0430\u0442\u044c IT \u043f\u043e\u0440\u0442\u0444\u043e\u043b\u0438\u043e \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u043c\u0443 &#171;\u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439&#187;.<\/em><\/p>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/articles\/748586\/\" rel=\"noopener noreferrer nofollow\"><u>\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/u><\/a> \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u043e \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0438\u0433\u0440\u044b \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u00ab\u0425\u00bb \u0438\u043b\u0438 \u00ab\u041e\u00bb \u0438\u0433\u0440\u043e\u043a\u0430, \u0438\u0437\u0431\u0435\u0433\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u00ab\u0434\u0435\u0440\u0435\u0432\u0430 \u0434\u043b\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0445\u043e\u0434\u043e\u0432\u00bb. \u0426\u0435\u043b\u044c &#8212; \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044f \u0438 \u0432\u044b\u0431\u043e\u0440 &#171;\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0445\u043e\u0434\u0430&#187;. <\/p>\n<p>\u0412\u043e <em><u>\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/u><\/em> &#171;\u043b\u0443\u0447\u0448\u0438\u0439 \u0445\u043e\u0434&#187; \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438\u0437 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 <strong><em>.csv<\/em><\/strong> \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 50000 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0438\u0433\u0440 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0441 \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0431\u043e\u0439. \u041f\u0440\u0438\u0447\u0435\u043c \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0433\u0440\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043c\u0430\u0448\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0432\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u0432 \u0444\u0430\u0439\u043b, \u0435\u0441\u043b\u0438 \u0440\u0430\u043d\u0435\u0435 \u0438\u0445 \u0442\u0430\u043c \u043d\u0435 \u0431\u044b\u043b\u043e. \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u044f \u0432\u0437\u044f\u043b \u0438\u0437 ML \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u044b\u0445 \u0434\u0432\u0438\u0436\u043a\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 DB \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438\u0433\u0440 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u043e\u0432 \u0437\u0430 \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0432\u0435\u043a\u0430. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0432\u0435\u043b, \u0441\u044b\u0433\u0440\u0430\u0432 100 \u0438\u0433\u0440 \u0441 <a href=\"https:\/\/www.google.com\/search?q=tic+tac+toe&amp;oq=&amp;gs_lcrp=EgZjaHJvbWUqCQgEEEUYOxjCAzIJCAAQIxgnGOoCMgkIARAjGCcY6gIyDwgCEC4YJxjHARjqAhjRAzIJCAMQRRg7GMIDMgkIBBBFGDsYwgMyCQgFEEUYOxjCAzIJCAYQRRg7GMID0gENMjY3MjkzMzRqMGoxNagCB7ACAQ&amp;sourceid=chrome&amp;ie=UTF-8\" rel=\"noopener noreferrer nofollow\"><u>web Tic-Tac-Toe \u043e\u0442 Google<\/u><\/a>, \u0432\u044b\u0431\u0440\u0430\u0432 \u0440\u043e\u043b\u044c \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c \u0438 \u043c\u043e\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u043d\u0430 Python.\u00a0<\/p>\n<p><strong>\u041a\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b:<\/strong>\u00a0\u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044f\u043c Python, \u043b\u043e\u0433\u0438\u043a\u0438, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u0412 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043e\u0431\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u043e\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c.<\/p>\n<p><strong>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438: <\/strong><\/p>\n<ol>\n<li>\n<p>\u0412\u0430\u0436\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u0433\u0440 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0441 \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0431\u043e\u0439. <\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0438\u0441\u043a \u00ab\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0445\u043e\u0434\u0430\u00bb \u0432 DB. <\/p>\n<\/li>\n<li>\n<p>\u042d\u0442\u043e \u043b\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0438 ML? \u0412\u044b\u0432\u043e\u0434\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ol>\n<p>\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u043e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0432\u0441\u0435\u043c\u0438 \u0441\u0438\u043b\u0430\u043c\u0438 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0438 \u0434\u043e\u043d\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c. \u0417\u0430\u0434\u0430\u0447\u0430 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u043b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438. <\/p>\n<h3>\u0412\u0430\u0436\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438<\/h3>\n<ol>\n<li>\n<p>\u0412 \u043e\u0434\u043d\u043e\u0439 \u0438\u0433\u0440\u0435 \u0434\u043e \u043f\u043e\u0431\u0435\u0434\u044b &#171;\u041a\u0440\u0435\u0441\u0442\u0438\u043a\u043e\u0432&#187; \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 5, 7 \u0438\u043b\u0438 9 \u0445\u043e\u0434\u043e\u0432 (\u0441\u0442\u0430\u0434\u0438\u0439 \u0438\u0433\u0440\u044b), \u0430 \u0434\u043b\u044f \u043f\u043e\u0431\u0435\u0434\u044b &#171;\u041d\u043e\u043b\u0438\u043a\u043e\u0432&#187; 6 \u0438\u043b\u0438 8. \u041d\u0438\u0447\u044c\u044f (&#171;Draw&#187;) &#8212; \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 9-\u0439 \u0445\u043e\u0434. <\/p>\n<\/li>\n<li>\n<p>\u0412 \u043e\u0434\u043d\u043e\u0439 \u0438\u0433\u0440\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442 5 \u0434\u043e 9 \u0441\u0442\u0430\u0434\u0438\u0439 (\u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u0445 \u0445\u043e\u0434\u043e\u0432 \u0425 \u0438 \u041e).<\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 <strong><em>TTT[ ]<\/em><\/strong> (\u0441\u043c. <a href=\"https:\/\/habr.com\/ru\/articles\/748586\/\" rel=\"noopener noreferrer nofollow\"><u>\u0447\u0430\u0441\u0442\u044c 1<\/u><\/a>). <\/p>\n<\/li>\n<li>\n<p>\u041f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043d\u0451\u043c \u043b\u0435\u0433\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0447\u0435\u0439 \u0445\u043e\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437 9 \u0446\u0438\u0444\u0440 (=9 \u043a\u043b\u0435\u0442\u043e\u043a \u043f\u043e\u043b\u044f) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u0432 DB.   <\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u0437 50000 \u0438\u0433\u0440 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 (\u0441\u043c. <a href=\"https:\/\/habr.com\/ru\/articles\/748586\/\" rel=\"noopener noreferrer nofollow\"><u>\u0447\u0430\u0441\u0442\u044c 1<\/u><\/a>) \u0434\u043b\u044f &#171;\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0445\u043e\u0434\u0430&#187; \u043f\u0440\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043b\u0438\u043d\u0438\u0438 \u0425\u0425_ (\u0425_\u0425) \u0438\u043b\u0438 \u041e\u041e_ (\u041e_\u041e), \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u043e\u0439 \u043d\u0435 \u0431\u044b\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d, \u0442\u043e \u0445\u043e\u0434 \u0431\u044b\u043b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c. \u0418\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 9! \u0445\u043e\u0434\u043e\u0432 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0434\u043b\u044f &#171;\u0447\u0438\u0441\u0442\u043e\u0442\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430&#187;.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0438\u0433\u0440\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b &#171;\u043f\u043e\u0441\u0442\u0430\u0434\u0438\u0439\u043d\u043e&#187; (\u043e\u0442 5 \u0434\u043e 9), \u043a\u0430\u0436\u0434\u043e\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u0437 10-\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u043d\u043e\u0441\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0444\u0430\u0439\u043b\u0430 (\u0441\u043c. \u043d\u0438\u0436\u0435).<\/p>\n<\/li>\n<\/ol>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u0433\u0440 \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<p><u>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438:<\/u><\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c (\u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c), \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0432\u0435\u0441\u0430 (<strong><em>W<sub>n<\/sub><\/em><\/strong>) \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. <\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <em>&#171;\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434&#187;<\/em> \u0432 \u043e\u0434\u0438\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u043f\u043e\u043b\u0435\u043c (<strong><em>TTT[ ]<\/em><\/strong>), \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0441\u0432\u043e\u0439 \u0437\u043d\u0430\u043a (&#171;-&#187; \u0434\u043b\u044f \u0425, &#171;+&#187; \u0434\u043b\u044f \u041e). \u0426\u0435\u043b\u044c &#8212; \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0438\u0434\u0438\u0442 \u0432 DB \u0438 \u043f\u043e\u043b\u0435 \u0438 \u043a\u0430\u043a\u043e\u0439 \u0445\u043e\u0434 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0438\u0433\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <em>&#171;\u041a\u043e\u0433\u0434\u0430 \u0438 \u043a\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0438\u0433\u0440\u0430&#187;<\/em> \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0442\u043e\u0442 \u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a. \u0426\u0435\u043b\u044c &#8212; \u0447\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0441\u0442\u0430\u0434\u0438\u0439 (\u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0445\u043e\u0434\u043e\u0432), \u0442\u0435\u043c \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u0440\u0438\u0432\u0435\u043b \u0425 \u0438\u043b\u0438 \u041e \u043a \u043f\u043e\u0431\u0435\u0434\u0435 (\u0438\u043b\u0438 \u043d\u0438\u0447\u044c\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u0449\u0438\u0442\u044b).<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 DB, \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043f\u043e\u0441\u043b\u0435 \u0441\u0430\u043c\u043e\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435.<\/p>\n<\/li>\n<\/ol>\n<p><u>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/u><\/p>\n<p><strong>for_file()<\/strong>. \u0412\u043d\u043e\u0441\u0438\u0442 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0432\u0441\u0435 \u0441\u0442\u0430\u0434\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u0433\u0440\u044b \u0432 \u0441\u043f\u0438\u0441\u043e\u043a <strong><em>game_save[ ]<\/em><\/strong> \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0430\u043d\u0430\u043b\u0438\u0437\u0435. \u041e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 &#8212; <strong><em>TTT2 = copy.deepcopy(TTT)<\/em><\/strong> \u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 (<strong><em>TTT<\/em><\/strong>). \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432 \u0444\u0430\u0439\u043b \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <em>&#171;\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434&#187;<\/em> \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0441\u0442\u0430\u0434\u0438\u044e \u0432 \u0432\u0438\u0434\u0435 -9&#8230;-1 (\u0434\u043b\u044f &#171;\u0425&#187;) \u0438 1&#8230;9 (\u0434\u043b\u044f &#171;\u041e&#187;) (\u0432\u043c\u0435\u0441\u0442\u043e 0&#8230;8 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u043a\u043b\u0435\u0442\u043a\u0438 \u043f\u043e\u043b\u044f \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 <em>\u0447\u0430\u0441\u0442\u0438 1<\/em>).<\/p>\n<pre><code class=\"python\">def for_file(): # save all stages of one game to game_save=[] list with formula     global TTT, game_save, move     if TTT2.count(0)&lt;=8:         TTT2.append((move + 1) * XO)  # add future move to the 9th position in TTT old field &amp; XO gives its sign (+\/-)                                       # so nums[9]=-5 is X's move, nums[9]=2 is O's move                                       # To simplify the check inside the DB file, we display the move number in the DB                                       # from the 1st (1...9), and not from the 0th as in the list (0...8)         TTT3 = copy.deepcopy(TTT2)  # to avoid changing inside temporary store game_save when TTT2.pop()         game_save.append(TTT3)  # add protected from any changing TTT3         TTT2.pop()  # clear last (move's) number from working field list<\/code><\/pre>\n<p><strong><em>game_save_length()<\/em><\/strong>. \u0414\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0430\u0434\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u0433\u0440\u044b (\u0441\u043f\u0438\u0441\u043a\u0438) \u0432 <strong><em>game_save[ ]<\/em><\/strong> \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c <em>&#171;\u041a\u043e\u0433\u0434\u0430 \u0438 \u043a\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0438\u0433\u0440\u0430&#187;. <\/em><\/p>\n<pre><code class=\"python\">def game_save_length(): # number of stages in one won game (game_save[...,9-next move, 10-number of moves before winning]     # Consciously counting starts from the 2nd move.     # Therefore, the O's victory always ends in an odd (5, 7), and X's - even (4, 6, 8) move.     # Draw always ends 9 move and is saved in nums[10] position.     # The last (9th) stage of each game is not in game_save[], because we don't need it for comparing and choose smth.     global game_save, XO     for item in game_save:         if draw is True: # we must divide X's win and Draw situations. Let's Draw is 9 moves totally.             item.append(9)  # or len(game_save)+1 = 9 (constantly)         else:             item.append(len(game_save)) # each stage will be added [10] position (4 ... 8)<\/code><\/pre>\n<p><strong>into_file()<\/strong>. \u041d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0444\u0430\u0439\u043b <strong><em>data.csv<\/em><\/strong>) \u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u0432\u0443\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439: <em><u>&#171;\u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u043e\u043b\u0435&#187;<\/u> + <u>&#171;\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434&#187;<\/u> + <u>&#171;\u043a\u043e\u0433\u0434\u0430 \u0438 \u043a\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u044d\u0442\u0430 \u0438\u0433\u0440\u0430&#187;<\/u><\/em>.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0444\u0430\u0439\u043b \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0434\u0432\u0435 \u0444\u0430\u0437\u044b: \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 <strong><em>game_save[ ]<\/em> <\/strong>\u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u0430 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 (\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043f\u0438\u0441\u043e\u043a) \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 10 \u0446\u0438\u0444\u0440, \u0442\u043e &#171;\u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0439&#187; \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<pre><code class=\"python\">def into_file(): # saving all games with all stages in file with formula (but without duplicates!)     global game_save     game_save_length() # creating final version of game_save[]     # We must divide using the same file only step by step      filename = \"data.csv\"     with open(filename, \"r\") as file: # opening and reading only         reader = csv.reader(file)         for row_file in reader: # reading all the lines apart             nums = list(map(int, row_file)) # one line is writing to a variable nums             for item in game_save: # iterate through all nested lists                 if item==nums:                     game_save.remove(item) # we need only unique lists = lines in DB file     file.close() # preparing move to next step      with open(filename, \"a\", newline=\"\") as file:         writer = csv.writer(file)         for item in game_save:             writer.writerow(item)  # save in DB only unique lists (lines)     file.close()     game_save.clear()  # clearing list after stored in file<\/code><\/pre>\n<p>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 <em>\u0420\u0438\u0441.1<\/em>. \u0416\u0435\u043b\u0442\u044b\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u043d\u0435\u0435 \u0441\u044b\u0433\u0440\u0430\u043d\u043d\u043e\u0439 \u0438\u0433\u0440\u044b (\u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 <strong><em>TTT[ ]<\/em><\/strong>). \u0412 \u044f\u0447\u0435\u0439\u043a\u0435 <em>J<\/em> &#8212; \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0445\u043e\u0434 \u0434\u043b\u044f &#171;\u0425&#187; (-1), \u0430 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 <em>K<\/em> &#8212; \u044d\u0442\u0430 \u0438\u0433\u0440\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0431\u0435\u0434\u043e\u0439 &#171;\u041e&#187; \u043d\u0430 7\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 (\u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 8\u0439 \u0445\u043e\u0434). \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438 \u0432 \u0437\u0435\u043b\u0435\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435, \u043d\u043e \u0434\u043b\u044f \u0445\u043e\u0434\u0430 &#171;\u041e&#187;, \u043f\u0440\u0438 \u043f\u043e\u0431\u0435\u0434\u0435 &#171;\u0425&#187;.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0420\u0438\u0441. 1. \u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0444\u0430\u0439\u043b\u0430 &#171;data.csv&#187; (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435). <\/figcaption><\/div>\n<\/figure>\n<h3>\u0422\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0441 \u0441\u0430\u043c\u0438\u043c \u0441\u043e\u0431\u043e\u0439<\/h3>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0438\u0437 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0438\u0433\u0440 (gm&lt;=50000) \u0437\u0430 3,5 \u0447\u0430\u0441\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043e\u043a\u043e\u043b\u043e 372 \u0442. \u0441\u0442\u0440\u043e\u0447\u0435\u043a. \u041f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u0441\u0442\u0440\u043e\u043a  \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043e\u043a\u043e\u043b\u043e 20000. \u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0434\u0443\u043c\u0438\u0439 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0431\u0430\u0437\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 10000 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0445\u043e\u0434\u043e\u0432.<\/p>\n<p>\u041a \u0441\u043b\u043e\u0432\u0443, \u044f \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0446\u0438\u043a\u043b \u0437\u0430\u043f\u0438\u0441\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u0440\u0435\u0448\u0438\u0432 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0438\u0445 \u0432\u0441\u0435. \u041f\u0440\u043e\u0433\u043e\u043d\u044f\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c\u0438 20&#8230;100 \u0442. \u0438\u0433\u0440 &#8212; \u044d\u0442\u043e \u043e\u043a\u043e\u043b\u043e 762 \u0442. \u0441\u0442\u0440. \u0438 \u0434\u043e 7 \u043d\u043e\u0447\u043d\u044b\u0445 \u0447\u0430\u0441\u043e\u0432. \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0443\u0434\u0430\u043b\u044f\u043b \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432 Excel (<em>\u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0441\u0435, Data, Remove Duplicates<\/em>), \u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0432 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u043e\u0434\u043e\u043c, \u0441\u0442\u0430\u0440\u044b\u0439 \u0443\u0434\u0430\u043b\u044f\u043b. \u0426\u0435\u043b\u044c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0431\u044b\u043b\u0430 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u0445\u0432\u0430\u0442\u0438\u0442 \u043b\u0438 \u0442\u0440\u0435\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0435\u0432, \u0438\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 &#171;\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0445\u043e\u0434\u0430&#187;, \u043a\u0430\u043a\u043e\u0439 \u0432\u0435\u0441 <strong><em>W<sub>n<\/sub><\/em><\/strong> \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0442\u043a\u0438 (\u0441\u043c. <em>\u0420\u0438\u0441. 2<\/em>).<\/p>\n<pre><code class=\"python\">def comp_training(): # computer trains itself using random choice, checking algorithm and saves all unique moves to DB     global TTT, TTT2, XO, move, winner, draw, gm     while gm&lt;=50000:  # run the game loop forever for specific numbers of games (gm)         for event in pg.event.get():             if event.type == QUIT:                 pg.quit()                 sys.exit()          if winner is None:             TTT2 = copy.deepcopy(TTT)  # store the last TTT field             check_moves()  # check for XX, X_X, OO, O_O             if move is None:                 while True:                     move = random.randint(0, 8)                     if TTT[move] == 0:                         break             # additional conditions for computer training - it were turned off for current DB                     # if XO==1 and TTT[4] == 0:  # protection from the fool (when a rival makes typical triangle of \"X\")                     #     move = 4                     #     break                     # else:  # a move for good luck, gives a chance to play fair without algorithm                     #     move = random.randint(0, 8)                     #     if TTT[move] == 0:                     #         break             DrawXO()<\/code><\/pre>\n<h3>\u041f\u043e\u0438\u0441\u043a \u00ab\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0445\u043e\u0434\u0430\u00bb \u0432 DB<\/h3>\n<p><strong>from_file()<\/strong>. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 &#171;\u043b\u0443\u0447\u0448\u0438\u0439 \u0445\u043e\u0434&#187; \u043f\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 \u043d\u0430 <em>\u0420\u0438\u0441.2.<\/em> \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0441\u043e\u0432 <strong><em>W<sub>n<\/sub><\/em><\/strong><sub> <\/sub>\u043c\u0435\u0436\u0434\u0443 4-\u043c\u044f \u044d\u0442\u0430\u043f\u0430\u043c\u0438. <\/p>\n<ol>\n<li>\n<p>\u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0432 \u0438\u0433\u0440\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 <strong><em>TTT=[ ]<\/em><\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 \u0441 \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u0430\u0434\u0438\u044f\u043c\u0438 \u0438\u0433\u0440 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u044f \u043f\u043e\u043b\u0435\u0439 (<strong><em>\u0432\u0435\u0441 W<sub>1 <\/sub>= 1<\/em><\/strong>), \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044f \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c <strong><em>nums[:9]<\/em><\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e 4-\u0433\u043e <\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-350865","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350865","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=350865"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350865\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}