{"id":30953,"student_id":10,"content":"when('click', function () {\n guess(prompt('猜 0 ~ 1000 數字?'));\n});\n\n// 循環搜尋法\nfor (var i=1; i\u003c1000; i++) {\n var result = guess(i);\n if (result == 0) break;\n}\n\n// 二分搜尋法\nvar up = 1000;\nvar low = 0;\n\nfor (var i=1; i\u003c1000; i++) {\n var g = Math.floor((up + low)/2);\n var result = guess(g);\n if (result == 1) up = g;\n if (result == -1) low = g;\n if (result == 0) break;\n}","created_at":"2018-06-06T11:18:05.699+08:00","updated_at":"2019-10-30T21:49:37.274+08:00","name":"解數字炸彈","language":"javascript","screenshot":{"url":null},"parent_id":2,"plugin":"setBackdrop('black');\n\nvar game = (function () {\n var count = 0;\n var answer = Math.floor(Math.random()*1000);\n var recentGuess = '???';\n var result = '';\n \n function guess (num) {\n count++;\n recentGuess = num;\n \n if (num \u003e answer) {\n result = '太大了';\n return 1;\n }\n if (num \u003c answer) {\n result = '太小了';\n return -1;\n }\n if (num == answer) {\n result = '猜對了';\n return 0;\n }\n return result;\n }\n \n forever(function(){\n print('猜', 80, 225, 'white', 60);\n print(recentGuess, 150, 150, 'white', 150);\n print(result, 410, 225, 'white', 60);\n print(`猜了 ${count} 次`, 400, 330, 'white', 30);\n });\n \n return {\n guess: guess\n }\n \n})();\n\nvar guess = game.guess;\n\n\n\n\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":355,"hashid":"882sn5nz","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":578284,"file_name":"0.png","project_id":30953,"asset_id":70025,"created_at":"2018-06-06T11:18:41.812+08:00","updated_at":"2018-06-06T11:18:41.812+08:00"},{"id":578285,"file_name":"1.svg","project_id":30953,"asset_id":70026,"created_at":"2018-06-06T11:18:41.821+08:00","updated_at":"2018-06-06T11:18:41.821+08:00"},{"id":578286,"file_name":"2.png","project_id":30953,"asset_id":70027,"created_at":"2018-06-06T11:18:41.826+08:00","updated_at":"2018-06-06T11:18:41.826+08:00"},{"id":578287,"file_name":"0.wav","project_id":30953,"asset_id":70028,"created_at":"2018-06-06T11:18:41.832+08:00","updated_at":"2018-06-06T11:18:41.832+08:00"},{"id":578288,"file_name":"1.wav","project_id":30953,"asset_id":70029,"created_at":"2018-06-06T11:18:41.839+08:00","updated_at":"2018-06-06T11:18:41.839+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦