{"id":43744,"student_id":1976,"content":"// 可以修改預設密碼來測試\n// setPassword('password');\n\n// 不斷嘗試密碼並將分數高的排在前面,產生下一代的密碼\nforever(function() {\n})\n\n// 將兩組密碼進行組合\nfunction crossover (a, b) {\n}","created_at":"2018-09-30T09:47:50.352+08:00","updated_at":"2019-10-27T22:53:51.253+08:00","name":"遺傳演算法 副本","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/43744/d5e83e2e8807386417e5c3df70de4c5a.jpg"},"parent_id":33940,"plugin":"setBackdrop('hacker1.jpg', 0, 0, 640, 480);\n\nvar game = (function () {\n \n var log = [];\n var key = 'I love Koding very much';\n var gameOver = false;\n \n when('click', function () {\n if (prompt('請輸入密碼?') == key) {\n setBackdrop('hacker2.jpg', 0, 0, 640, 480);\n setTimeout(function() {\n setBackdrop('hacker3.jpg', 0, 0, 640, 480);\n stop();\n }, 1000);\n }\n });\n \n function password (passwd) {\n if (gameOver) return;\n if (passwd == key) gameOver = true;\n \n log.unshift(passwd);\n var count = 0;\n for (var i = 0; i \u003c key.length; i++) {\n if (key[i] == passwd[i]) count++;\n }\n return count;\n }\n \n function setPassword (passwd) {\n key = passwd;\n }\n \n forever(function(){\n for (var i=0; i\u003c14 \u0026\u0026 i\u003clog.length; i++) {\n print(log[i], 50, 35 + 20*i, log[i] == key ? 'gold' : 'white');\n }\n });\n\n return {\n password: password,\n setPassword: setPassword\n }\n})();\n\nvar password = game.password;\nvar setPassword = game.setPassword;\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":320,"hashid":"qmdsv5v8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":768506,"file_name":"hacker2.jpg","project_id":43744,"asset_id":74924,"created_at":"2018-09-30T09:47:50.361+08:00","updated_at":"2018-09-30T09:47:50.361+08:00"},{"id":768507,"file_name":"hacker3.jpg","project_id":43744,"asset_id":74923,"created_at":"2018-09-30T09:47:50.363+08:00","updated_at":"2018-09-30T09:47:50.363+08:00"},{"id":768508,"file_name":"hacker1.jpg","project_id":43744,"asset_id":74922,"created_at":"2018-09-30T09:47:50.364+08:00","updated_at":"2018-09-30T09:47:50.364+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦