{"id":15426,"student_id":168,"content":"var block = []\nfor (var x = 0; x \u003c 16; x++) {\n block[x] = [];\n for (var y = 0; y \u003c 12; y++) {\n block[x][y] = [];\n for (var a = 0; a \u003c 4; a++) {\n block[x][y][a] = true\n }\n block[x][y][4] = \"white\"\n }\n}\nvar nowx = 0\nvar nowy = 0\nblock[0][0][4] = \"blue\"\n\nforever(function() {\n for (var x = 0; x \u003c 16; x++) {\n for (var y = 0; y \u003c 12; y++) {\n for (var a = 0; a \u003c 4; a++) {\n if (block[x][y][a] == true) {\n pen.size = 5\n pen.color = \"black\"\n if (a == 0) {\n pen.drawLine(x*40, y*40, (x+1)*40, y*40)\n }\n if (a == 1) {\n pen.drawLine((x+1)*40, y*40, (x+1)*40, (y+1)*40)\n }\n if (a == 2) {\n pen.drawLine((x+1)*40, (y+1)*40, x*40, (y+1)*40)\n }\n if (a == 3) {\n pen.drawLine(x*40, (y+1)*40, x*40, y*40)\n }\n }\n pen.size = 0.001;\n pen.fillColor = block[x][y][4];\n pen.drawRect(x*40, y*40, 40, 40);\n }\n }\n }\n var nexts = getNexts();\n if (nexts.length \u003e 0) {\n var rand = Math.floor(Math.random()*nexts.length);\n if (nexts[rand] == 0) {\n block[nowx][nowy][0] = false\n nowy -= 1\n block[nowx][nowy][2] = false\n block[nowx][nowy][4] = \"blue\"\n }\n if (nexts[rand] == 1) {\n block[nowx][nowy][1] = false\n nowx += 1\n block[nowx][nowy][3] = false\n block[nowx][nowy][4] = \"blue\"\n }\n if (nexts[rand] == 2) {\n block[nowx][nowy][2] = false\n nowy += 1\n block[nowx][nowy][0] = false\n block[nowx][nowy][4] = \"blue\"\n }\n if (nexts[rand] == 3) {\n block[nowx][nowy][3] = false\n nowx -= 1\n block[nowx][nowy][1] = false\n block[nowx][nowy][4] = \"blue\"\n }\n } else {\n if ((block[nowx][nowy][0] == false) \u0026\u0026 (block[nowx][nowy-1][4] != \"yellow\") \u0026\u0026 (nowy \u003e 0)) {\n block[nowx][nowy][4] = \"yellow\"\n nowy -= 1\n }\n if ((block[nowx][nowy][1] == false) \u0026\u0026 (block[nowx+1][nowy][4] != \"yellow\") \u0026\u0026 (nowx \u003c 15)) {\n block[nowx][nowy][4] = \"yellow\"\n nowx += 1\n }\n if ((block[nowx][nowy][2] == false) \u0026\u0026 (block[nowx][nowy+1][4] != \"yellow\") \u0026\u0026 (nowy \u003c 11)) {\n block[nowx][nowy][4] = \"yellow\"\n nowy += 1\n }\n if ((block[nowx][nowy][3] == false) \u0026\u0026 (block[nowx-1][nowy][4] != \"yellow\") \u0026\u0026 (nowx \u003e 0)) {\n block[nowx][nowy][4] = \"yellow\"\n nowx -= 1\n }\n }\n pen.fillColor = 'red';\n pen.drawRect(nowx*40, nowy*40, 40, 40);\n});\n\n\nfunction getNexts () {\n var arr = [];\n if (nowy \u003e 0 \u0026\u0026 block[nowx][nowy-1][4] == 'white') {\n arr.push(0)\n }\n if (nowx \u003c 15 \u0026\u0026 block[nowx+1][nowy][4] == 'white') {\n arr.push(1)\n }\n if (nowy \u003c 11 \u0026\u0026 block[nowx][nowy+1][4] == 'white') {\n arr.push(2)\n }\n if (nowx \u003e 0 \u0026\u0026 block[nowx-1][nowy][4] == 'white') {\n arr.push(3)\n }\n return arr;\n}","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-01T12:31:54.753+08:00","name":"1","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/15426/4ae27d539f2f582300152066d159233d.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":170,"hashid":"qmds84zp","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":321268,"file_name":"0.png","project_id":15426,"asset_id":6,"created_at":"2017-11-11T16:50:01.191+08:00","updated_at":"2017-11-11T16:50:01.191+08:00"},{"id":321269,"file_name":"1.svg","project_id":15426,"asset_id":7,"created_at":"2017-11-11T16:50:01.193+08:00","updated_at":"2017-11-11T16:50:01.193+08:00"},{"id":321270,"file_name":"2.png","project_id":15426,"asset_id":8,"created_at":"2017-11-11T16:50:01.195+08:00","updated_at":"2017-11-11T16:50:01.195+08:00"},{"id":321271,"file_name":"0.wav","project_id":15426,"asset_id":9,"created_at":"2017-11-11T16:50:01.196+08:00","updated_at":"2017-11-11T16:50:01.196+08:00"},{"id":321272,"file_name":"1.wav","project_id":15426,"asset_id":10,"created_at":"2017-11-11T16:50:01.198+08:00","updated_at":"2017-11-11T16:50:01.198+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦