{"id":8935,"date":"2019-05-08T18:04:51","date_gmt":"2019-05-08T09:04:51","guid":{"rendered":"http:\/\/r-dimension.xsrv.jp\/classes_j\/?page_id=8935"},"modified":"2020-05-23T14:54:06","modified_gmt":"2020-05-23T05:54:06","slug":"twod-array-quiz","status":"publish","type":"page","link":"https:\/\/r-dimension.xsrv.jp\/classes_j\/twod-array-quiz\/","title":{"rendered":"2\u6b21\u5143\u914d\u5217\u306e\u30af\u30a4\u30ba"},"content":{"rendered":"\n<pre class=\"wp-block-aphph-prism-block lang:processing language-processing\"><code>float[][] eSize = new float[3][5];    \/\/\u5186\u306e\u30b5\u30a4\u30ba\n\/\/\u5186\u306e\u62e1\u5927\u7e2e\u5c0f\u306e\u30b9\u30d4\u30fc\u30c9\nfloat[][] speed = {{0.1, 0.5, 0.3, 0.2, 1.5},\n{1.0, 2.0, 1.5, 2.0, 0.05},\n{0.4, 0.8, 0.08, 1.1, 1.4}};\nfloat minSize = 1.0;     \/\/\u5186\u306e\u30b5\u30a4\u30ba\u306e\u6700\u5c0f\u5024\nfloat maxSize = 100.0;    \/\/\u5186\u306e\u30b5\u30a4\u30ba\u306e\u6700\u5927\u5024\n\n\nvoid setup() {\nsize(400, 200);\nbackground(255);\nnoStroke();\nfill(0);\n\nfor (int y = 0; y &lt; 3; y++) {    \/\/\u5186\u306e\u30b5\u30a4\u30ba\u3092\u6700\u5c0f\u5024\u306b\u8a2d\u5b9a\n    for (int x = 0; x &lt; 5; x++) {\n      eSize[y][x] = minSize;\n    }\n  }\n}\n\nvoid draw() {\n  background(255);\n\n  for (int y = 0; y &lt; 3; y++) {    \/\/\u5217\u65b9\u5411\n    for (int x = 0; x &lt; 5; x++) {    \/\/\u884c\u65b9\u5411\n      eSize[y][x] += speed[y][x];    \/\/\u5186\u306e\u30b5\u30a4\u30ba\u3092\u5909\u5316\u3055\u305b\u308b\n      \/\/\u3082\u3057\u5186\u306e\u30b5\u30a4\u30ba\u304c\u6700\u5927\u5024\u3092\u8d85\u3048\u305f\u304b\u6700\u5c0f\u5024\u672a\u6e80\u306b\u306a\u3063\u305f\u3089\n      \/\/speed\u306e\u5897\u6e1b\u3092\u53cd\u8ee2\u3055\u305b\u308b\n      if (eSize[y][x] &gt; maxSize || eSize[y][x] &lt; minSize)\n        speed[y][x] = -speed[y][x];\n\n      \/\/y\u304c1,x\u304c3\u306e\u3068\u304d\u3060\u3051\u8d64\u306b\u3059\u308b\n      if (y == 1 &amp;&amp; x == 3) {\n        fill(255, 0, 0);\n      } else {\n        fill(0);\n      }\n\n      \/\/\u5186\u3092\u63cf\u304f\n      ellipse(100*x, 100*y, eSize[y][x], eSize[y][x]);\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-8935","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/pages\/8935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/comments?post=8935"}],"version-history":[{"count":7,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/pages\/8935\/revisions"}],"predecessor-version":[{"id":10368,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/pages\/8935\/revisions\/10368"}],"wp:attachment":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/media?parent=8935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}