final int BSIZE = 100;\nint[][] field;\nboolean bBlacksTurn;\nvoid setup(){\n size(8*BSIZE,8*BSIZE);\n bBlacksTurn = true;\n field = new int[8][8];\n for(int i=0; i<8; ++i){\n for(int j=0; j<8; ++j){\n if((i==3||i==4)&&(j==3||j==4)){\n field[i][j] = ((i+j)%2==0)?1:-1; \/\/ initial stones;\n }else{\n field[i][j] = 0;\n }\n }\n }\n}\nvoid draw(){\n \/\/draw field\n background(0,160,0);\n stroke(0);\n for(int i=1; i<8; ++i){\n line(i*BSIZE,0,i*BSIZE,height);\n line(0, i*BSIZE, width, i*BSIZE);\n }\n noStroke();\n fill(0);\n ellipse(BSIZE*2,BSIZE*2,10,10);\n ellipse(BSIZE*6,BSIZE*2,10,10);\n ellipse(BSIZE*2,BSIZE*6,10,10);\n ellipse(BSIZE*6,BSIZE*6,10,10);\n \/\/ draw stones\n noStroke();\n for(int i=0; i<8; ++i){\n for(int j=0; j<8; ++j){\n if(field[i][j]==1){\n fill(0);\n ellipse((i*2+1)*BSIZE\/2,(j*2+1)*BSIZE\/2, BSIZE*0.8, BSIZE*0.8);\n }else if(field[i][j]==-1){\n fill(255);\n ellipse((i*2+1)*BSIZE\/2,(j*2+1)*BSIZE\/2, BSIZE*0.8, BSIZE*0.8);\n }\n }\n }\n}\nvoid mouseReleased(){\n int x = mouseX\/BSIZE;\n int y = mouseY\/BSIZE;\n boolean puttable = false;\n if(field[x][y]==0){\n puttable = checkDirection(x,y,-1,-1) | puttable;\n puttable = checkDirection(x,y,-1,0) | puttable;\n puttable = checkDirection(x,y,-1,1) | puttable;\n puttable = checkDirection(x,y,0,-1) | puttable;\n puttable = checkDirection(x,y,0,1) | puttable;\n puttable = checkDirection(x,y,1,-1) | puttable;\n puttable = checkDirection(x,y,1,0) | puttable;\n puttable = checkDirection(x,y,1,1) | puttable;\n if(puttable){\n field[x][y] = currentStone();\n bBlacksTurn = !bBlacksTurn;\n }\n }\n}\nboolean checkDirection(int x, int y, int directionX, int directionY){\n if(checkBound(x+directionX, y+directionY) && field[x+directionX][y+directionY] != currentStone()){\n return checkStones(x, y, directionX, directionY);\n }\n return false;\n}\nboolean checkStones(int x, int y, int directionX, int directionY){\n if(checkBound(x+directionX, y+directionY) && field[x+directionX][y+directionY]==currentStone()){ \/\/ find\n return true;\n }else if(checkBound(x+directionX, y+directionY) && field[x+directionX][y+directionY]==0){ \/\/ not find\n return false;\n }else if(checkBound(x+directionX, y+directionY) && checkStones(x+directionX, y+directionY, directionX, directionY)){\n field[x+directionX][y+directionY] = currentStone(); \/\/ reverse\n return true;\n }else{\n return false;\n }\n}\nboolean checkBound(int x, int y){\n return x>=0 && x<8 && y>=0 && y<8;\n}\nint currentStone(){\n return (bBlacksTurn)?1:-1;\n}<\/code><\/pre><\/div>\n\n\n\n\u5b9f\u884c\u3057\u305f\u3089\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u753b\u9762\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n
<\/figure>\n\n\n\n\u5f53\u6642\u306f\u9014\u4e2d\u3067\u632b\u6298\u3057\u3066\u3001\u5b8c\u6210\u307e\u3067\u306f\u81f3\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u4eca\u56de\u306f30\u5206\u304f\u3089\u3044\u3067\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002\u30b4\u30ea\u62bc\u3057\u3067\u3072\u3063\u304f\u308a\u8fd4\u3059\u5224\u5b9a\u3092\u3057\u3066\u3044\u305f\u90e8\u5206\u3082\u518d\u5e30\u3092\u4f7f\u3063\u3066\u7f8e\u3057\u304f\u66f8\u304f\u3053\u3068\u3082\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n
<\/span>\u5fdc\u7528\u2460 N\u8272\u30aa\u30bb\u30ed<\/span><\/h2>\n\n\n\n\u3055\u3089\u306b\u6539\u9020\u3057\u3066\u3001\u8272\u6570\u3082\u76e4\u9762\u306e\u30b5\u30a4\u30ba\u3082\u81ea\u7531\u306b\u8a2d\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n
final int BSIZE = 50;\nfinal int COLS = 16, ROWS = 16;\nfinal int PLAYER_NUM = 8;\nint[][] field;\nint currentColor;\nvoid setup(){\n size(COLS*BSIZE,ROWS*BSIZE);\n colorMode(HSB);\n currentColor = 1;\n field = new int[COLS][ROWS];\n for(int i=0; i<COLS; ++i){\n for(int j=0; j<ROWS; ++j){\n field[i][j] = 0;\n }\n }\n for(int i=0; i<PLAYER_NUM; ++i){\n for(int j=0; j<PLAYER_NUM; ++j){\n field[floor(COLS\/2)+i-floor(PLAYER_NUM\/2)][floor(ROWS\/2)+j-floor(PLAYER_NUM\/2)] = ((i+j)%PLAYER_NUM)+1;\n }\n }\n}\nvoid draw(){\n \/\/draw field\n background(0);\n stroke(64);\n for(int i=1; i<COLS; ++i) line(i*BSIZE,0,i*BSIZE,height);\n for(int i=1; i<ROWS; ++i) line(0, i*BSIZE, width, i*BSIZE);\n \/\/ draw stones\n noStroke();\n for(int i=0; i<COLS; ++i){\n for(int j=0; j<ROWS; ++j){\n for(int k=1; k<=PLAYER_NUM; ++k){\n if(field[i][j]==k){\n fill(255*(k-1)\/PLAYER_NUM,255,255);\n ellipse((i*2+1)*BSIZE\/2,(j*2+1)*BSIZE\/2, BSIZE*0.8, BSIZE*0.8);\n }\n }\n }\n }\n}\nvoid mouseReleased(){\n int x = mouseX\/BSIZE;\n int y = mouseY\/BSIZE;\n boolean puttable = false;\n if(field[x][y]==0){\n puttable = checkDirection(x,y,-1,-1) | puttable;\n puttable = checkDirection(x,y,-1,0) | puttable;\n puttable = checkDirection(x,y,-1,1) | puttable;\n puttable = checkDirection(x,y,0,-1) | puttable;\n puttable = checkDirection(x,y,0,1) | puttable;\n puttable = checkDirection(x,y,1,-1) | puttable;\n puttable = checkDirection(x,y,1,0) | puttable;\n puttable = checkDirection(x,y,1,1) | puttable;\n if(puttable){\n field[x][y] =currentColor;\n currentColor = (currentColor==PLAYER_NUM)?1:currentColor+1;\n }\n }\n}\nboolean checkDirection(int x, int y, int directionX, int directionY){\n if(checkBound(x+directionX, y+directionY) && field[x+directionX][y+directionY] != currentColor&&field[x+directionX][y+directionY] != 0){\n return checkStones(x, y, directionX, directionY);\n }\n return false;\n}\nboolean checkStones(int x, int y, int directionX, int directionY){\n if(checkBound(x+directionX, y+directionY) && field[x+directionX][y+directionY]==currentColor){ \/\/ find\n return true;\n }else if(checkBound(x+directionX, y+directionY) && field[x+directionX][y+directionY]==0){ \/\/ not find\n return false;\n }else if(checkBound(x+directionX, y+directionY) && checkStones(x+directionX, y+directionY, directionX, directionY)){\n field[x+directionX][y+directionY] = currentColor; \/\/ reverse\n return true;\n }else{\n return false;\n }\n}\nboolean checkBound(int x, int y){\n return x>=0 && x<COLS && y>=0 && y<ROWS;\n}\n\ufeff<\/code><\/pre><\/div>\n\n\n\n\u5b9f\u884c\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n
<\/figure>\n\n\n\n<\/span>\u5fdc\u7528\u2461 3D\u30aa\u30bb\u30ed<\/span><\/h2>\n\n\n\n 3D\u30aa\u30bb\u30ed\u3082\u4f5c\u3063\u3066\u307f\u305f\u3002\u64cd\u4f5c\u611f\u304c\u8d85\u60aa\u3044\u3067\u3059\u304c…<\/p>\n\n\n\n
final int BSIZE = 40;\nfinal int COLS = 8, ROWS = 8, DEPTH = 8;\nfinal int PLAYER_NUM = 2;\nint[][][] field;\nint currentColor;\nint x=0, y=0, z=0;\nvoid setup() {\n size(COLS*BSIZE*4, ROWS*BSIZE*4, P3D);\n colorMode(HSB);\n frameRate(10);\n currentColor = 1;\n field = new int[COLS][ROWS][DEPTH];\n for (int i=0; i<COLS; ++i) {\n for (int j=0; j<ROWS; ++j) {\n for (int k=0; k<DEPTH; ++k) {\n field[i][j][k] = 0;\n }\n }\n }\n for (int i=0; i<PLAYER_NUM; ++i) {\n for (int j=0; j<PLAYER_NUM; ++j) {\n for (int k=0; k<PLAYER_NUM; ++k)\n field[floor(COLS\/2)+i-floor(PLAYER_NUM\/2)][floor(ROWS\/2)+j-floor(PLAYER_NUM\/2)][floor(DEPTH\/2)+k-floor(PLAYER_NUM\/2)] = ((i+j+k)%PLAYER_NUM)+1;\n }\n }\n}\nvoid draw() {\n \/\/ directionalLight(204, 204, 204, -3, -5, -1);\n lights();\n pushMatrix();\n translate(COLS*BSIZE\/2*4, ROWS*BSIZE\/2*4, DEPTH*BSIZE\/2*2);\n rotateX(radians(-20.0));\n rotateY(frameCount \/ 50.0);\n translate(-COLS*BSIZE\/2, -ROWS*BSIZE\/2, -DEPTH*BSIZE\/2);\n \/\/draw field\n background(0);\n stroke(255, 64);\n for (int k=0; k<=DEPTH; ++k) {\n for (int i=0; i<=COLS; ++i) {\n line(i*BSIZE, 0, k*BSIZE, i*BSIZE, ROWS*BSIZE, k*BSIZE);\n }\n for (int j=0; j<=ROWS; ++j) {\n line(0, j*BSIZE, k*BSIZE, COLS*BSIZE, j*BSIZE, k*BSIZE);\n }\n }\n for (int i=0; i<=COLS; ++i) {\n for (int j=0; j<=ROWS; ++j) {\n line(i*BSIZE, j*BSIZE, 0, i*BSIZE, j*BSIZE, DEPTH*BSIZE);\n }\n }\n \/\/ draw stones\n noStroke();\n for (int i=0; i<COLS; ++i) {\n for (int j=0; j<ROWS; ++j) {\n for (int k=0; k<DEPTH; ++k) {\n for (int l=1; l<=PLAYER_NUM; ++l) {\n if (field[i][j][k]==l) {\n fill(255*(l-1)\/PLAYER_NUM, 255, 255);\n pushMatrix();\n translate((i*2+1)*BSIZE\/2, (j*2+1)*BSIZE\/2, (k*2+1)*BSIZE\/2);\n sphere(BSIZE*0.3);\n popMatrix();\n }\n }\n }\n }\n }\n pushMatrix();\n translate((x*2+1)*BSIZE\/2, (y*2+1)*BSIZE\/2, (z*2+1)*BSIZE\/2);\n stroke(255*(currentColor-1)\/PLAYER_NUM, 255, 255);\n noFill();\n box(BSIZE);\n popMatrix();\n popMatrix();\n}\nvoid keyReleased() {\n if (key==' ') {\n boolean puttable = false;\n if (field[x][y][z]==0) {\n for (int i=-1; i<=1; ++i) {\n for (int j=-1; j<=1; ++j) {\n for (int k=-1; k<=1; ++k) {\n if (!(i==0 && j==0 && k==0)) puttable = checkDirection(x, y, z, i, j, k) | puttable;\n }\n }\n }\n if (puttable) {\n field[x][y][z] =currentColor;\n currentColor = (currentColor==PLAYER_NUM)?1:currentColor+1;\n }\n }\n }\n else if (key=='x') y = ( y+1==ROWS ) ? 0: y+1;\n else if (key=='e') y = ( y-1<0 ) ? ROWS-1: y-1;\n else if (key=='a') x = ( x+1==ROWS ) ? 0: x+1;\n else if (key=='d') x = ( x-1<0 ) ? ROWS-1: x-1;\n else if (key=='w') z = ( z+1==ROWS ) ? 0: z+1;\n else if (key=='z') z = ( z-1<0 ) ? ROWS-1: z-1;\n}\nboolean checkDirection(int x, int y, int z, int directionX, int directionY, int directionZ) {\n if (checkBound(x+directionX, y+directionY, z+directionZ) && field[x+directionX][y+directionY][z+directionZ] != currentColor&&field[x+directionX][y+directionY][z+directionZ] != 0) {\n return checkStones(x, y, z, directionX, directionY, directionZ);\n }\n return false;\n}\nboolean checkStones(int x, int y, int z, int directionX, int directionY, int directionZ) {\n if (checkBound(x+directionX, y+directionY, z+directionZ) && field[x+directionX][y+directionY][z+directionZ]==currentColor) { \/\/ find\n return true;\n }\n else if (checkBound(x+directionX, y+directionY, z+directionZ) && field[x+directionX][y+directionY][z+directionZ]==0) { \/\/ not find\n return false;\n }\n else if (checkBound(x+directionX, y+directionY, z+directionZ) && checkStones(x+directionX, y+directionY, z+directionZ, directionX, directionY, directionZ)) {\n field[x+directionX][y+directionY][z+directionZ] = currentColor; \/\/ reverse\n return true;\n }\n else {\n return false;\n }\n}\nboolean checkBound(int x, int y, int z) {\n return x>=0 && x<COLS && y>=0 && y<ROWS && z>=0 && z<DEPTH;\n}<\/code><\/pre><\/div>\n\n\n\n
<\/figure>\n\n\n\n<\/span>\u307e\u3068\u3081<\/span><\/h2>\n\n\n\n\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u521d\u3081\u3066\u5b66\u3093\u3060\u3053\u308d\u306e\u8ab2\u984c\u3092\u518d\u30c1\u30e3\u30ec\u30f3\u30b8\u3059\u308b\u3068\u3001\u6210\u9577\u3092\u5b9f\u611f\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n
\u7686\u3055\u3093\u3082\u3001\u6570\u5e74\u304a\u304d\u306b\u904e\u53bb\u306b\u30c1\u30e3\u30ec\u30f3\u30b8\u3057\u305f\u8ab2\u984c\u3092\u4eca\u306a\u3089\u3069\u3046\u4f5c\u308b\u304b\u30c1\u30e3\u30ec\u30f3\u30b8\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"
\u81ea\u5206\u306f\u5927\u5b66\uff13\u5e74\u306e\u6642\u3001\u4eca\u304b\u3089\u3061\u3087\u3046\u3069\uff14\u5e74\u524d\u304f\u3089\u3044\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u59cb\u3081\u305f\u308f\u3051\u3067\u3059\u304c\u3001\u305d\u306e\u3068\u304d\u4e00\u756a\u6700\u521d\u306b\u81ea\u5206\u306b\u8ab2\u3057\u305f\u8ab2\u984c\u304cProcessing\u3067\u30aa\u30bb\u30ed\u3092\u4f5c\u308b\u3053\u3068\u3067\u3057\u305f\u3002 \u305d\u306e\u5f53\u6642\u306fif\u6587\u3082for\u6587\u3082\u672c\u3092\u53c2\u8003\u306b\u3057\u306a\u304c\u3089\u3001\u3057\u3069\u308d\u3082\u3069 […]<\/p>\n","protected":false},"author":1,"featured_media":208443,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[9],"class_list":["post-3177","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-program","tag-processing"],"aioseo_notices":[],"jetpack_featured_media_url":"http:\/\/cms.inter-arteq.com\/wp-content\/uploads\/2022\/03\/100-lines-reversi-in-processing.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts\/3177"}],"collection":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/comments?post=3177"}],"version-history":[{"count":6,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts\/3177\/revisions"}],"predecessor-version":[{"id":208383,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/posts\/3177\/revisions\/208383"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/media\/208443"}],"wp:attachment":[{"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/media?parent=3177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/categories?post=3177"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cms.inter-arteq.com\/wp-json\/wp\/v2\/tags?post=3177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}