{"id":1525,"date":"2007-04-19T17:36:57","date_gmt":"2007-04-19T08:36:57","guid":{"rendered":"http:\/\/r-dimension.xsrv.jp\/classes_j\/?p=1525"},"modified":"2020-05-27T12:28:24","modified_gmt":"2020-05-27T03:28:24","slug":"2array","status":"publish","type":"post","link":"https:\/\/r-dimension.xsrv.jp\/classes_j\/2array\/","title":{"rendered":"4.3.5\u30002\u6b21\u5143\u914d\u5217"},"content":{"rendered":"\n<p>1\u6b21\u5143\u914d\u5217\u306f\u3069\u3046\u3067\u3057\u305f\u304b\uff1f\u6b21\u306f2\u6b21\u5143\u914d\u5217\u3067\u3059\u3002\u69cb\u9020\u306f\u5b9f\u306f\u30b7\u30f3\u30d7\u30eb\u306a\u306e\u3067\u3059\u304c\u3001\u3084\u306f\u308a1\u6b21\u5143\u914d\u5217\u3088\u308a\u306f\u8907\u96d1\u306b\u306a\u308a\u307e\u3059\u3002<br>\u5f0f\u3068\u3057\u3066\u306f\u3001[]\u304c\u3082\u3046\u4e00\u3064\u5897\u3048\u3066\u3001\u4f8b\u3048\u3070\u3001<\/p>\n\n\n\n<pre class=\"wp-block-aphph-prism-block lang:processing language-processing\"><code>int[][] a = new int[3][5];<\/code><\/pre>\n\n\n\n<p>\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u914d\u5217\u3092\u5ba3\u8a00\u3059\u308b\u969b\u306b\u3001\u5024\u3092\u5165\u308c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-aphph-prism-block lang:processing language-processing\"><code>\/\/\u521d\u671f\u5316\u306e\u969b\u306b\u76f4\u63a5\u5024\u3092\u5165\u308c\u308b\u3002\n\/\/int[][] a = new int[3][5];\u3068\u69cb\u9020\u7684\u306b\u306f\u540c\u3058\nint[][] a = {{0, 1, 2, 3, 4},\n            {5, 6, 7, 8, 9},\n            {10, 11, 12, 13, 14}};\n\/\/0~2\u306e\u5024\u3092\u5165\u308c\u308c\u3070\u3001\u305d\u308c\u305e\u308c\u306e\u884c\u306e\u5024\u304c\u51fa\u308b\nprintln(a[0]);<\/code><\/pre>\n\n\n\n<p>\u3053\u306e\u5834\u5408\u3001\u753b\u50cf\u51e6\u7406\u306e\u30b3\u30fc\u30c9\u3068\u3082\u95a2\u9023\u3059\u308b\u306e\u3067\u3001\u6b21\u306e\u3088\u3046\u306b\u884c\u3068\u5217\u306e\u95a2\u4fc2\u3092\u899a\u3048\u308b\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3010\u56f34.3-h\u3011\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/row_col_01.gif\" alt=\"row_col_01.gif\"\/><\/figure>\n\n\n\n<div class=\"imgCaption\">\u56f34.3-h<\/div>\n\n\n\n<p>\u3053\u306e\u5f0f\u306e\u914d\u5217\u306e\u6982\u5ff5\u56f3\u306f\u3010\u56f34.3-i\u3011\u306b\u306a\u308a\u307e\u3059\u3002\u3064\u307e\u308a\u30013\u884c x 5\u5217 = 15\u500b\u306e\u7bb1\u304c\u4f5c\u3089\u308c\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u3053\u306e\u56f3\u306b\u305d\u308c\u305e\u308c\u306e\u7bb1\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\u3092\u8a18\u8f09\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/multi_array_01.gif\" alt=\"multi_array_01.gif\"\/><\/figure>\n\n\n\n<div class=\"imgCaption\">\u56f34.3-i<\/div>\n\n\n\n<p>\u305d\u308c\u305e\u308c\u306e\u7bb1\u306e\u5024\u3092\u5909\u3048\u305f\u3044\u6642\u306f\u3001a[0][3] = 5 \u306a\u3069\u306e\u3088\u3046\u306b\u5024\u3092\u4ee3\u5165\u3057\u3066\u3042\u3052\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.3.6\u30002\u6b21\u5143\u914d\u5217\u306b\u5186\u306e\u30b5\u30a4\u30ba\u306e\u5024\u3092\u683c\u7d0d\u3059\u308b<\/h2>\n\n\n\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u3069\u306e\u69d8\u306b\u4f7f\u3046\u3053\u3068\u3067\u304d\u308b\u306e\u3067\u3057\u3087\u3046\u304b\u3002\uff12\u6b21\u5143\u914d\u5217\u306f\u69d8\u3005\u306a\u7528\u9014\u306b\u4f7f\u3048\u307e\u3059\u304c\u3001\u3053\u3053\u3067\u306f\u7c21\u5358\u306a\u53c2\u8003\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u30013 x 5\u500b\u306e\u5186\u306e\u5927\u304d\u3055\u306e\u5024\u3092\u914d\u5217\u306b\u683c\u7d0d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-medium\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"167\" src=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2020\/05\/2020_05_27_12_21-300x167.png\" alt=\"\" class=\"wp-image-10473\" srcset=\"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2020\/05\/2020_05_27_12_21-300x167.png 300w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2020\/05\/2020_05_27_12_21-565x314.png 565w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2020\/05\/2020_05_27_12_21-768x426.png 768w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2020\/05\/2020_05_27_12_21-624x346.png 624w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2020\/05\/2020_05_27_12_21.png 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<div class=\"imgCaption\">\u56f34.3-j<\/div>\n\n\n\n<div class=\"listCaption\">\u30ea\u30b9\u30c84.3-f<\/div>\n\n\n\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\nsize(400, 200);\nbackground(255);\nnoStroke();\nfill(0);\n\nfor (int y = 0; y &lt; 3; y++) {    \/\/\u5217\u65b9\u5411    \n  for (int x = 0; x &lt; 5; x++) {    \/\/\u884c\u65b9\u5411\n\n    \/\/\u5186\u306e\u30b5\u30a4\u30ba\u309210~100\u672a\u6e80\u3067\u6c7a\u5b9a\n    eSize[y][x] = random(10, 100);\n\n    ellipse(100 * x, 100 * y, eSize[y][x], eSize[y][x]);    \/\/\u5186\u3092\u63cf\u304f\n  }\n}<\/code><\/pre>\n\n\n\n<p>\u6b21\u306b\u30013 x 5\u500b\u306e\u5186\u306e\u62e1\u5927\u7e2e\u5c0f\u306e\u30b9\u30d4\u30fc\u30c9\u304c\u5909\u308f\u308b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/2016_10_05_23_43.png\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"167\" src=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/2016_10_05_23_43-300x167.png\" alt=\"2016_10_05_23_43\" class=\"wp-image-7085\" srcset=\"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/2016_10_05_23_43-300x167.png 300w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/2016_10_05_23_43.png 400w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/figure>\n\n\n\n<div class=\"imgCaption\">\u56f34.3-k<\/div>\n\n\n\n<div class=\"listCaption\">\u30ea\u30b9\u30c84.3-g<\/div>\n\n\n\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\nvoid setup() {\n  size(400, 200);\n  background(255);\n  noStroke();\n  fill(0);\n\n  for (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      \/\/\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>\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u306e\u7279\u5fb4\u306f\u3001\u524d\u8ff0\u306e15\u500b\u306e\u7bb1\u306b\u305d\u308c\u305e\u308c\u72ec\u81ea\u306e\u5909\u6570\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u70b9\u3067\u3059\u3002\u30b5\u30f3\u30d7\u30eb\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u3001\u305d\u308c\u305e\u308c\u306e\u5186\u306e\u62e1\u5927\u7e2e\u5c0f\u306e\u30b9\u30d4\u30fc\u30c9\u304c\u5168\u3066\u9055\u3046\u3053\u3068\u304c\u5206\u304b\u308b\u3067\u3057\u3087\u3046\u3002\u3053\u306e\u914d\u5217\u306f\u3001\u7279\u306b\u4f55\u6b21\u5143\u307e\u3067\u3068\u3044\u3046\u5236\u9650\u306f\u306a\u3044\u306e\u30673\u6b21\u5143\u3067\u30824\u6b21\u5143\u3067\u3082\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u5b9f\u969b\u306b\u4f7f\u3046\u306e\u306f2\u6b21\u5143\u914d\u5217\u307e\u3067\u3067\u3042\u308b\u3053\u3068\u304c\u591a\u3044\u306e\u3067\u3001\u3053\u3053\u3067\u306f2\u6b21\u5143\u914d\u5217\u307e\u3067\u3057\u304b\u8aac\u660e\u3057\u307e\u305b\u3093\u3002<br>\u3053\u306e2\u6b21\u5143\u914d\u5217\u306f\u5f8c\u8ff0\u306e\u300c4.4\u3000\u753b\u50cf\u51e6\u7406\u300d\u306e\u7bc0\u3067\u3082\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4.3.7\u3000\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u3078\u306e\u5fdc\u7528<\/h2>\n\n\n\n<p>\u3010\u30ea\u30b9\u30c84.3-f\u3011\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u6bd4\u8f03\u7684\u30b7\u30f3\u30d7\u30eb\u306a\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u3067\u3059\u304c\u3001\u3053\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u5fdc\u7528\u3057\u3066\u5c55\u958b\u3059\u308b\u4e8b\u306b\u3088\u3063\u3066\u3001\u69d8\u3005\u306a\u30d1\u30bf\u30fc\u30f3\u3092\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/2014_07_02_16_31.png\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"166\" src=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/2014_07_02_16_31-300x166.png\" alt=\"2014_07_02_16_31\" class=\"wp-image-3973\" srcset=\"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/2014_07_02_16_31-300x166.png 300w, https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-content\/uploads\/2007\/04\/2014_07_02_16_31.png 400w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/figure>\n\n\n\n<div class=\"imgCaption\">\u56f34.3-l<\/div>\n\n\n\n<div class=\"listCaption\">\u30ea\u30b9\u30c84.3-h<\/div>\n\n\n\n<pre class=\"wp-block-aphph-prism-block lang:processing language-processing\"><code>float[][] eColor = new float[3][5];    \/\/\u5186\u306e\u8272\n\/\/\u5186\u306e\u8272\u306e\u5909\u5316\u306e\u30b9\u30d4\u30fc\u30c9\nfloat[][] speed = {{1.5, 2.5, 9.0, 7.2, 10.9}, \n                   {0.5, 2.0, 5.0, 4.0, 10.0}, \n                   {1.5, 12.0, 7.0, 1.0, 0.5}};\n\nvoid setup() {\n  size(400, 200);\n  background(255);\n  noStroke();\n  fill(0);\n  rectMode(CENTER);\n\n  for (int y = 0; y &lt; 3; y ++) {\n    for (int x = 0; x &lt; 5; x ++) {\n      eColor[y][x] = 0;    \/\/\u5186\u306e\u8272\u3092\u9ed2\u306b\u8a2d\u5b9a\n    }\n  }\n}\n\nvoid draw() {\n  background(255);\n\n  for (int y = 0; y &lt; 3; y ++) {\n    for (int x = 0; x &lt; 5; x ++) {\n      eColor[y][x] += speed[y][x];    \/\/\u5186\u306e\u8272\u3092\u5909\u5316\u3055\u305b\u308b\n      \/\/\u3082\u3057\u5186\u306e\u8272\u304c255\u3092\u8d85\u3048\u305f\u304b0\u672a\u6e80\u306b\u306a\u3063\u305f\u3089\n      \/\/speed\u306e\u5897\u6e1b\u3092\u53cd\u8ee2\u3055\u305b\u308b\n      if (eColor[y][x] &gt; 255 || eColor[y][x] &lt; 0)\n        speed[y][x] = -speed[y][x];\n\n      fill(0, eColor[y][x], 255, 127);\n      rect(x*100, y*100, 100, 100);    \/\/\u56db\u89d2\u5f62\u3092\u63cf\u304f\n\n      fill(0, eColor[y][x], 0, 127);\n      ellipse(x*100, y*100, 100, 100);    \/\/\u5186\u3092\u63cf\u304f\n\n      fill(255, eColor[y][x], 0, 127);\n      ellipse(x*100+50, y*100+50, 100, 100);    \/\/\u5186\u3092\u63cf\u304f\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p><a href=\"http:\/\/r-dimension.xsrv.jp\/classes_j\/twod-array-quiz\/\" class=\"aioseop-link\">\u30af\u30a4\u30ba<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u6b21\u5143\u914d\u5217\u306f\u3069\u3046\u3067\u3057\u305f\u304b\uff1f\u6b21\u306f2\u6b21\u5143\u914d\u5217\u3067\u3059\u3002\u69cb\u9020\u306f\u5b9f\u306f\u30b7\u30f3&#8230; <a href=\"https:\/\/r-dimension.xsrv.jp\/classes_j\/2array\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,26,11],"tags":[],"class_list":["post-1525","post","type-post","status-publish","format-standard","hentry","category-processing","category-ii","category-11"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/posts\/1525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/types\/post"}],"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=1525"}],"version-history":[{"count":32,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/posts\/1525\/revisions"}],"predecessor-version":[{"id":10476,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/posts\/1525\/revisions\/10476"}],"wp:attachment":[{"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/media?parent=1525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/categories?post=1525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/r-dimension.xsrv.jp\/classes_j\/wp-json\/wp\/v2\/tags?post=1525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}