{"id":13415,"student_id":10,"content":"var W = 23;\nvar current = 'b';\nvar grid = [];\nfor(var x=0; x\u003cW; x++) {\n grid[x] = [];\n}\n\nforever(function(){\n for (var x=4; x\u003cW-4; x++) {\n for (var y=4; y\u003cW-4; y++) {\n\n pen.color = 'black'\n pen.size = 1;\n pen.fillColor = null;\n pen.drawRect(x*30 - 26, y*30 - 106, 30, 30);\n\n pen.size = ;\n if (grid[x][y] == undefined) continue;\n if (grid[x][y] == 'b') pen.fillColor = 'black';\n if (grid[x][y] == 'w') pen.fillColor = 'white';\n pen.drawCircle(x*30 - 11, y*30 - 91, 14);\n }\n }\n for (var x=4; x\u003cW-4; x++) {\n for (var y=4; y\u003cW-4; y++) {\n check(x, y, 1, 0);\n check(x, y, -1, 0);\n check(x, y, 0, 1);\n check(x, y, 0, -1);\n check(x, y, 1, 1);\n check(x, y, -1, 1);\n check(x, y, 1, -1);\n check(x, y, -1, -1);\n }\n }\n});\n\nwhen('click', function () {\n var x = Math.floor((cursor.x - 95)/30) + 4;\n var y = Math.floor((cursor.y - 15)/30) + 4;\n\n if (x \u003c 4 || x \u003e= 19 || y \u003c 4 || y \u003e= 19) return;\n\n if (grid[x][y] != undefined) return;\n\n grid[x][y] = current;\n current = current == 'b' ? 'w' : 'b';\n});\n\nfunction check (x, y, vx, vy) {\n var re = grid[x][y] + grid[x + vx][y + vy] + grid[x + vx*2][y + vy*2] + grid[x + vx*3][y + vy*3] + grid[x + vx*4][y + vy*4];\n if (re == 'bbbbb') {\n print(\"黑方獲勝\");\n stop();\n }\n if (re == 'wwwww') {\n print(\"白方獲勝\");\n stop();\n }\n}","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-10-30T05:55:18.144+08:00","name":"五子棋(測試)","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/13415/7c07278515f7fd00a9d26a445dd508e4.jpg"},"parent_id":13312,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":394,"hashid":"kdms6395","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":275892,"file_name":"bg.png","project_id":13415,"asset_id":33400,"created_at":"2017-10-19T20:43:28.415+08:00","updated_at":"2017-10-19T20:43:28.415+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦