{"id":317759,"date":"2021-02-09T15:01:53","date_gmt":"2021-02-09T15:01:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=317759"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=317759","title":{"rendered":"\u041f\u0438\u0448\u0435\u043c \u0418\u0418 \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u0413\u043e\u043c\u043e\u043a\u0443 (5 \u0432 \u0440\u044f\u0434)"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/98b\/1f3\/487\/98b1f3487e67b735808153d8172f51df.JPG\" alt=\"\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0438\u0433\u0440\u0430\u043b \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u0430\u043c\u0438\" title=\"\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0438\u0433\u0440\u0430\u043b \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u0430\u043c\u0438\" width=\"836\" height=\"834\"><figcaption>\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0438\u0433\u0440\u0430\u043b \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u0430\u043c\u0438<\/figcaption><\/figure>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u0443\u044e \u0438\u0433\u0440\u0443 \u0413\u043e\u043c\u043e\u043a\u0443 (5 \u0432 \u0440\u044f\u0434) \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 JavaScript, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a\u0430 (\u0418\u0418). \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0418\u0418, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430: NegaMax, NegaScout \u0438 MTD-F.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0418\u0418: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u0433\u0440\u044b, \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0445\u043e\u0434\u043e\u0432, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0431\u0435\u0434\u044b.<\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0431\u0435\u0434\u044b<\/h2>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u041c\u0438\u043d\u0438\u043c\u0430\u043a\u0441\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0445\u043e\u0434\u044f\u0442 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430. \u041f\u0440\u0438 \u0432 \u0445\u043e\u0434\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0438\u0441\u043a\u0430, \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0432\u044b\u0438\u0433\u0440\u0430\u043b \u043b\u0438 \u043d\u0430\u0448 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a. \u0415\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u0432\u044b\u0438\u0433\u0440\u0430\u043b, \u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0435 \u0435\u0433\u043e \u043f\u043e\u0431\u0435\u0434\u0443.<\/p>\n<pre><code class=\"javascript\">function negamax(newBoard, player, depth, a, b, hash, restrictions, last_i, last_j) {   ...    if (checkwin(newBoard, last_i, last_j)) {         return -2000000 + (MaximumDepth - depth) \/\/\u041f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0433\u043b\u0443\u0431\u0438\u043d\u0443, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c\/\u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c     }   ... }<\/code><\/pre>\n<pre><code class=\"javascript\">function checkwin(Board, x, y) {       const Directions = get_directions(Board, x, y)     for (let i = 0; i &lt; 4; i++) { \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0441\u0435 4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f         if (check_directions(Directions[i])) {             return true         }     } }<\/code><\/pre>\n<pre><code class=\"javascript\">function get_directions(Board, x, y) { \/\/\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f     const Directions = [[], [], [], []];     for (let i = -4; i &lt; 5; i++) {         if (x + i &gt;= 0 &amp;&amp; x + i &lt;= Rows - 1) {             Directions[0].push(Board[x + i][y])             if (y + i &gt;= 0 &amp;&amp; y + i &lt;= Columns - 1) {                 Directions[2].push(Board[x + i][y + i])             }         }         if (y + i &gt;= 0 &amp;&amp; y + i &lt;= Columns - 1) {             Directions[1].push(Board[x][y + i])             if (x - i &gt;= 0 &amp;&amp; x - i &lt;= Rows - 1) {                 Directions[3].push(Board[x - i][y + i])             }         }     }     return Directions }<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/538\/5f1\/ba9\/5385f1ba9f5ddf0bbf17fdf1ec23fa3c.jpg\" alt=\"4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\" title=\"4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\" width=\"1521\" height=\"1521\"><figcaption>4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0445\u043e\u0434 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a\u0430 \u0431\u044b\u043b \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u043d\u044b\u043c, \u0442\u043e \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0440\u044f\u0434 \u0438\u0437 5 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"javascript\">function check_directions(arr) {     for (let i = 0; i &lt; arr.length - 4; i++) {         if (arr[i] !== 0) {             if (arr[i] === arr[i + 1] &amp;&amp; arr[i] === arr[i + 2] &amp;&amp; arr[i] === arr[i + 3] &amp;&amp; arr[i] === arr[i + 4]) {                 return true             }         }     } }<\/code><\/pre>\n<h2>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u043a\u0438<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043d\u0430 JS,  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. (\u042f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0441 TypedArray, \u043e\u043d \u043d\u0435 \u0443\u0434\u043e\u0431\u0435\u043d \u0438 \u043d\u0435 \u0434\u0430\u0435\u0442 \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438).<br \/>1 &#8212; \u043d\u0430\u0448\u0430 \u0444\u0438\u0433\u0443\u0440\u0430, -1 &#8212; \u0444\u0438\u0433\u0443\u0440\u0430 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a\u0430.<\/p>\n<h2>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u0439 (Transposition Table)<\/h2>\n<p>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u2014 \u044d\u0442\u043e \u043a\u0435\u0448 \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0434\u043e\u0441\u043a\u0438 \u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0438\u043c\u0438 \u043e\u0446\u0435\u043d\u043e\u043a \u0432 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435. \u0415\u0441\u043b\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0445\u043e\u0434\u043e\u0432, \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f. \u0414\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043e\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0417\u043e\u0431\u0440\u0438\u0441\u0442\u0430 (Zobrist hashing).<\/p>\n<h3>Zobrist hashing<\/h3>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0445\u044d\u0448 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043e\u0441\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<p>1.&nbsp;\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e N \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0433\u0434\u0435 N=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432*\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0421\u0442\u0440\u043e\u043a*\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0433\u0440\u043e\u043a\u043e\u0432<\/p>\n<p>2.&nbsp;\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e xor \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c \u043d\u0430 \u0434\u043e\u0441\u043a\u0435<\/p>\n<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0445\u044d\u0448 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0430\u0434\u0434\u0438\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u2013 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0445\u0435\u0448\u0430 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0445\u044d\u0448 c \u043d\u0443\u043b\u044f, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0438\u0448\u044c \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u0434\u0432\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0445\u044d\u0448 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u043e\u0432\u043e\u0439 \u0444\u0438\u0433\u0443\u0440\u0435 \u043d\u0430 \u0434\u043e\u0441\u043a\u0435.<\/p>\n<pre><code class=\"javascript\">function Table_init() {   for (let i = 0; i &lt; Rows; i++) {     Table[i] = [];     for (let j = 0; j &lt; Columns; j++) {       Table[i][j] = []       Table[i][j][0] = random32(); \/\/1       Table[i][j][1] = random32(); \/\/2     }   }<\/code><\/pre>\n<pre><code class=\"javascript\">function hash(board) { \/\/\u0425\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0439 \u0434\u043e\u0441\u043a\u0438 \u0441 \u043d\u0443\u043b\u044f   let h = 0;   let p;   for (let i = 0; i &lt; Rows; i++) {     for (let j = 0; j &lt; Columns; j++) {       const Board_value = board[i][j];       if (Board_value !== 0) { \/\/\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438         if (Board_value === -1) {           p = 0  \/\/\u0438\u0433\u0440\u043e\u043a 0         } else {           p = 1 \/\/\u0438\u0433\u0440\u043e\u043a 1         }         h = h ^ Table[i][j][p];       }     }   }   return h; }<\/code><\/pre>\n<pre><code class=\"javascript\">function update_hash(hash, player, row, col) { \/\/\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0445\u044d\u0448     if (player === -1) {         player = 0     } else {         player = 1     }     hash = hash ^ Table[row][col][player];     return hash }<\/code><\/pre>\n<\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0445\u043e\u0434\u043e\u0432<\/h2>\n<pre><code class=\"javascript\">function BoardGenerator(restrictions, Board, player) {   const availSpots_score = []; \/\/c is j  r is i;   const min_r = restrictions[0];   const min_c = restrictions[1];   const max_r = restrictions[2];   const max_c = restrictions[3];;   for (let i = min_r - 2; i &lt;= max_r + 2; i++) {     for (let j = min_c - 2; j &lt;= max_c + 2; j++) {       if (Board[i][j] === 0 &amp;&amp; !remoteCell(Board, i, j)) {         const move = {}         move.i = i;         move.j = j;         move.score = evaluate_move(Board, i, j, player) \/\/\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0434 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0435\u043d, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u043c\u0443 score.          if (move.score === WIN_DETECTED) {           return [move]         }         availSpots_score.push(move)       }     }   }   availSpots_score.sort(compare) \/\/\u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0445\u043e\u0434\u044b \u043f\u043e score   \/\/  return availSpots_score.slice(0,10)   return availSpots_score; }<\/code><\/pre>\n<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0445\u043e\u0434\u043e\u0432:<\/p>\n<p>1.&nbsp;&nbsp;&nbsp; \u0412\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0444\u0438\u0433\u0443\u0440\u044b \u043d\u0430 \u0434\u043e\u0441\u043a\u0435 \u0432 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a (\u0447\u0435\u0440\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a)<\/p>\n<p>2.&nbsp;&nbsp;&nbsp; \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u0438\u0441\u043a \u0432 \u0440\u0430\u0434\u0438\u0443\u0441\u0435 \u0434\u0432\u0443\u0445 \u043a\u043b\u0435\u0442\u043e\u043a \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 (\u0441\u0438\u043d\u0438\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a)<\/p>\n<p>3.&nbsp;&nbsp;&nbsp; \u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0432 \u0440\u0430\u0434\u0438\u0443\u0441\u0435 \u0434\u0432\u0443\u0445 \u043a\u043b\u0435\u0442\u043e\u043a, \u043a\u043b\u0435\u0442\u043a\u0430 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0438 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f (\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442)<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/800\/785\/5a9\/8007855a96a939f36d18f170afde757c.png\" width=\"851\" height=\"831\"><figcaption><\/figcaption><\/figure>\n<\/p>\n<h2>Move ordering<\/h2>\n<p>\u0412 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u043b\u044c\u0444\u0430-\u0431\u0435\u0442\u0430 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f, \u0447\u0435\u043c \u0440\u0430\u043d\u044c\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u044b \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0445\u043e\u0434\u044b, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 \u0438 \u0442\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a.  \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f score \u0445\u043e\u0434\u0430, \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f 4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f: \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435, \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435, \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u0430\u043d\u0442\u0438 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435. \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 score \u0445\u043e\u0434\u0430 &#8212; \u044d\u0442\u043e \u0441\u0443\u043c\u043c\u0430 score \u0432\u0441\u0435\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"javascript\">function evaluate_move(Board, x, y, player) {   let score = 0;   const Directions = get_directions(Board, x, y);   let temp_score;   for (let i = 0; i &lt; 4; i++) {     temp_score = evaluate_direction(Directions[i], player);     if (temp_score === WIN_DETECTED) { \/\/\u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u0445\u043e\u0434 \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0438\u0433\u0440\u0443, \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0435\u0433\u043e       return WIN_DETECTED     } else {       score += temp_score     }   }   return score; }<\/code><\/pre>\n<pre><code class=\"javascript\">function evaluate_direction(direction_arr, player) {   let score = 0;   for (let i = 0; (i + 4) &lt; direction_arr.length; i++) {     let you = 0;     let enemy = 0;     for (let j = 0; j &lt;= 4; j++) {       if (direction_arr[i + j] === player) {         you++       } else if (direction_arr[i + j] === -player) {         enemy++       }     }     score += evalff(get_seq(you, enemy));     if ((score &gt;= 800000)) {       return WIN_DETECTED;     }   }   return score }<\/code><\/pre>\n<pre><code class=\"javascript\">function evalff(seq) {     switch (seq) {         case 0:             return 7;         case 1:             return 35;         case 2:             return 800;         case 3:             return 15000;         case 4:             return 800000;         case -1:             return 15;         case -2:             return 400;         case -3:             return 1800;         case -4:             return 100000;         case 17:             return 0;     } }  function get_seq(y, e) {     if (y + e === 0) {         return 0;     }     if (y !== 0 &amp;&amp; e === 0) {         return y     }     if (y === 0 &amp;&amp; e !== 0) {         return -e     }     if (y !== 0 &amp;&amp; e !== 0) {         return 17     } }<\/code><\/pre>\n<h2>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438<\/h2>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0446\u0435\u043d\u043a\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043e\u0441\u043a\u0438, \u0433\u0434\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 &#8212; \u044d\u0442\u043e \u043d\u0435\u0431\u043b\u0430\u0433\u043e\u043f\u0440\u0438\u044f\u0442\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430, \u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u0430\u0433\u043e\u043f\u0440\u0438\u044f\u0442\u043d\u0430\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u043e\u0446\u0435\u043d\u043a\u0430 \u0434\u043e\u0441\u043a\u0438 &#8212; \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0451 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043a\u0435\u0448\u0435. \u041f\u043e\u0437\u0436\u0435, \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0449\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043a\u0435\u0448\u0435 \u0438 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442, \u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c.<\/p>\n<pre><code class=\"javascript\">function evaluate_state(Board, player, hash, restrictions) {     const  black_score = eval_board(Board, -1, restrictions);     const  white_score = eval_board(Board, 1, restrictions);     let score = 0;     if (player == -1) {         score = (black_score - white_score);     } else {         score = (white_score - black_score);     }     StateCache.set(hash,score);      StateCachePuts++;     return score; }<\/code><\/pre>\n<p>eval_board \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e\u0441\u043a\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0441\u0435\u0439 \u0434\u043e\u0441\u043a\u0435 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 score, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0441 \u043e\u0431\u0435\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d (Live) \u0438 \u043f\u043e\u043b\u0443\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 (Dead) \u043b\u0438\u043d\u0438\u0439 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: _xx_ &#8212;<strong><em> <\/em><\/strong><em> <\/em>\u043e\u0442\u043a\u0440\u044b\u0442\u0430\u044f \u0434\u0432\u043e\u0439\u043a\u0430<em>,  <\/em>_oxx_ &#8212; \u043f\u043e\u043b\u0443\u043e\u0442\u043a\u0440\u044b\u0442\u0430\u044f \u0434\u0432\u043e\u0439\u043a\u0430. <\/p>\n<pre><code class=\"javascript\">const LiveOne = 10; const DeadOne = 1; const LiveTwo = 100; const DeadTwo = 10; const LiveThree = 1000; const DeadThree = 100; const LiveFour = 10000; const DeadFour = 1000; const Five = 100000;<\/code><\/pre>\n<h2>Iterative Deepening<\/h2>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043a\u0441\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u044d\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0434\u043e \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.  \u0420\u0435\u0448\u0435\u043d\u0438\u0435 &#8212; \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u044b N, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u044b N+2. (\u041c\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u043d\u0430 2, \u0442.\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430\u0448 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a). \u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u0442\u0435\u0447\u0435\u0442 \u0432\u0440\u0435\u043c\u044f, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f), \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0445\u043e\u0434.  \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f\u0441\u044f \u0432 \u043a\u0435\u0448\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u043f\u043e\u0438\u0441\u043a. <\/p>\n<h2>NegaMax, NegaScout, MTDF<\/h2>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0437\u044f\u0442\u044c \u0438\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/www.chessprogramming.org\/\" rel=\"noopener noreferrer nofollow\">chessprogramming.org<\/a>, \u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0451.  \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0431\u0430\u0433\u0438 \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0438 \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0442\u044c \u0441\u0438\u043b\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<h2>Negamax \u0441 \u0430\u043b\u044c\u0444\u0430-\u0431\u0435\u0442\u0430 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u0439<\/h2>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441 \u043d\u0435\u0433\u043e.<\/p>\n<p>\u0410\u043b\u044c\u0444\u0430-\u0431\u0435\u0442\u0430 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435 &#8212; \u044d\u0442\u043e \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u043c\u043e\u0449\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043a\u0441\u0430, \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0442\u0441\u0432\u043e \u043f\u043e\u0441\u0435\u0449\u044f\u0435\u043c\u044b\u0445 \u043d\u043e\u0434 \u0432 \u0440\u0430\u0437\u044b. Best case &#8212; \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u043b\u0443\u0447\u0448\u0438\u0439 \u0445\u043e\u0434 \u043f\u0435\u0440\u0432\u044b\u043c (<\/p>\n<p>\u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 move ordering).<\/p>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u043b\u0438\u0441\u0442\u044c\u0435\u0432 \u043f\u0440\u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0435 n \u0438 b(\u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u044f) = 40<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"243\" width=\"243\">\n<p>\u0413\u043b\u0443\u0431\u0438\u043d\u0430(n)<\/p>\n<\/td>\n<td data-colwidth=\"250\" width=\"250\">\n<p>Minimax(Alpha-beta pruning worst case)<\/p>\n<\/td>\n<td>\n<p>Alpha-beta pruning(best case)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<th data-colwidth=\"243\" width=\"243\">\n<p>0<\/p>\n<\/th>\n<td data-colwidth=\"250\" width=\"250\">\n<p>1<\/p>\n<\/td>\n<td>\n<p>1<\/p>\n<\/td>\n<\/tr>\n<tr>\n<th data-colwidth=\"243\" width=\"243\">\n<p>1<\/p>\n<\/th>\n<td data-colwidth=\"250\" width=\"250\">\n<p>40<\/p>\n<\/td>\n<td>\n<p>40<\/p>\n<\/td>\n<\/tr>\n<tr>\n<th data-colwidth=\"243\" width=\"243\">\n<p>2<\/p>\n<\/th>\n<td data-colwidth=\"250\" width=\"250\">\n<p>1,600<\/p>\n<\/td>\n<td>\n<p>79<\/p>\n<\/td>\n<\/tr>\n<tr>\n<th data-colwidth=\"243\" width=\"243\">\n<p>3<\/p>\n<\/th>\n<td data-colwidth=\"250\" width=\"250\">\n<p>64,000<\/p>\n<\/td>\n<td>\n<p>1,639<\/p>\n<\/td>\n<\/tr>\n<tr>\n<th data-colwidth=\"243\" width=\"243\">\n<p>4<\/p>\n<\/th>\n<td data-colwidth=\"250\" width=\"250\">\n<p>2,560,000<\/p>\n<\/td>\n<td>\n<p>3,199<\/p>\n<\/td>\n<\/tr>\n<tr>\n<th data-colwidth=\"243\" width=\"243\">\n<p>5<\/p>\n<\/th>\n<td data-colwidth=\"250\" width=\"250\">\n<p>102,400,000<\/p>\n<\/td>\n<td>\n<p>65,569<\/p>\n<\/td>\n<\/tr>\n<tr>\n<th data-colwidth=\"243\" width=\"243\">\n<p>6<\/p>\n<\/th>\n<td data-colwidth=\"250\" width=\"250\">\n<p>4,096,000,000<\/p>\n<\/td>\n<td>\n<p>127,999<\/p>\n<\/td>\n<\/tr>\n<tr>\n<th data-colwidth=\"243\" width=\"243\">\n<p>7<\/p>\n<\/th>\n<td data-colwidth=\"250\" width=\"250\">\n<p>163,840,000,000<\/p>\n<\/td>\n<td>\n<p>2,623,999<\/p>\n<\/td>\n<\/tr>\n<tr>\n<th data-colwidth=\"243\" width=\"243\">\n<p>8<\/p>\n<\/th>\n<td data-colwidth=\"250\" width=\"250\">\n<p>6,553,600,000,000<\/p>\n<\/td>\n<td>\n<p>5,119,999<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2>NegaScout<\/h2>\n<p>NegaScout \u2013 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u044c\u0444\u0430-\u0431\u0435\u0442\u0430-\u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u043e\u043a\u043d\u043e\u043c. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0448\u0430\u0445\u043c\u0430\u0442\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 Deep Blue.<\/p>\n<h2>MTD-F<\/h2>\n<p>MTD(F) &#8212; \u043c\u0438\u043d\u0438\u043c\u0430\u043a\u0441\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430\u0434 \u0430\u043b\u044c\u0444\u0430-\u0431\u0435\u0442\u0430.  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0430\u0442\u043e\u043a, \u043d\u043e \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 NegaScout, \u043b\u0438\u0431\u043e \u043d\u0430\u0440\u0430\u0432\u043d\u0435 \u0441 \u043d\u0438\u043c (\u042d\u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0442\u043e \u0438\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0432 \u043c\u043e\u0435\u043c \u0442\u0435\u0441\u0442\u0435 MTD-F \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0447\u0435\u043c NegaScout) <\/p>\n<p>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434:<\/p>\n<pre><code>function MTDF(root : node_type; f : integer; d : integer) : integer;       g := f;       upperbound := +INFINITY;       lowerbound := -INFINITY;       repeat             if g == lowerbound then beta := g + 1 else beta := g;             g := AlphaBetaWithMemory(root, beta - 1, beta, d);             if g &lt; beta then upperbound := g else lowerbound := g;       until lowerbound &gt;= upperbound;       return g;<\/code><\/pre>\n<h4>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0445\u043e\u0434\u043e\u0432<\/h4>\n<p>\u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u0445\u043e\u0434\u043e\u0432.<\/p>\n<pre><code class=\"java\">\/\/  return availSpots_score.slice(0,10)<\/code><\/pre>\n<p>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e, \u0447\u0442\u043e Move ordering \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0445\u043e\u0434\u043e\u0432 10 \u043b\u0443\u0447\u0448\u0438\u043c\u0438, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0442\u0430\u043d\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0441\u0438\u043b\u044c\u043d\u0435\u0435 (\u0442.\u043a. \u0441\u0442\u0430\u043d\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0433\u043b\u0443\u0431\u0438\u043d\u0443, \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0432\u0435\u043d 10).<\/p>\n<h2>\u0422\u0435\u0441\u0442\u044b (\u0433\u043b\u0443\u0431\u0438\u043d\u0430=8)<\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/14b\/1a9\/4f3\/14b1a94f3e1cf599e4ff7228f341321b.png\" width=\"2396\" height=\"570\"><figcaption><\/figcaption><\/figure>\n<p>MTD(f) 10 &#8212; \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 10 \u043b\u0443\u0447\u0448\u0438\u0445 \u0445\u043e\u0434\u043e\u0432.<\/p>\n<p>StateCache &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u0438\u0441\u0442\u044c\u0435\u0432 \u0432 \u043a\u0435\u0448\u0435.<\/p>\n<h2>\u0422\u0443\u0440\u043d\u0438\u0440 (bo3)  (60 s)<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0433\u0440\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u043c\u0438. <\/p>\n<p>\u0412\u0441\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b c \u043f\u043e\u043c\u043e\u0449\u044c\u044e Iterative Deepening.<\/p>\n<p>1 \u2013 \u043f\u043e\u0431\u0435\u0434\u0430, 0.5 \u2013 \u043d\u0438\u0447\u044c\u044f<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"147\" width=\"147\">\n<\/td>\n<td>\n<p><strong>Negamax<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>NegaScout<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>MTD(f)<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>MTD(f) 10<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"147\" width=\"147\">\n<p><strong>Negamax<\/strong><\/p>\n<\/td>\n<td>\n<\/td>\n<td>\n<p>0:2<\/p>\n<\/td>\n<td>\n<p>0:2<\/p>\n<\/td>\n<td>\n<p>0:2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"147\" width=\"147\">\n<p><strong>NegaScout<\/strong><\/p>\n<\/td>\n<td>\n<p>2:0<\/p>\n<\/td>\n<td>\n<\/td>\n<td>\n<p>1:2<\/p>\n<\/td>\n<td>\n<p>0:2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"147\" width=\"147\">\n<p><strong>MTD(f)<\/strong><\/p>\n<\/td>\n<td>\n<p>2:0<\/p>\n<\/td>\n<td>\n<p>2:1<\/p>\n<\/td>\n<td>\n<\/td>\n<td>\n<p>0:2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"147\" width=\"147\">\n<p><strong>MTD(f) 10<\/strong><\/p>\n<\/td>\n<td>\n<p>2:0<\/p>\n<\/td>\n<td>\n<p>2:0<\/p>\n<\/td>\n<td>\n<p>2:0<\/p>\n<\/td>\n<td>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>  MTD(f) 10&nbsp; 1.5:0.5 &nbsp;NegaScout 10<\/p>\n<h2>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u0438\u043a\u0440\u043e\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u0443\u0441\u0438\u043b\u044f\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/h2>\n<p>mtdf(10)<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>\u0413\u043b\u0443\u0431\u0438\u043d\u0430 \u043f\u043e\u0438\u0441\u043a\u0430<\/p>\n<\/td>\n<td>\n<p>\u0412\u0440\u0435\u043c\u044f, \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>2<\/p>\n<\/td>\n<td>\n<p>0.032<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>4<\/p>\n<\/td>\n<td>\n<p>0.11<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>6<\/p>\n<\/td>\n<td>\n<p>0.428<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>8<\/p>\n<\/td>\n<td>\n<p>3.286<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>10<\/p>\n<\/td>\n<td>\n<p>22.787<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0441\u0438\u043b\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0433\u043b\u0443\u0431\u0438\u043d\u0443. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0433\u043b\u0443\u0431\u0438\u043d\u0443, \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432 3-7 \u0440\u0430\u0437.<\/p>\n<h2>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438(js)<\/h2>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p><strong>\u0421\u0430\u0439\u0442<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (MTD(f) 10 &#8212; \u041f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a)<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p><a href=\"http:\/\/gomoku.yjyao.com\/\" rel=\"noopener noreferrer nofollow\">http:\/\/gomoku.yjyao.com\/<\/a><\/p>\n<\/td>\n<td>\n<p>2:0&nbsp; (10s \u043d\u0430 \u0445\u043e\u0434)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p><a href=\"https:\/\/github.com\/lihongxun945\/gobang\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/lihongxun945\/gobang<\/a><\/p>\n<\/td>\n<td>\n<p>2:0 &nbsp;(10s \u043d\u0430 \u0445\u043e\u0434)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p><a href=\"https:\/\/logic-games.spb.ru\/gomoku\/\" rel=\"noopener noreferrer nofollow\">https:\/\/logic-games.spb.ru\/gomoku\/<\/a><\/p>\n<\/td>\n<td>\n<p>2:0 &nbsp;(10s \u043d\u0430 \u0445\u043e\u0434)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p><a href=\"https:\/\/ixjamesyoo.github.io\/Gomoku\/\" rel=\"noopener noreferrer nofollow\">https:\/\/ixjamesyoo.github.io\/Gomoku\/<\/a><\/p>\n<\/td>\n<td>\n<p>2:0 &nbsp;(10s \u043d\u0430 \u0445\u043e\u0434)<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>(\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0447\u0435\u0441\u0442\u043d\u043e\u0435, \u043e\u043f\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043d\u0435 \u0438\u043c\u0435\u043b\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0445\u043e\u0434 \u0438 \u043d\u0430 \u0445\u043e\u0434 \u0442\u0440\u0430\u0442\u0438\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 10 \u0441\u0435\u043a\u0443\u043d\u0434)<\/p>\n<h2>\u0427\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c (\u0432 \u0442\u0435\u043e\u0440\u0438\u0438)<\/h2>\n<h4>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u043a\u0438<\/h4>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u0441\u043a\u0443 \u043a\u0430\u043a 1d \u043c\u0430\u0441\u0441\u0438\u0432 (\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b, \u043d\u0435 \u0434\u0430\u0435\u0442 \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438)<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c bitboards (\u043d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0434\u0430\u0441\u0442 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0432 js)<\/p>\n<h4>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438\/Move ordering<\/h4>\n<p>\u042f \u0432\u0437\u044f\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u043b\u0438\u043d\u0438\u0439 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0432\u0438\u0436\u043a\u043e\u0432, \u044d\u0442\u0438 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0434\u0432\u0438\u0436\u043a\u043e\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e \u0438\u0445 \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c. \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0443\u0440\u043d\u0438\u0440 \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u043b\u0438\u043d\u0438\u0439, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u043e\u0446\u0435\u043d\u043a\u0438. (\u042d\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0443\u0440\u043d\u0438\u0440\u043e\u0432 \u0438 \u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438)<br \/>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0446\u0435\u043d\u043a\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043e\u0446\u0435\u043d\u043a\u0438 \u0438 \u0435\u0451 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e. \u0411\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u043f\u043e\u0438\u0441\u043a\u0430. (+ \u042f \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u044e\u0441\u044c, \u0447\u0442\u043e tensorflow.js \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e)<\/p>\n<h4>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430<\/h4>\n<p>\u0425\u043e\u0440\u043e\u0448\u0435\u0439 \u0438\u0434\u0435\u0435\u0439 \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u043c (\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c), \u043d\u043e \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0442\u0440\u0443\u0434\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u043d\u0435\u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c\u0430\u044f) \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 javascript.<\/p>\n<p>\u0415\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e 2 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MCTS \u0438\u043b\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u0443\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u043b\u044c\u0444\u0430-\u0431\u0435\u0442\u0430 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u042f \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MCTS \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043e\u0446\u0435\u043d\u043a\u0438, \u0438\u0433\u0440\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043b\u043e\u0445\u043e. \u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c AlphaZero\/MuZero \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e MCTS + NN \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u044e\u0442 \u0443 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043d\u043e \u043e\u043f\u044f\u0442\u044c \u0436\u0435, \u044f \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u044e\u0441\u044c \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0441 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u0443\u0436\u0435 \u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0443\u044e NN.<\/p>\n<\/p>\n<p>\u041f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0442\u0438\u0432 ai(mtdf10, \u043f\u043e\u043b\u0435 21&#215;21) &#8212; <a href=\"https:\/\/4battle.ru\/play_offline\" rel=\"noopener noreferrer nofollow\">https:\/\/4battle.ru\/play_offline<\/a><\/p>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u0430\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u0418\u0418 \u0441\u0432\u043e\u0435\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438.<\/p>\n<p>\u041a\u043e\u0434:<\/p>\n<p><a href=\"https:\/\/github.com\/qwertyforce\/gomoku_ai\" rel=\"noopener noreferrer nofollow\">js \u0432\u0435\u0440\u0441\u0438\u044f(\u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f)<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/qwertyforce\/gomoku_ai_c\" rel=\"noopener noreferrer nofollow\">\u0421++ \u0432\u0435\u0440\u0441\u0438\u044f<\/a> (\u042f \u043d\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0442 \u0432  C++, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b js \u043a\u043e\u0434 \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. C++ \u0432\u0435\u0440\u0441\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 2-2.5 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0435\u0449\u0451 \u0441\u0438\u043b\u044c\u043d\u0435\u0435) <\/p>\n<p>(\u0425\u043e\u0440\u043e\u0448\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e \u0442\u0435\u043c\u0435: <a href=\"https:\/\/habr.com\/ru\/post\/390821\/\" rel=\"noopener noreferrer nofollow\">1<\/a>, <a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/474680\/\" rel=\"noopener noreferrer nofollow\">2<\/a>)<\/p>\n<\/div>\n<p> \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\/post\/541564\/\"> https:\/\/habr.com\/ru\/post\/541564\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption>\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0438\u0433\u0440\u0430\u043b \u043a\u0440\u0435\u0441\u0442\u0438\u043a\u0430\u043c\u0438<\/figcaption><\/figure>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u0443\u044e \u0438\u0433\u0440\u0443 \u0413\u043e\u043c\u043e\u043a\u0443 (5 \u0432 \u0440\u044f\u0434) \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 JavaScript, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a\u0430 (\u0418\u0418). \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0418\u0418, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430: NegaMax, NegaScout \u0438 MTD-F.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0418\u0418: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u0433\u0440\u044b, \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0445\u043e\u0434\u043e\u0432, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0431\u0435\u0434\u044b.<\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0431\u0435\u0434\u044b<\/h2>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u041c\u0438\u043d\u0438\u043c\u0430\u043a\u0441\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0445\u043e\u0434\u044f\u0442 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430. \u041f\u0440\u0438 \u0432 \u0445\u043e\u0434\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0438\u0441\u043a\u0430, \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0432\u044b\u0438\u0433\u0440\u0430\u043b \u043b\u0438 \u043d\u0430\u0448 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a. \u0415\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u0432\u044b\u0438\u0433\u0440\u0430\u043b, \u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0435 \u0435\u0433\u043e \u043f\u043e\u0431\u0435\u0434\u0443.<\/p>\n<pre><code class=\"javascript\">function negamax(newBoard, player, depth, a, b, hash, restrictions, last_i, last_j) {   ...    if (checkwin(newBoard, last_i, last_j)) {         return -2000000 + (MaximumDepth - depth) \/\/\u041f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0433\u043b\u0443\u0431\u0438\u043d\u0443, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c\/\u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c     }   ... }<\/code><\/pre>\n<pre><code class=\"javascript\">function checkwin(Board, x, y) {       const Directions = get_directions(Board, x, y)     for (let i = 0; i &lt; 4; i++) { \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0441\u0435 4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f         if (check_directions(Directions[i])) {             return true         }     } }<\/code><\/pre>\n<pre><code class=\"javascript\">function get_directions(Board, x, y) { \/\/\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f     const Directions = [[], [], [], []];     for (let i = -4; i &lt; 5; i++) {         if (x + i &gt;= 0 &amp;&amp; x + i &lt;= Rows - 1) {             Directions[0].push(Board[x + i][y])             if (y + i &gt;= 0 &amp;&amp; y + i &lt;= Columns - 1) {                 Directions[2].push(Board[x + i][y + i])             }         }         if (y + i &gt;= 0 &amp;&amp; y + i &lt;= Columns - 1) {             Directions[1].push(Board[x][y + i])             if (x - i &gt;= 0 &amp;&amp; x - i &lt;= Rows - 1) {                 Directions[3].push(Board[x - i][y + i])             }         }     }     return Directions }<\/code><\/pre>\n<figure class=\"full-width\"><figcaption>4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0445\u043e\u0434 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a\u0430 \u0431\u044b\u043b \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u043d\u044b\u043c, \u0442\u043e \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0440\u044f\u0434 \u0438\u0437 5 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"javascript\">function check_directions(arr) {     for (let i = 0; i &lt; arr.length - 4; i++) {         if (arr[i] !== 0) {             if (arr[i] === arr[i + 1] &amp;&amp; arr[i] === arr[i + 2] &amp;&amp; arr[i] === arr[i + 3] &amp;&amp; arr[i] === arr[i + 4]) {                 return true             }         }     } }<\/code><\/pre>\n<h2>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u043a\u0438<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043d\u0430 JS,  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. (\u042f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0441 TypedArray, \u043e\u043d \u043d\u0435 \u0443\u0434\u043e\u0431\u0435\u043d \u0438 \u043d\u0435 \u0434\u0430\u0435\u0442 \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438).<br \/>1 &#8212; \u043d\u0430\u0448\u0430 \u0444\u0438\u0433\u0443\u0440\u0430, -1 &#8212; \u0444\u0438\u0433\u0443\u0440\u0430 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a\u0430.<\/p>\n<h2>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u0439 (Transposition Table)<\/h2>\n<p>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u0439 \u2014 \u044d\u0442\u043e \u043a\u0435\u0448 \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0434\u043e\u0441\u043a\u0438 \u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0438\u043c\u0438 \u043e\u0446\u0435\u043d\u043e\u043a \u0432 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435. \u0415\u0441\u043b\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0445\u043e\u0434\u043e\u0432, \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f. \u0414\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043e\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0417\u043e\u0431\u0440\u0438\u0441\u0442\u0430 (Zobrist hashing).<\/p>\n<h3>Zobrist hashing<\/h3>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0445\u044d\u0448 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043e\u0441\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<p>1.&nbsp;\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e N \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0433\u0434\u0435 N=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432*\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0421\u0442\u0440\u043e\u043a*\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0433\u0440\u043e\u043a\u043e\u0432<\/p>\n<p>2.&nbsp;\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e xor \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c \u043d\u0430 \u0434\u043e\u0441\u043a\u0435<\/p>\n<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0445\u044d\u0448 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0430\u0434\u0434\u0438\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u2013 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0445\u0435\u0448\u0430 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0445\u044d\u0448 c \u043d\u0443\u043b\u044f, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0438\u0448\u044c \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u0434\u0432\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0445\u044d\u0448 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u043e\u0432\u043e\u0439 \u0444\u0438\u0433\u0443\u0440\u0435 \u043d\u0430 \u0434\u043e\u0441\u043a\u0435.<\/p>\n<pre><code class=\"javascript\">function Table_init() {   for (let i = 0; i &lt; Rows; i++) {     Table[i] = [];     for (let j = 0; j &lt; Columns; j++) {       Table[i][j] = []       Table[i][j][0] = random32(); \/\/1       Table[i][j][1] = random32(); \/\/2     }   }<\/code><\/pre>\n<pre><code class=\"javascript\">function hash(board) { \/\/\u0425\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0439 \u0434\u043e\u0441\u043a\u0438 \u0441 \u043d\u0443\u043b\u044f   let h = 0;   let p;   for (let i = 0; i &lt; Rows; i++) {     for (let j = 0; j &lt; Columns; j++) {       const Board_value = board[i][j];       if (Board_value !== 0) { \/\/\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u0435 \u043a\u043b\u0435\u0442\u043a\u0438         if (Board_value === -1) {           p = 0  \/\/\u0438\u0433\u0440\u043e\u043a 0         } else {           p = 1 \/\/\u0438\u0433\u0440\u043e\u043a 1         }         h = h ^ Table[i][j][p];       }     }   }   return h; }<\/code><\/pre>\n<pre><code class=\"javascript\">function update_hash(hash, player, row, col) { \/\/\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0445\u044d\u0448     if (player === -1) {         player = 0     } else {         player = 1     }     hash = hash ^ Table[row][col][player];     return hash }<\/code><\/pre>\n<\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0445\u043e\u0434\u043e\u0432<\/h2>\n<pre><code class=\"javascript\">function BoardGenerator(restrictions, Board, player) {   const availSpots_score = []; \/\/c is j  r is i;   const min_r = restrictions[0];   const min_c = restrictions[1];   const max_r = restrictions[2];   const max_c = restrictions[3];;   for (let i = min_r - 2; i &lt;= max_r + 2; i++) {     for (let j = min_c - 2; j &lt;= max_c + 2; j++) {       if (Board[i][j] === 0 &amp;&amp; !remoteCell(Board, i, j)) {         const move = {}         move.i = i;         move.j = j;         move.score = evaluate_move(Board, i, j, player) \/\/\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0434 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0435\u043d, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u043c\u0443 score.          if (move.score === WIN_DETECTED) {           return [move]         }         availSpots_score.push(move)       }     }   }   availSpots_score.sort(compare) \/\/\u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0445\u043e\u0434\u044b \u043f\u043e score   \/\/  return availSpots_score.slice(0,10)   return availSpots_score; }<\/code><\/pre>\n<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0445\u043e\u0434\u043e\u0432:<\/p>\n<p>1.&nbsp;&nbsp;&nbsp; \u0412\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0444\u0438\u0433\u0443\u0440\u044b \u043d\u0430 \u0434\u043e\u0441\u043a\u0435 \u0432 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a (\u0447\u0435\u0440\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a)<\/p>\n<p>2.&nbsp;&nbsp;&nbsp; \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u0438\u0441\u043a \u0432 \u0440\u0430\u0434\u0438\u0443\u0441\u0435 \u0434\u0432\u0443\u0445 \u043a\u043b\u0435\u0442\u043e\u043a \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 (\u0441\u0438\u043d\u0438\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a)<\/p>\n<p>3.&nbsp;&nbsp;&nbsp; \u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u043a\u043b\u0435\u0442\u043a\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0432 \u0440\u0430\u0434\u0438\u0443\u0441\u0435 \u0434\u0432\u0443\u0445 \u043a\u043b\u0435\u0442\u043e\u043a, \u043a\u043b\u0435\u0442\u043a\u0430 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0438 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f (\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442)<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<\/p>\n<h2>Move ordering<\/h2>\n<p>\u0412 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u043b\u044c\u0444\u0430-\u0431\u0435\u0442\u0430 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f, \u0447\u0435\u043c \u0440\u0430\u043d\u044c\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u044b \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0445\u043e\u0434\u044b, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 \u0438 \u0442\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a.  \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f score \u0445\u043e\u0434\u0430, \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f 4 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f: \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435, \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435, \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u0430\u043d\u0442\u0438 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435. \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 score \u0445\u043e\u0434\u0430 &#8212; \u044d\u0442\u043e \u0441\u0443\u043c\u043c\u0430 score \u0432\u0441\u0435\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"javascript\">function evaluate_move(Board, x, y, player) {   let score = 0;   const Directions = get_directions(Board, x, y);   let temp_score;   for (let i = 0; i &lt; 4; i++) {     temp_score = evaluate_direction(Directions[i], player);     if (temp_score === WIN_DETECTED) { \/\/\u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u0445\u043e\u0434 \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0438\u0433\u0440\u0443, \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0435\u0433\u043e       return WIN_DETECTED     } else {       score += temp_score     }   }   return score; }<\/code><\/pre>\n<pre><code class=\"javascript\">function evaluate_direction(direction_arr, player) {   let score = 0;   for (let i = 0; (i + 4) &lt; direction_arr.length; i++) {     let you = 0;     let enemy = 0;     for (let j = 0; j &lt;= 4; j++) {       if (direction_arr[i + j] === player) {         you++       } else if (direction_arr[i + j] === -player) {         enemy++       }     }     score += evalff(get_seq(you, enemy));     if ((score &gt;= 800000)) {       return WIN_DETECTED;     }   }   return score }<\/code><\/pre>\n<pre><code class=\"javascript\">function evalff(seq) {     switch (seq) {         case 0:             return 7;         case 1:             return 35;         case 2:             return 800;         case 3:             return 15000;         case 4:             return 800000;         case -1:             return 15;         case -2:             return 400;         case -3:             return 1800;         case -4:             return 100000;         case 17:             return 0;     } }  function get_seq(y, e) {     if (y + e === 0) {         return 0;     }     if (y !== 0 &amp;&amp; e === 0) {         return y     }     if (y === 0 &amp;&amp; e !== 0) {         return -e     }     if (y !== 0 &amp;&amp; e !== 0) {         return 17     } }<\/code><\/pre>\n<h2>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0446\u0435\u043d\u043a\u0438<\/h2>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0446\u0435\u043d\u043a\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043e\u0441\u043a\u0438, \u0433\u0434\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 &#8212; \u044d\u0442\u043e \u043d\u0435\u0431\u043b\u0430\u0433\u043e\u043f\u0440\u0438\u044f\u0442\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430, \u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u043b\u0430\u0433\u043e\u043f\u0440\u0438\u044f\u0442\u043d\u0430\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u043e\u0446\u0435\u043d\u043a\u0430 \u0434\u043e\u0441\u043a\u0438 &#8212; \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0451 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043a\u0435\u0448\u0435. \u041f\u043e\u0437\u0436\u0435, \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0449\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043a\u0435\u0448\u0435 \u0438 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442, \u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c.<\/p>\n<pre><code class=\"javascript\">function evaluate_state(Board, player, hash, restrictions) {     const  black_score = eval_board(Board, -1, restrictions);     const  white_score = eval_board(Board, 1, restrictions);     let score = 0;     if (player == -1) {         score = (black_score - white_score);     } else {         score = (white_score - black_score);     }     StateCache.set(hash,score);      StateCachePuts++;     return score; }<\/code><\/pre>\n<p>eval_board \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e\u0441\u043a\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0441\u0435\u0439 \u0434\u043e\u0441\u043a\u0435 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 score, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0441 \u043e\u0431\u0435\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d (Live) \u0438 \u043f\u043e\u043b\u0443\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 (Dead) \u043b\u0438\u043d\u0438\u0439 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: _xx_ &#8212;<strong><em> <\/em><\/strong><em> <\/em>\u043e\u0442\u043a\u0440\u044b\u0442\u0430\u044f \u0434\u0432\u043e\u0439\u043a\u0430<em>,  <\/em>_oxx_ &#8212; \u043f\u043e\u043b\u0443\u043e\u0442\u043a\u0440\u044b\u0442\u0430\u044f \u0434\u0432\u043e\u0439\u043a\u0430. <\/p>\n<pre><code class=\"javascript\">const LiveOne = 10; const DeadOne = 1; const LiveTwo = 100; const DeadTwo = 10; const LiveThree = 1000; const DeadThree = 100; const LiveFour = 10000; const DeadFour = 1000; const Five = 100000;<\/code><\/pre>\n<h2>Iterative Deepening<\/h2>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043a\u0441\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u044d\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0434\u043e \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.  \u0420\u0435\u0448\u0435\u043d\u0438\u0435 &#8212; \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u044b N, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u044b N+2. (\u041c\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u043d\u0430 2, \u0442.\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430\u0448 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u0438\u043a). \u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u0442\u0435\u0447\u0435\u0442 \u0432\u0440\u0435\u043c\u044f, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f), \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0445\u043e\u0434.  \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f\u0441\u044f \u0432 \u043a\u0435\u0448\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u043f\u043e\u0438\u0441\u043a. <\/p>\n<h2>NegaMax, NegaScout, MTDF<\/h2>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0437\u044f\u0442\u044c \u0438\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/www.chessprogramming.org\/\" rel=\"noopener noreferrer nofollow\">chessprogramming.org<\/a>, \u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0451.  \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0431\u0430\u0433\u0438 \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0438 \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0442\u044c \u0441\u0438\u043b\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<h2>Negamax \u0441 \u0430\u043b\u044c\u0444\u0430-\u0431\u0435\u0442\u0430 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u0439<\/h2>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441 \u043d\u0435\u0433\u043e.<\/p>\n<p>\u0410\u043b\u044c\u0444\u0430-\u0431\u0435\u0442\u0430 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435 &#8212; \u044d\u0442\u043e \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u043c\u043e\u0449\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043a\u0441\u0430, \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0442\u0441\u0432\u043e \u043f\u043e\u0441\u0435\u0449\u044f\u0435\u043c\u044b\u0445 \u043d\u043e\u0434 \u0432 \u0440\u0430\u0437\u044b. Best case &#8212; \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u043b\u0443\u0447\u0448\u0438\u0439 \u0445\u043e\u0434 \u043f\u0435\u0440\u0432\u044b\u043c (<\/p>\n<p>\u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 move ordering).<\/p>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u043b\u0438\u0441\u0442\u044c\u0435\u0432 \u043f\u0440\u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0435 n \u0438 b(\u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u044f) = 40<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"243\" width=\"243\">\n<p>\u0413\u043b\u0443\u0431\u0438\u043d\u0430(n)<\/p>\n<\/td>\n<td data-colwidth=\"250\" width=\"250\">\n<p>Minimax(Alpha-beta pruning <\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\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-317759","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317759","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=317759"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317759\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=317759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=317759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=317759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}