<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>panda_noir</author_name>
  <author_url>https://blog.hatena.ne.jp/panda_noir/</author_url>
  <blog_title>Panda Noir</blog_title>
  <blog_url>https://www.pandanoir.info/</blog_url>
  <categories>
    <anon>JavaScript</anon>
    <anon>ワンライナー</anon>
  </categories>
  <description>初めに言っておくと、数式が覚えられないくらい複雑なので実用性はありません。これが簡単な数式だったらまだ使えたのですがね…普通に[[0,1],[1,0],[0,-1],[-1,0]]のように地道に書いたほうが早いです。 用途としては、forループ内で配列を使わないで生成ができるくらいです。 隣接マスまでの差分とは? 今(x,y)にいたとして、(x-1,y)、(x+1,y+1)のような座標のことです。8近傍は斜めを含み、4近傍は含みません。 ソースコード console.log([...Array(9)].map((_, i) =&gt; [(i/3|0)-1,i%3-1])); // 8近傍(現在のマ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.pandanoir.info%2Fentry%2F2019%2F02%2F11%2F115010&quot; title=&quot;隣接するマスへの差分の配列をワンライナーで生成する - Panda Noir&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-02-11 11:50:10</published>
  <title>隣接するマスへの差分の配列をワンライナーで生成する</title>
  <type>rich</type>
  <url>https://www.pandanoir.info/entry/2019/02/11/115010</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
