WITH RECURSIVE T AS ( SELECT 0 x , 0 y , '{"{0,0}"}'::text[] c -- , 0 i UNION ALL ( WITH Z AS ( SELECT dn.x , dn.y , Tc , Ti FROM T -- , LATERAL( SELECT ((random() * 2 - 1) * 100)::integer x , ((random() * 2 - 1) * 100)::integer y ) p -- , LATERAL( SELECT * FROM ( SELECT (unnest::text[])[1]::integer x , (unnest::text[])[2]::integer y FROM unnest(Tc::text[]) ) T ORDER BY sqrt((x - px) ^ 2 + (y - py) ^ 2) LIMIT 1 ) n -- 8 "" , LATERAL ( SELECT nx + dx x , ny + dy y FROM generate_series(-1, 1) dx , generate_series(-1, 1) dy WHERE (dx, dy) <> (0, 0) ORDER BY CASE WHEN (px, py) = (nx, ny) THEN 0 ELSE abs(acos(((px - nx) * dx + (py - ny) * dy) / sqrt((px - nx) ^ 2 + (py - ny) ^ 2) / sqrt(dx ^ 2 + dy ^ 2))) END LIMIT 1 ) dn ) SELECT Zx , Zy , Zc || ARRAY[Zx, Zy]::text , Zi + 1 FROM Z WHERE Zi < (1 << 10) ) ) -- , map AS ( SELECT gx x , gy y , ( SELECT sqrt((gx - Tx) ^ 2 + (gy - Ty) ^ 2) v FROM T ORDER BY v LIMIT 1 ) v FROM generate_series(-40, 40) gx , generate_series(-30, 30) gy ) -- , gr AS ( SELECT regexp_split_to_array('#*+-. ', '') s ) -- SELECT string_agg( coalesce(s[(v * (array_length(s, 1) - 1))::integer + 1], ' ') , ' ' ORDER BY x) frozen FROM ( SELECT x , y , v::double precision / max(v) OVER() v -- FROM map ) T , gr GROUP BY y ORDER BY y;
WITH RECURSIVE T AS ( SELECT 0 x , 0 y , '{"{0,0}"}'::text[] c -- , 0 i UNION ALL ( WITH Z AS ( SELECT dn.x , dn.y , Tc , Ti FROM T -- , LATERAL( SELECT ((random() * 2 - 1) * 100)::integer x , ((random() * 2 - 1) * 100)::integer y ) p -- , LATERAL( SELECT * FROM ( SELECT (unnest::text[])[1]::integer x , (unnest::text[])[2]::integer y FROM unnest(Tc::text[]) ) T ORDER BY sqrt((x - px) ^ 2 + (y - py) ^ 2) LIMIT 1 ) n -- 8 , LATERAL ( SELECT nx + dx x , ny + dy y FROM generate_series(-1, 1) dx , generate_series(-1, 1) dy WHERE (dx, dy) <> (0, 0) ORDER BY CASE WHEN (px, py) = (nx, ny) THEN 0 ELSE abs(acos(((px - nx) * dx + (py - ny) * dy) / sqrt((px - nx) ^ 2 + (py - ny) ^ 2) / sqrt(dx ^ 2 + dy ^ 2))) END LIMIT 1 ) dn ) SELECT Zx , Zy , Zc || ARRAY[Zx, Zy]::text , Zi + 1 FROM Z WHERE Zi < (1 << 10) ) ) -- , map AS ( SELECT gx x , gy y , ( SELECT sqrt((gx - Tx) ^ 2 + (gy - Ty) ^ 2) v FROM T ORDER BY v LIMIT 1 ) v FROM generate_series(-70, 70) gx , generate_series(-35, 35) gy ) -- , gr AS ( SELECT regexp_split_to_array('#****++++----.... ', '') s ) -- SELECT string_agg( coalesce(s[(v * (array_length(s, 1) - 1))::integer + 1], ' ') , ' ' ORDER BY x) frozen FROM ( SELECT x , y , v::double precision / max(v) OVER() v -- FROM map ) T , gr GROUP BY y ORDER BY y;
Source: https://habr.com/ru/post/id482460/More articles:Teknologi terbesar gagal 2019MVP telah berkembang menjadi produk atau pengalaman saya dengan MVP pada tahun 2019Sistem Brasil bukan mitos. Bagaimana cara menggunakannya di TI?FunCode kami, atau Bagaimana kami mengadakan kontes untuk pengembang iOS5 fitur Python yang tidak saya ketahui - tetapi sia-siaPelajari Metaflow dalam 10 MenitApa itu * args dan ** kwargs dengan Python?5 hal yang dapat Anda lakukan untuk mempersiapkan Vue 3.05 ekstensi dan tema untuk Kode VS yang dapat mengubah kehidupan pengembang front-endPemuatan halaman cepat pada ponsel murah yang paling sederhanaAll Articles