{"id":9786,"student_id":10,"content":"setBackdrop(\"#222222\");\nvar map = [];\nvar score = 0;\nvar time = 0;\nvar mapsize = 14;\n\nvar timer = setInterval(function(){\n time++;\n}, 1000);\n\nGame.forever(function(){\n print(\"Time: \" + time + \" sec\", 5, 5, \"#167ac6\", 24);\n print(\"Mine: \" + mines + \" left\", 500, 5, \"#167ac6\", 24);\n});\n\nfor (i = 0; i \u003c mapsize; i++) {\n map[i] = [];\n for (j = 0; j \u003c mapsize; j++) {\n map[i][j] = createSprite([\"block.png\", \"clicked.png\", \"clicked 1.png\", \"clicked 2.png\", \"clicked 3.png\", \"clicked 4.png\", \"clicked 5.png\", \"clicked 6.png\", \"clicked 7.png\", \"clicked 8.png\"]);\n map[i][j].fx = i;\n map[i][j].fy = j;\n map[i][j].x = map[i][j].fx*32 + 16 + 96;\n map[i][j].y = map[i][j].fy*32 + 16 + 32;\n map[i][j].stat = \"block\";\n map[i][j].mines = 0;\n map[i][j].on(\"mouseup\", function(){\n if(this.stat == \"mine\"){\n print(\"GAME OVER!\", 5, 140, \"red\", 100); \n stop();\n }else{\n spread(this.fx, this.fy);\n }\n });\n }\n}\n\nvar mines = 10;\n\nvar i=0;\n\nfunction spread(fx, fy){\n console.log(i++);\n map[fx][fy].stat = \"clicked\";\n map[fx][fy].costumeId = map[fx][fy].mines + 1;\n if(map[fx][fy].mines == 0){\n if((fx-1 \u003e= 0) || (fx+1 \u003c mapsize) || (fy-1 \u003e= 0) || (fy+1 \u003c mapsize)){\n if(fx-1 \u003e= 0 \u0026\u0026 map[fx-1][fy].stat != 'clicked'){\n spread(fx-1, fy);\n }\n if(fx+1 \u003c mapsize \u0026\u0026 map[fx+1][fy].stat != 'clicked'){\n spread(fx+1, fy);\n }\n if(fy-1 \u003e= 0 \u0026\u0026 map[fx][fy-1].stat != 'clicked'){\n spread(fx, fy-1);\n }\n if(fy+1 \u003c mapsize \u0026\u0026 map[fx][fy+1].mines != 'clicked'){\n spread(fx, fy+1);\n }\n return true;\n }else{\n return false;\n }\n\n }else{\n return true;\n }\n}\n\nfunction placeMine(){\n var fx = Math.floor(Math.random()*mapsize);\n var fy = Math.floor(Math.random()*mapsize);\n if(map[fx][fy].stat != \"mine\"){\n map[fx][fy].stat = \"mine\";\n for(var i = fx-1; i \u003c fx+2; i++){\n if(i \u003e= 0 \u0026\u0026 i \u003c mapsize){\n for(var j = fy-1; j \u003c fy+2; j++){\n if(j \u003e= 0 \u0026\u0026 j \u003c mapsize){\n map[i][j].mines++;\n }\n }\n }\n }\n return true;\n }else{\n return placeMine();\n }\n}\n\nfor(var i = 0; i \u003c mines; i++){\n placeMine();\n}","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-04T00:34:38.143+08:00","name":"mine sweeper","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/9786/5871a740c7bbf981bb98e7c629fd4bf1.jpg"},"parent_id":9446,"plugin":"","description":"","note":"","status":"public","like_student_ids":[],"is_featured":false,"views":486,"hashid":"p93skk3d","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":217418,"file_name":"0.png","project_id":9786,"asset_id":6,"created_at":"2017-08-21T18:01:35.658+08:00","updated_at":"2017-08-21T18:01:35.658+08:00"},{"id":217419,"file_name":"1.svg","project_id":9786,"asset_id":7,"created_at":"2017-08-21T18:01:35.661+08:00","updated_at":"2017-08-21T18:01:35.661+08:00"},{"id":217420,"file_name":"2.png","project_id":9786,"asset_id":8,"created_at":"2017-08-21T18:01:35.663+08:00","updated_at":"2017-08-21T18:01:35.663+08:00"},{"id":217421,"file_name":"0.wav","project_id":9786,"asset_id":9,"created_at":"2017-08-21T18:01:35.665+08:00","updated_at":"2017-08-21T18:01:35.665+08:00"},{"id":217422,"file_name":"1.wav","project_id":9786,"asset_id":10,"created_at":"2017-08-21T18:01:35.667+08:00","updated_at":"2017-08-21T18:01:35.667+08:00"},{"id":217423,"file_name":"block.png","project_id":9786,"asset_id":26134,"created_at":"2017-08-21T18:01:35.669+08:00","updated_at":"2017-08-21T18:01:35.669+08:00"},{"id":217424,"file_name":"clicked.png","project_id":9786,"asset_id":26135,"created_at":"2017-08-21T18:01:35.671+08:00","updated_at":"2017-08-21T18:01:35.671+08:00"},{"id":217425,"file_name":"clicked 1.png","project_id":9786,"asset_id":26155,"created_at":"2017-08-21T18:01:35.673+08:00","updated_at":"2017-08-21T18:01:35.673+08:00"},{"id":217426,"file_name":"clicked 2.png","project_id":9786,"asset_id":26156,"created_at":"2017-08-21T18:01:35.675+08:00","updated_at":"2017-08-21T18:01:35.675+08:00"},{"id":217427,"file_name":"clicked 3.png","project_id":9786,"asset_id":26157,"created_at":"2017-08-21T18:01:35.677+08:00","updated_at":"2017-08-21T18:01:35.677+08:00"},{"id":217428,"file_name":"clicked 4.png","project_id":9786,"asset_id":26158,"created_at":"2017-08-21T18:01:35.679+08:00","updated_at":"2017-08-21T18:01:35.679+08:00"},{"id":217429,"file_name":"clicked 5.png","project_id":9786,"asset_id":26159,"created_at":"2017-08-21T18:01:35.682+08:00","updated_at":"2017-08-21T18:01:35.682+08:00"},{"id":217430,"file_name":"clicked 6.png","project_id":9786,"asset_id":26160,"created_at":"2017-08-21T18:01:35.685+08:00","updated_at":"2017-08-21T18:01:35.685+08:00"},{"id":217431,"file_name":"clicked 7.png","project_id":9786,"asset_id":26161,"created_at":"2017-08-21T18:01:35.688+08:00","updated_at":"2017-08-21T18:01:35.688+08:00"},{"id":217432,"file_name":"clicked 8.png","project_id":9786,"asset_id":26162,"created_at":"2017-08-21T18:01:35.690+08:00","updated_at":"2017-08-21T18:01:35.690+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦