{"id":305581,"date":"2020-06-18T21:00:44","date_gmt":"2020-06-18T21:00:44","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305581"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305581","title":{"rendered":"\u0422\u0435\u0442\u0440\u0438\u0441 \u043d\u0430 \u0431\u0438\u0442\u0431\u043e\u0440\u0434\u0430\u0445: \u0441\u0442\u0430\u0440\u044b\u0435 \u043f\u0435\u0441\u043d\u0438 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u043b\u0430\u0434"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/507156\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9d\/af\/fd\/9daffdhaacnhqxq17ngoqxn02tm.png\" alt=\"image\"><\/p>\n<p>  \u0411\u0438\u0442\u0431\u043e\u0440\u0434\u044b (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Bitboard\" rel=\"nofollow\">Bitboard<\/a>) \u2014 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0445\u043e\u0434\u044b \u0432 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u044b\u0445 \u0438\u0433\u0440\u0430\u0445. \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0440\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0431\u0438\u0442\u0431\u043e\u0440\u0434\u043e\u0432 \u043a <a href=\"https:\/\/habr.com\/ru\/post\/155045\/\">\u0448\u0430\u0445\u043c\u0430\u0442\u0430\u043c<\/a> \u0438 \u0434\u0430\u0436\u0435 \u043a <a href=\"https:\/\/habr.com\/ru\/post\/272815\/\">\u0448\u0430\u0448\u043a\u0430\u043c<\/a>. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u0431\u0438\u0442\u0431\u043e\u0440\u0434\u043e\u0432 \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u0439, \u043d\u043e \u0432\u0441\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0439 \u0438\u0433\u0440\u0435 \u2013 \u043a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tetris\" rel=\"nofollow\">\u0442\u0435\u0442\u0440\u0438\u0441\u0443<\/a>. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043d\u0430\u0448\u0438\u0445 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f \u0438\u0433\u0440\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u0438\u0441\u043a \u043b\u0443\u0447\u0448\u0438\u0445 \u0445\u043e\u0434\u043e\u0432 (\u043f\u0440\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0444\u0438\u0433\u0443\u0440), \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439. \u0417\u0430\u043e\u0434\u043d\u043e \u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u043c \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0445\u043e\u0434\u043e\u0432 \u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0447\u0442\u043e\u0431\u044b \u0432 \u043f\u043e\u043b\u043d\u043e\u0439 \u043c\u0435\u0440\u0435 \u043d\u0430\u0441\u043b\u0430\u0434\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u043e\u043c. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u0430\u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431 \u0441 \u043a\u043e\u0434\u043e\u043c \u0438\u0433\u0440\u044b \u043d\u0430 C#, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u0440\u043e\u0442\u0435\u043d\u044c\u043a\u043e\u0435 \u0432\u0438\u0434\u0435\u043e \u0438\u0433\u0440\u044b \u0438\u0437 114 \u0445\u043e\u0434\u043e\u0432, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u0437\u0430 \u043f\u044f\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0438\u043d\u0443\u0442.<\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u0431\u0438\u0442\u0431\u043e\u0440\u0434 \u2013 \u044d\u0442\u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u0430\u0439\u0442, \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u0438\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u0435 \u043f\u043e\u043b\u044f \u0432 \u0438\u0433\u0440\u0435. \u0422\u0430\u043a, \u0432 \u0448\u0430\u0445\u043c\u0430\u0442\u0430\u0445 \u0432\u0441\u0435\u0433\u043e 64 \u043a\u043b\u0435\u0442\u043a\u0438, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 8-\u0431\u0430\u0439\u0442\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0443 (ulong \u0432 C#), \u0430 \u0432 \u0448\u0430\u0448\u043a\u0430\u0445 \u2013 32 (uint \u0432 C#). \u041b\u044e\u0431\u0438\u0442\u0435\u043b\u0438 \u0442\u0435\u0442\u0440\u0438\u0441\u0430 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043f\u043e\u043c\u043d\u044f\u0442, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u043b\u044f \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0442\u0435\u0442\u0440\u0438\u0441\u0435 \u2013 10 \u043d\u0430 20 \u043a\u043b\u0435\u0442\u043e\u043a, \u0442\u043e \u0435\u0441\u0442\u044c, 200 \u0431\u0438\u0442, \u0447\u0442\u043e \u043d\u0435 \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u043d\u0438 \u0432 \u043e\u0434\u0438\u043d \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0442\u0438\u043f. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043f\u043e\u043b\u0435 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u043e\u0441\u044c\u043c\u0438\u0431\u0430\u0439\u0442\u043d\u044b\u0445 \u0441\u043b\u043e\u0432\u0430, \u0438\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043c\u0435\u043b\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u0438 \u0434\u0432\u0443\u0445\u0431\u0430\u0439\u0442\u043d\u044b\u0445 \u0441\u043b\u043e\u0432, \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u043b\u0438\u043d\u0438\u044e \u043f\u043e\u043b\u044f; \u0432\u0441\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u0442\u0440\u0438\u0441\u0430 \u043d\u0430 \u0431\u0438\u0442\u0431\u043e\u0440\u0434\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0430\u0448\u0435\u043b (\u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0434\u043d\u043e\u0439 \u0448\u0442\u0443\u043a\u0438), \u0442\u0430\u043a \u0438 \u0434\u0435\u043b\u0430\u044e\u0442. \u041d\u043e \u043c\u044b \u043f\u043e\u0439\u0434\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0435\u043c\u2026<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0412\u0435\u043a\u0442\u043e\u0440\u044b<\/h3>\n<p>  \u041c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2\" rel=\"nofollow\">Advanced Vector Extensions 2<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/505606\/\">\u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437<\/a> \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041e\u043d\u0438 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u044e\u0442 256-\u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 (\u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0441 64-\u0431\u0438\u0442\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438):  <\/p>\n<pre><code class=\"cs\">\/\/ \u041e\u0431\u044b\u0447\u043d\u044b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b, 8 \u0431\u0430\u0439\u0442 ulong      x = 0,     y = 0,     z = x &amp; y; \/\/ z[i] = x[i] &amp; y[i], i = 0..7 \/\/ SIMD-\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b, 32 \u0431\u0430\u0439\u0442\u0430 Vector256&lt;byte&gt;      X = Vector256&lt;byte&gt;.Zero,     Y = Vector256&lt;byte&gt;.Zero,     Z = Avx2.And(X, Y); \/\/ Z[i] = X[i] &amp; Y[i], i = 0..31 <\/code><\/pre>\n<p>  \u041d\u0430\u0434\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0432\u044b\u0437\u043e\u0432\u044b \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e; \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043d\u0435 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u043c\u0435\u044e\u0442 \u043f\u0440\u044f\u043c\u044b\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438 \u0432 AVX2, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <s>\u0438\u0437\u043e\u043b\u0435\u043d\u0442\u043e\u0439<\/s> \u043c\u043e\u0449\u044c\u044e c# \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u044e\u0449\u0443\u044e 256-\u0431\u0438\u0442\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u0442\u0438\u043b\u0435:  <\/p>\n<pre><code class=\"cs\">V256 X = 0, Y = 0, Z = X &amp; Y;<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u0434 \u0438\u043c\u0435\u043b \u0441\u043c\u044b\u0441\u043b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c V256 \u043a\u0430\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0445\u0440\u0430\u043d\u044f\u0449\u0443\u044e \u0432\u043d\u0443\u0442\u0440\u0438 256-\u0431\u0438\u0442\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u043d\u0435\u044f\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432:  <\/p>\n<pre><code class=\"cs\">readonly unsafe struct V256 {     private readonly Vector256&lt;byte&gt; _data;      public V256(Vector256&lt;byte&gt; data) { _data = data; }      \/\/ \u043d\u0435\u0432\u044f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442 Vector&lt;256&gt;:     \/\/ \u0432\u043c\u0435\u0441\u0442\u043e V256 x = new V256(data) \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e V256 x = data     public static implicit operator V256(Vector256&lt;byte&gt; data) =&gt; new V256(data);      \/\/ \u041f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c x &amp; y     public static V256 operator &amp;(V256 x, V256 y) =&gt; Avx2.And(x._data, y._data);      \/\/ \u043d\u0435\u0432\u044f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442 \u0431\u0430\u0439\u0442\u0430: \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c V256 x = 42;     public static implicit operator V256(byte b) =&gt; Avx2.BroadcastScalarToVector256(&amp;b);      ... } <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. \u041f\u043e\u0441\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u2014 \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435,   <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0441\u043f\u0440\u044f\u0447\u0435\u043c \u0435\u0433\u043e \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">\/\/ \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u043c readonly, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c JIT-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 readonly unsafe struct V256 {     \/\/ \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c AVX2     static V256() { if (!Avx2.IsSupported) throw new NotSupportedException(&quot;AVX2&quot;); }      \/\/ \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u044f\u0432\u043d\u044b\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0431\u0430\u0439\u0442\u0430 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0442\u0438\u043f\u0443, \u0441\u043c. \u043d\u0438\u0436\u0435     public static readonly V256 ZERO = 0;      \/\/ \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435. JIT-\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0438\u0445 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c,     \/\/ \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 256-\u0431\u0438\u0442\u043d\u044b\u0445      \/\/ \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 YMM0 - YMM15     private readonly Vector256&lt;byte&gt; _data;      \/\/ \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c 32 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438     public V256(byte* b) { _data = Avx2.LoadVector256(b); }      \/\/ \u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u043e 32 \u0431\u0430\u0439\u0442 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435     public V256(params byte[] buffer)     {         if (buffer.Length &lt; 32) Array.Resize(ref buffer, 32);         fixed (byte* p = buffer) _data = Avx2.LoadVector256(p);     }      \/\/ \u0410 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435     \/\/ \u043d\u0430 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e unmanaged, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u0438\u043f\u043e\u043c T     \/\/ \u043a\u0430\u043a \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0431\u0430\u0439\u0442. \u0412\u0441\u0435 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b (int, uint, long, ulong,     \/\/ \u0438 \u0442.\u0434.) \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u044d\u0442\u043e\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u044e     public static V256 Load&lt;T&gt;(params T[] buffer) where T : unmanaged     {         fixed (T* p = buffer) return new V256((byte*)p);     }      public void Store&lt;T&gt;(T[] buffer) where T : unmanaged     {         fixed (T* p = buffer) Avx2.Store((byte*)p, _data);     }      public T[] ToArray&lt;T&gt;() where T : unmanaged     {         T[] array = new T[32 \/ sizeof(T)];         fixed (T* ptr = array) Avx2.Store((byte*)ptr, _data);         return array;     }      \/\/ \u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0443\u0446\u0438\u044f broadcast \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0440\u0430\u0437     \/\/ \u0442\u043e \u0435\u0441\u0442\u044c, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 32 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0431\u0430\u0439\u0442\u0430 b     public static V256 FromByte(byte b) =&gt;         Avx2.BroadcastScalarToVector256(&amp;b);     \/\/ \u0438\u043b\u0438 16 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 short-\u0430 s     public static V256 FromShort(short s) =&gt;         Avx2.BroadcastScalarToVector256(&amp;s).AsByte();     \/\/ \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0441 \u043b\u044e\u0431\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438     public static V256 FromULong(ulong ul) =&gt;         Avx2.BroadcastScalarToVector256(&amp;ul).AsByte();      \/\/ \u043d\u0435\u0432\u044f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442 \u0431\u0430\u0439\u0442\u0430: \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c V256 x = 42;     public static implicit operator V256(byte b) =&gt; FromByte(b);      \/\/ \u041e\u0441\u043e\u0431\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 AVX2     \/\/ \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0431\u0430\u0439\u0442\u0443, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e result[i] =      \/\/ Math.Min(this[i], other[i]), i=0..31, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 100 \u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435     public V256 Min(V256 other) =&gt; Avx2.Min(_data, other._data);     \/\/ \u0430\u043d\u0430\u043b\u043e\u0433 table lookup: result[i] = this[data[i]], i = 0..31     public V256 Shuffle(V256 mask) =&gt; Avx2.Shuffle(_data, mask._data);     \/\/ \u0430\u043d\u0430\u043b\u043e\u0433 result[i] = this[i] == other[i] ? 0xFF : 0x00;     public V256 CompareEqual(V256 other) =&gt; Avx2.CompareEqual(_data, other._data);          \/\/ \u041f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c x &amp; y, x | y \u0438 \u0442.\u043f.      public static V256 operator &amp;(V256 x, V256 y) =&gt; Avx2.And(x._data, y._data);     public static V256 operator |(V256 x, V256 y) =&gt; Avx2.Or(x._data, y._data);     public static V256 operator +(V256 x, V256 y) =&gt; Avx2.Add(x._data, y._data);     public static V256 operator -(V256 x, V256 y) =&gt; Avx2.Subtract(x._data, y._data);     public static V256 operator -(V256 x) =&gt; Avx2.Subtract(ZERO._data, x._data);      \/\/ \u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u0434\u0432\u0430 256-\u0431\u0438\u0442\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.     \/\/ \u0420\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u043d\u0430 \u0437\u0430\u043c\u0435\u043d\u0443 AVX2 \u043f\u0440\u0438\u0434\u0435\u0442 AVX512, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f     \/\/ \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043d\u043e \u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a:     public static bool operator ==(V256 x, V256 y) =&gt;         -1 == Avx2.MoveMask(Avx2.CompareEqual(x._data, y._data));      \/\/ \u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0445\u0438\u0442\u0440\u043e\u0435 - \u044d\u0442\u043e \u0441\u0434\u0432\u0438\u0433. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u043a     \/\/ \u043e\u0434\u043d\u043e 256-\u0431\u0438\u0442\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e (\u0430 \u0432\u043e\u0442 \u0432 AVX512, \u043f\u043e \u0441\u043b\u0443\u0445\u0430\u043c, \u0431\u0443\u0434\u0435\u0442 \u043c\u043e\u0436\u043d\u043e!), \u043f\u043e\u044d\u0442\u043e\u043c\u0443     \/\/ \u0438\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f:     public static V256 operator &gt;&gt;(V256 x, int count)     {         \/\/ \u0441\u0434\u0432\u0438\u043d\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u0430\u043a 4 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 8-\u0431\u0430\u0439\u0442\u043d\u044b\u0445 \u0441\u043b\u043e\u0432\u0430         Vector256&lt;ulong&gt; data = Avx2.ShiftRightLogical(              x._data.AsUInt64(), (byte)count);         \/\/ \u0430 \u044d\u0442\u0438 \u0431\u0438\u0442\u044b \u043c\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0441\u0434\u0432\u0438\u0433\u0435         Vector256&lt;ulong&gt; carry = Avx2.ShiftLeftLogical(             x._data.AsUInt64(), (byte)(64 - count));         \/\/ \u0432\u0437\u0431\u043e\u043b\u0442\u0430\u0442\u044c...         carry = Avx2.Permute4x64(carry, 0x39);         \/\/ \u043d\u043e \u043d\u0435 \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u0442\u044c!         carry = Avx2.Blend(ZERO._data.AsUInt32(), carry.AsUInt32(), 0x3F).AsUInt64();         data = Avx2.Or(data, carry);         return data.AsByte();     }      \/\/ \u0420\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u0430, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0430.     \/\/ \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435: \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435     \/\/ \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0430,     \/\/ \u043d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043f\u0430\u0441\u0442\u0438 \u043d\u0430\u0441.     public override string ToString()     {         byte* buffer = stackalloc byte[32];         Avx2.Store(buffer, _data);         return string.Join(&quot; &quot;, Enumerable.Range(0, 32).Select(i =&gt; buffer[i].ToString(&quot;X2&quot;)));     } } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>\u043f\u043e\u043b\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f: <a href=\"https:\/\/github.com\/lightln2\/Tetriss\/blob\/master\/Tetriss\/V256.cs\" rel=\"nofollow\">V256.cs<\/a>.<\/p>\n<p>  \u041c\u044b \u043f\u043e\u0447\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u043d\u0430\u0447\u0430\u0442\u044c-\u0442\u0430\u043a\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0442\u0440\u0438\u0441, \u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u044b!  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0411\u0435\u0437 \u043d\u0438\u0445 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0430 \u043c\u044b \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043e\u0439\u043c\u0435\u043c, \u043f\u043e\u0447\u0435\u043c\u0443<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">[TestClass] public class V256Tests {     [TestMethod]     public void V256_ToString()     {         Assert.AreEqual(             &quot;05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 &quot; +             &quot;05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05&quot;,             ((V256)5).ToString());     }      [TestMethod] public void V256_And() =&gt;          Assert.AreEqual((V256)4, (V256)5 &amp; (V256)6);      [TestMethod]     public void V256_ShiftRight()     {         V256 y = new V256(             0xF1, 0x18, 0x80, 0x01, 0x18, 0x80, 0x01, 0x18,             0x80, 0x01, 0x18, 0x80, 0x01, 0x18, 0x80, 0x01,             0x18, 0x80, 0x01, 0x18, 0x80, 0x01, 0x18, 0x80,             0x01, 0x18, 0x80, 0x01, 0x18, 0x80, 0xFF, 0x0F);         Assert.AreEqual(             &quot;01 18 80 01 18 80 01 18 80 01 18 80 01 18 80 01 &quot; +             &quot;18 80 01 18 80 01 18 80 01 18 80 01 F8 FF 00 00&quot;,             (y &gt;&gt; 12).ToString());     } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h3>\u0422\u0435\u0442\u0440\u0438\u0441<\/h3>\n<p>  \u041d\u0443, \u0442\u0435\u043f\u0435\u0440\u044c-\u0442\u043e \u043c\u044b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0442\u0440\u0438\u0441! \u0418 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435, \u0438 \u0444\u0438\u0433\u0443\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 V256. \u041a\u043e\u0433\u0434\u0430 \u0444\u0438\u0433\u0443\u0440\u044b \u043f\u0430\u0434\u0430\u044e\u0442 \u0432\u043d\u0438\u0437, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u0438\u0442\u044b \u043f\u043e\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1. \u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0432\u0441\u0435\u0433\u043e 10&#215;20=200 \u0431\u0430\u0439\u0442, \u0430 \u0432 V256 \u0438\u0445 256, \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f 56 \u0431\u0430\u0439\u0442 \u043c\u044b \u043c\u043e\u0436\u0435\u043c <s>\u043f\u0440\u043e\u043f\u0438\u0442\u044c<\/s> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0431\u043b\u0430\u0433\u043e\u0435 \u0434\u0435\u043b\u043e. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u0435 \u0441\u043b\u0435\u0432\u0430 \u0438 \u0441\u043f\u0440\u0430\u0432\u0430 \u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u043b\u0438\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u043c\u0438. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u044b\u0445\u043e\u0434\u0430 \u0444\u0438\u0433\u0443\u0440\u044b \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u043e\u043b\u044f \u0441\u043b\u0435\u0432\u0430 \u0438 \u0441\u043f\u0440\u0430\u0432\u0430. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u043b\u0438\u043d\u0438\u044e, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0432\u044b\u0445\u043e\u0434\u0430 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u043e\u043b\u044f \u0441\u043d\u0438\u0437\u0443. \u0422\u0430\u043a \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 21 \u043b\u0438\u043d\u0438\u044f \u043f\u043e 12 \u0431\u0438\u0442, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 252 \u0431\u0438\u0442\u0430, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f 4 \u0431\u0438\u0442\u0430 \u043d\u0430 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bs\/39\/oi\/bs39oig4ymw9abijpeqzzlpvfag.png\" alt=\"image\" align=\"left\"><br \/>  \u0412\u043e\u0442 \u0431\u0438\u0442\u0431\u043e\u0440\u0434 \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f; \u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0431\u0430\u0439\u0442\u044b (\u0438\u0434\u0443\u0442 \u043f\u0435\u0440\u0432\u044b\u043c\u0438, \u0438\u0431\u043e little endian) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432\u0435\u0440\u0445\u043d\u0438\u043c \u043b\u0438\u043d\u0438\u044f\u043c; \u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u2014 \u043d\u0438\u0436\u043d\u0438\u043c; \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0431\u0438\u0442\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"cs\">V256 board = new V256(         1, 24, 128, 1, 24, 128, 1, 24,         128, 1, 24, 128, 1, 24, 128, 1,         24, 128, 1, 24, 128, 1, 24, 128,         1, 24, 128, 1, 24, 128, 255, 15); <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sb\/ys\/a6\/sbysa6lgri0r3lpqyh9rxvc6w6u.png\" alt=\"image\" align=\"left\"> \u0410 \u0432\u043e\u0442 T-\u0444\u0438\u0433\u0443\u0440\u0430 \u0432\u043e \u0432\u0441\u0435\u0445 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445, \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430:  <\/p>\n<pre><code class=\"cs\">\/\/ possible pieces with rotations V256[][] PIECES = new V256[][] { ...,     new[] { \/\/ T-shape             new V256(224, 0, 2),             new V256(96, 0, 4, 64),             new V256(64, 0, 7),             new V256(32, 0, 2, 96),     }, ...  }; <\/code><\/pre>\n<p>  \u041f\u0430\u0434\u0430\u044e\u0449\u0443\u044e \u0444\u0438\u0433\u0443\u0440\u043a\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0441\u0435\u0445 \u0435\u0435 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439, \u043f\u043b\u044e\u0441 \u0438\u043d\u0434\u0435\u043a\u0441, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0431\u0440\u0430\u043d:  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0422\u0443\u0442 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">    \/\/ \u0412\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0444\u0438\u0433\u0443\u0440\u043a\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0430\u0434\u0430\u044e\u0442 \u0432\u043d\u0438\u0437.     \/\/ \u041a\u043e\u0433\u0434\u0430 \u0438\u0433\u0440\u043e\u043a \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0444\u0438\u0433\u0443\u0440\u043a\u0443,     \/\/ \u043c\u0435\u043d\u044f\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0444\u0438\u0433\u0443\u0440\u043a\u0430      \/\/ \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c \u043f\u043e\u043b\u044f.     V256[] fallingPiece = new V256[4];     \/\/ \u043e\u0442 1 \u0434\u043e 4     int rotationsCount;     \/\/ \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e     int fallingPieceRotation;     \/\/ \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0444\u0438\u0433\u0443\u0440\u043a\u0438     V256 FallingPiece =&gt; fallingPiece[fallingPieceRotation % rotationsCount];      \/\/ \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0444\u0438\u0433\u0443\u0440\u043e\u043a \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430, \u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430 ;-)     Random rand = new Random(12345);     \/\/ \u043d\u043e\u0432\u0430\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0444\u0438\u0433\u0443\u0440\u043a\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u0435\u0440\u0445\u0443!     void SelectNextPiece() =&gt; SelectPiece(rand.Next(0, PIECES.Length));     \/\/ \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u044b \u044d\u0442\u043e\u0439 \u0444\u0438\u0433\u0443\u0440\u043a\u0438 \u0438\u0437 \u0431\u0430\u0437\u044b \u0444\u0438\u0433\u0443\u0440\u043e\u043a     void SelectPiece(int index)     {         fallingPieceRotation = 0;         rotationsCount = PIECES[index].Length;         Array.Copy(PIECES[index], fallingPiece, rotationsCount);     }      \/\/ \u043a\u0440\u0443\u0442\u0438\u043c \u0438 \u0432\u0435\u0440\u0442\u0438\u043c     void RotateLeft() =&gt; Rotate(1);     void RotateRight() =&gt; Rotate(-1);     bool MoveDown() =&gt; ShiftLeft(width);     bool MoveRight() =&gt; ShiftLeft(1);     bool MoveLeft() =&gt; ShiftRight(-1);      bool Rotate(int count)     {         \/\/ \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432 \u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443, \u0432\u044b\u0431\u0438\u0440\u0430\u044f \u043d\u0443\u0436\u043d\u044b\u0439          \/\/ \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430         fallingPieceRotation += count;         \/\/ \u0441\u043a\u043e\u0440\u043e \u0443\u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f         if (!Intersects(bord, FallingPiece)) return true;         \/\/ \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c, \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e!         fallingPieceRotation -= count;         return false;     }      bool ShiftLeft(int count)     {         \/\/ \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043b\u0438 \u043d\u0430\u043c \u0447\u0435\u0433\u043e         if (Intersects(board, ShiftLeft(FallingPiece, count)) return false;         \/\/ \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0441\u0434\u0432\u0438\u0433\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e!         for (int i = 0; i &lt; rotationsCount; i++)              fallingPiece[i] = ShiftLeft(fallingPiece[i], count);     } } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041d\u0443 \u0430 \u0442\u0435\u043f\u0435\u0440\u044c <s>\u0440\u0430\u0437\u043c\u0430\u0445\u043d\u0438\u0441\u044c \u0440\u0443\u043a\u0430, \u0440\u0430\u0437\u0437\u0443\u0434\u0438\u0441\u044c \u043f\u043b\u0435\u0447\u043e<\/s> \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0442\u0430\u043c\u0438!<br \/>  \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0435\u0442\u043e\u043a \u043f\u043e\u043b\u044f \u0438 \u0444\u0438\u0433\u0443\u0440\u044b, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u0443 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"cs\">bool Intersects(V256 board, V256 piece) =&gt; (piece &amp; board) != 0;<\/code><\/pre>\n<p>  \u0421\u0434\u0432\u0438\u0433 \u0444\u0438\u0433\u0443\u0440\u043a\u0438 \u0432\u043d\u0438\u0437, \u0432\u043b\u0435\u0432\u043e \u0438\u043b\u0438 \u0432\u043f\u0440\u0430\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0441\u0434\u0432\u0438\u0433\u043e\u043c \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0442 (\u0437\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0441\u0434\u0432\u0438\u0433 \u0444\u0438\u0433\u0443\u0440\u044b \u0432\u043f\u0440\u0430\u0432\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0434\u0432\u0438\u0433\u043e\u043c \u0435\u0435 \u0431\u0438\u0442\u043e\u0432 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0441\u0434\u0432\u0438\u0433\u0443 \u0431\u0438\u0442\u043e\u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0432\u043b\u0435\u0432\u043e):  <\/p>\n<pre><code class=\"cs\">const int width = 12; \/\/ \u0448\u0438\u0440\u0438\u043d\u0430 \u043f\u043e\u043b\u044f \u0432 \u0431\u0438\u0442\u0430\u0445  V256 MoveDown(V256 piece) =&gt; piece &lt;&lt;= width;  V256 MoveRight(V256 piece) =&gt; piece &lt;&lt;= 1;  V256 MoveLeft(V256 piece) =&gt; piece &gt;&gt;= 1;  \/\/ \u0447\u0442\u043e\u0431\u044b \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0444\u0438\u0433\u0443\u0440\u043a\u0443 \u0432 \u0441\u0430\u043c\u044b\u0439 \u043d\u0438\u0437, \/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0435\u0435, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0442\u044b\u043a\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u0435 V256 Drop(V256 piece) {     while(!Intersects(board, MoveDown(piece)) piece = MoveDown(piece);     return piece; } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u0433\u0440\u0430 \u0443 \u043d\u0430\u0441 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f, \u043d\u0430\u0434\u043e \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u043f\u043e\u043b\u0435 \u0438 \u043f\u0430\u0434\u0430\u044e\u0449\u0443\u044e \u0444\u0438\u0433\u0443\u0440\u043a\u0443:  <\/p>\n<pre><code class=\"cs\">void DisplayField() {     V256 field = board | FallingPiece; \/\/ \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u043c \u0438 \u043f\u043e\u043b\u0435, \u0438 \u0444\u0438\u0433\u0443\u0440\u043a\u0443 \u0441\u0440\u0430\u0437\u0443     while (field != 0) \/\/ \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 \u043b\u0438\u043d\u0438\u0438 \u043f\u043e\u043b\u044f, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0445\u043d\u0435\u0439     {         Console.WriteLine(GetLine(field));         field &gt;&gt;= width; \/\/ \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u0434\u0432\u0438\u0433\u043e\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043b\u0438\u043d\u0438\u0438     } } \/\/ \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044f AVX2-\u043c\u0430\u0433\u0438\u044e, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0431\u0438\u0442\u044b \u0432 \u0431\u0430\u0439\u0442\u044b,  \/\/ \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0443\u0441\u0442\u044b\u043c \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u043c \u043a\u043b\u0435\u0442\u043a\u0430\u043c V256 tile = new V256(' ' &amp; 255, '*' &amp; 255); V256 lineToStringShuffler = new V256(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1); V256 lineToStringMask = new V256(1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8); \/\/ \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e string GetLine(V256 field) {     V256 line = field.Shuffle(lineToStringShuffler) &amp; lineToStringMask;     line = line.Min(V256.ONE);     line = tile.Shuffle(line);     return Encoding.ASCII.GetString(line.ToArray&lt;byte&gt;(), 0, width); } <\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0430\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438 \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0445. \u0422\u0443\u0442 \u0431\u0435\u0437 \u0446\u0438\u043a\u043b\u0430 \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u043c\u043d\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0435 \u043f\u043e \u043b\u0438\u043d\u0438\u044f\u043c \u0441\u043d\u0438\u0437\u0443 \u0432\u0432\u0435\u0440\u0445, \u0438 \u0431\u0438\u0442\u043e\u0432\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u043b\u0438\u043d\u0438\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0430. \u0427\u0442\u043e\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u043b\u0438\u043d\u0438\u044e \u0438\u0437 \u043f\u043e\u043b\u044f, \u0431\u0438\u0442\u043e\u0432\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043e\u0431\u043d\u0443\u043b\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043b\u0438\u043d\u0438\u044e \u0432 \u043f\u043e\u043b\u0435, \u0438 \u0441\u0434\u0432\u0438\u043d\u0435\u043c \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c \u043a \u043d\u0438\u0436\u043d\u0435\u0439:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mr\/7m\/up\/mr7mupn8xgexyxfgx4kdjpavsz0.png\" alt=\"image\" align=\"right\"><\/p>\n<pre><code class=\"cs\">while (lineMask != 0) {     V256 boardLine = board &amp; lineMask;     V256 boardUnderLine = board &amp; underLineMask;     V256 boardOverLine =          board &amp; ~underLineMask &amp; ~lineMask;     if(boardLine == lineMask)         \/\/ \u0432\u044b\u0440\u0435\u0437\u0430\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u043b\u0438\u043d\u0438\u044e          \/\/\u0438\u0437 \u043f\u043e\u043b\u044f \u0438 \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a         board = boardUnderLine |                 (boardOverLine &lt;&lt; width) |                 emptyLine;     \/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043c\u0430\u0441\u043a\u0443 \u043d\u0430 \u043e\u0434\u043d\u0443 \u043b\u0438\u043d\u0438\u044e \u0432\u0432\u0435\u0440\u0445     underLineMask |= lineMask;     lineMask &gt;&gt;= width; } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041c\u0435\u0442\u043e\u0434 \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">V256 fullLine = new V256(0, 0, 0, ..., 0, 0, 255, 15); V256 emptyLine = new V256(1, 8);  void RemoveFullLines(ref V256 board) {     \/\/ \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043c\u0430\u0441\u043a\u0443 \u0441 \u043d\u0438\u0436\u043d\u0435\u0439 \u043b\u0438\u043d\u0438\u0438     V256 lineMask = fullLine &gt;&gt; width;     \/\/ \u043c\u0430\u0441\u043a\u0430 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e\u043b\u044f \u043f\u043e\u0434 \u044d\u0442\u043e\u0439 \u043b\u0438\u043d\u0438\u0435\u0439     V256 underLineMask = fullLine;     while (lineMask != 0)     {         \/\/ \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0447\u0442\u043e \u043b\u0438\u043d\u0438\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0430         while ((board &amp; lineMask) == lineMask)         {             \/\/ \u0432\u044b\u0440\u0435\u0437\u0430\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u043b\u0438\u043d\u0438\u044e \u0438\u0437 \u043f\u043e\u043b\u044f \u0438 \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a             board = (board &amp; underLineMask) |                          ((board &amp; ~underLineMask &amp; ~lineMask) &lt;&lt; width) |                          emptyLine;         }         \/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043c\u0430\u0441\u043a\u0443 \u043d\u0430 \u043e\u0434\u043d\u0443 \u043b\u0438\u043d\u0438\u044e \u0432\u0432\u0435\u0440\u0445         underLineMask |= lineMask;         lineMask &gt;&gt;= width;     } } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0439 \u0438\u0433\u0440\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e, \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043d\u0430\u043c\u0435\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043f\u0435\u0440\u0438\u043f\u0435\u0442\u0438\u0438:  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0438\u0433\u0440\u044b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">    void PlayGame()     {         SelectNextPiece();          while (!Intersects(FallingPiece))         {             DisplayField();              for (int i = 0; i &lt; 10; i++)             {                 Control();                 Thread.Sleep(100);             }              if (!MoveDown())             {                 AddPieceToBoard();                 RemoveFullLines();                 SelectNextPiece();                 continue;             }         }         DisplayField();     }      void Control()     {         if (Console.KeyAvailable)         {             ConsoleKeyInfo key = Console.ReadKey(false);             if (key.Key == ConsoleKey.UpArrow) RotateLeft();             else if (key.Key == ConsoleKey.DownArrow) RotateRight();             else if (key.Key == ConsoleKey.LeftArrow) MoveLeft();             else if (key.Key == ConsoleKey.RightArrow) MoveRight();             else if (key.Key == ConsoleKey.Spacebar) while (MoveDown()) ;             while (Console.KeyAvailable) Console.ReadKey();             DisplayField();         }     } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0410 \u0432\u043e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430: <a href=\"https:\/\/github.com\/lightln2\/Tetriss\/blob\/master\/Tetriss\/Tetris.cs\" rel=\"nofollow\">Tetris.cs<\/a><\/p>\n<h3>\u041f\u043e\u0438\u0441\u043a \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438<\/h3>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0440\u0430\u0434\u0438 \u0441\u0430\u043c\u043e\u0439 \u0438\u0433\u0440\u044b \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u044d\u0442\u0438 \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u0442\u0440\u044e\u043a\u0438 \u043d\u0435 \u0438\u043c\u0435\u043b\u043e \u0431\u044b \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430. \u0417\u0430\u0442\u043e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u2014 \u0441\u0430\u043c\u043e\u0435 \u0442\u043e! \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u0438\u0441\u043a\u0430 \u2014 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0432\u0433\u043b\u0443\u0431\u044c \u043f\u043e\u043b\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c: \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0444\u0438\u0433\u0443\u0440\u043e\u043a \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0430, \u0442\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0438\u0433\u0443\u0440\u043a\u0438 \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0435\u0435 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0434\u0432\u0438\u0433\u043e\u0432. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b. \u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0435\u043d:  <\/p>\n<pre><code class=\"cs\">void Solve() =&gt; Solve(Tetris.board, 0, 0);   \/\/ \u0438\u0449\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c \u043d\u0430 \u0448\u0430\u0433\u0435 step void Solve(V256 board, int step, int score) {     \/\/ \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0438\u0433\u0443\u0440\u043a\u0443     int pieceIndex = pieceOrder[step];     V256[] currentPieceRotations = Tetris.PIECES[pieceIndex];     \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f     foreach (V256 piece in currentPieceRotations)     {         \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u0441\u0435 \u0441\u0434\u0432\u0438\u0433\u0438 (\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a)         Solve(board, piece, step, score);         for(int i = 1; i &lt;= 5; i++)          {             Solve(board, piece &lt;&lt; i, step, score);             Solve(board, piece &gt;&gt; i, step, score);         }     } }  void Solve(V256 board, V256 piece, int step, int score) {     if ((piece &amp; board) != 0) return; \/\/ \u0444\u0438\u0433\u0443\u0440\u043a\u0430 \u043d\u0435 \u0432\u043b\u0435\u0437\u043b\u0430!     \/\/ \u0431\u0440\u043e\u0441\u0430\u0435\u043c \u0444\u0438\u0433\u0443\u0440\u043a\u0443 \u0432\u043d\u0438\u0437     while ((board &amp; (piece &lt;&lt; Tetris.width)) == 0) piece &lt;&lt;= Tetris.width;     board |= piece; \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u0438\u0433\u0443\u0440\u043a\u0443 \u043d\u0430 \u043f\u043e\u043b\u0435!     Tetris.RemoveFullLines(ref board, ref score); \/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438     if(score &gt; maxScore) {...} \/\/ \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u043a\u043e\u0440\u0434!     \/\/ \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0438\u0441\u043a \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430     Solve(board, step + 1, score); } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434: <a href=\"https:\/\/github.com\/lightln2\/Tetriss\/blob\/master\/Tetriss\/TetrisSolver.cs\" rel=\"nofollow\">TetrisSolver.cs<\/a><\/p>\n<h3> \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <\/h3>\n<p>  \u041f\u043e\u0438\u0441\u043a \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0432\u0435\u0449\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0430\u0441\u0442\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0448\u0430\u0433\u043e\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u043a\u043e\u043b\u043e 15 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0448\u0430\u0433\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 (\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0441\u0430\u043c \u0441\u0435\u0431\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043c \u0441\u0430\u043c \u0436\u0435 \u0433\u0435\u0440\u043e\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0435\u0448\u0430\u0435\u0442). \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:  <\/p>\n<pre><code class=\"plaintext\">C:\\Tetris\\bin\\Release\\netcoreapp3.1&gt;tetris -solve 1000 ... Processed 12,000,000,000 moves at 00:12:51 (15.56 M moves\/second) new max score=57 at depth 114 after processing 12,475,091,815 moves at 00:13:22   0:0 0:0 0:0 ... 0:4 0:3 0:-2 0:2 0:-2 3:-4 new max score=58 at depth 114 after processing 12,475,143,842 moves at 00:13:22   0:0 0:0 0:0 ... 1:-2 0:-2 0:-3 1:3 1:4 1:2 3:0 Processed 13,000,000,000 moves at 00:13:57 (15.53 M moves\/second) <\/code><\/pre>\n<p>  \u0410 \u0432\u043e\u0442 \u0432\u0438\u0434\u0435\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f:  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0438\u0433\u0440\u0430\u0435\u0442 \u0432 \u0442\u0435\u0442\u0440\u0438\u0441<\/b>                         <\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vx\/ap\/md\/vxapmd5wnzsuokwng1uts-8uc04.gif\" alt=\"image\" align=\"left\"><\/p>\n<pre><code class=\"cs\">dotnet run -c Release -p Tetriss -replay &quot;0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:-3 0:3 0:-3 0:-2 0:3 0:-4 0:4 0:3 0:3 0:0 0:3 0:1 0:-3 0:3 0:-2 2:-3 0:-1 3:-4 2:-2 1:4 0:1 0:2 0:-4 1:4 0:2 0:-2 0:0 0:-3 0:-3 1:0 1:4 3:-4 1:4 1:2 0:0 0:-2 0:1 1:-4 0:0 0:-2 0:-4 0:4 1:2 1:4 1:4 1:-5 0:0 0:4 1:-4 0:-2 0:1 1:4 0:1 0:-1 1:3 2:2 0:0 1:-4 3:-1 2:4 1:-2 0:1 3:3 0:-3 1:1 3:-4 3:0 1:4 1:2 1:1 1:-4 1:-4 0:-2 0:1 1:4 3:-1 0:2 1:3 1:-5 1:4 0:1 1:-4 0:-2 1:4 1:2 0:2 1:4 1:0 0:-2 0:2 0:1 1:-4 0:1 0:1 1:4 1:-2 1:-2 0:-2 0:-3 1:3 1:4 1:2 3:0&quot;<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041a\u043e\u0434 <a href=\"https:\/\/github.com\/lightln2\/Tetriss\" rel=\"nofollow\">\u0432\u044b\u043b\u043e\u0436\u0435\u043d \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431<\/a>.<\/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\/507156\/\"> https:\/\/habr.com\/ru\/post\/507156\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/507156\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9d\/af\/fd\/9daffdhaacnhqxq17ngoqxn02tm.png\" alt=\"image\"><\/p>\n<p>  \u0411\u0438\u0442\u0431\u043e\u0440\u0434\u044b (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Bitboard\" rel=\"nofollow\">Bitboard<\/a>) \u2014 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0445\u043e\u0434\u044b \u0432 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u044b\u0445 \u0438\u0433\u0440\u0430\u0445. \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0440\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0431\u0438\u0442\u0431\u043e\u0440\u0434\u043e\u0432 \u043a <a href=\"https:\/\/habr.com\/ru\/post\/155045\/\">\u0448\u0430\u0445\u043c\u0430\u0442\u0430\u043c<\/a> \u0438 \u0434\u0430\u0436\u0435 \u043a <a href=\"https:\/\/habr.com\/ru\/post\/272815\/\">\u0448\u0430\u0448\u043a\u0430\u043c<\/a>. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u0431\u0438\u0442\u0431\u043e\u0440\u0434\u043e\u0432 \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u0439, \u043d\u043e \u0432\u0441\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0439 \u0438\u0433\u0440\u0435 \u2013 \u043a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tetris\" rel=\"nofollow\">\u0442\u0435\u0442\u0440\u0438\u0441\u0443<\/a>. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043d\u0430\u0448\u0438\u0445 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f \u0438\u0433\u0440\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u0438\u0441\u043a \u043b\u0443\u0447\u0448\u0438\u0445 \u0445\u043e\u0434\u043e\u0432 (\u043f\u0440\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0444\u0438\u0433\u0443\u0440), \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439. \u0417\u0430\u043e\u0434\u043d\u043e \u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u043c \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0445\u043e\u0434\u043e\u0432 \u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0447\u0442\u043e\u0431\u044b \u0432 \u043f\u043e\u043b\u043d\u043e\u0439 \u043c\u0435\u0440\u0435 \u043d\u0430\u0441\u043b\u0430\u0434\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u043e\u043c. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u0430\u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431 \u0441 \u043a\u043e\u0434\u043e\u043c \u0438\u0433\u0440\u044b \u043d\u0430 C#, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u0440\u043e\u0442\u0435\u043d\u044c\u043a\u043e\u0435 \u0432\u0438\u0434\u0435\u043e \u0438\u0433\u0440\u044b \u0438\u0437 114 \u0445\u043e\u0434\u043e\u0432, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u0437\u0430 \u043f\u044f\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0438\u043d\u0443\u0442.<\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u0431\u0438\u0442\u0431\u043e\u0440\u0434 \u2013 \u044d\u0442\u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0431\u0430\u0439\u0442, \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u0438\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0439 \u043a\u043b\u0435\u0442\u043a\u0435 \u043f\u043e\u043b\u044f \u0432 \u0438\u0433\u0440\u0435. \u0422\u0430\u043a, \u0432 \u0448\u0430\u0445\u043c\u0430\u0442\u0430\u0445 \u0432\u0441\u0435\u0433\u043e 64 \u043a\u043b\u0435\u0442\u043a\u0438, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 8-\u0431\u0430\u0439\u0442\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0443 (ulong \u0432 C#), \u0430 \u0432 \u0448\u0430\u0448\u043a\u0430\u0445 \u2013 32 (uint \u0432 C#). \u041b\u044e\u0431\u0438\u0442\u0435\u043b\u0438 \u0442\u0435\u0442\u0440\u0438\u0441\u0430 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043f\u043e\u043c\u043d\u044f\u0442, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u043e\u043b\u044f \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0442\u0435\u0442\u0440\u0438\u0441\u0435 \u2013 10 \u043d\u0430 20 \u043a\u043b\u0435\u0442\u043e\u043a, \u0442\u043e \u0435\u0441\u0442\u044c, 200 \u0431\u0438\u0442, \u0447\u0442\u043e \u043d\u0435 \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u043d\u0438 \u0432 \u043e\u0434\u0438\u043d \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0442\u0438\u043f. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043f\u043e\u043b\u0435 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u043e\u0441\u044c\u043c\u0438\u0431\u0430\u0439\u0442\u043d\u044b\u0445 \u0441\u043b\u043e\u0432\u0430, \u0438\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043c\u0435\u043b\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u0438 \u0434\u0432\u0443\u0445\u0431\u0430\u0439\u0442\u043d\u044b\u0445 \u0441\u043b\u043e\u0432, \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u043b\u0438\u043d\u0438\u044e \u043f\u043e\u043b\u044f; \u0432\u0441\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u0442\u0440\u0438\u0441\u0430 \u043d\u0430 \u0431\u0438\u0442\u0431\u043e\u0440\u0434\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0430\u0448\u0435\u043b (\u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0434\u043d\u043e\u0439 \u0448\u0442\u0443\u043a\u0438), \u0442\u0430\u043a \u0438 \u0434\u0435\u043b\u0430\u044e\u0442. \u041d\u043e \u043c\u044b \u043f\u043e\u0439\u0434\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0435\u043c\u2026  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-305581","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305581","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=305581"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305581\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}