{"id":159720,"student_id":10,"content":"Game.set({\n autoRendering: false, //改成手動繪圖\n width: 1000, //設定場景寬度\n height: 1000, //設定場景高度\n});\n\n//將遊戲場景塗成白色\npen.size = 0;\npen.fillColor = 'white';\npen.drawRect(0, 0, 1000, 1000);\n\nvar red = 0; //紅色的點\nvar orange = 0; // 橘色的點\n\nforever(loop); //重複不斷執行遊戲迴圈\n\n//遊戲主迴圈\nfunction loop () {\n for (var i = 0; i \u003c 1000; i++) {\n var x = Math.random()*1000;\n var y = Math.random()*1000;\n var d = Math.sqrt((x - 500)*(x - 500) + (y - 500)*(y - 500));\n\n if (d \u003c 500) {\n pen.fillColor = 'red';\n red++;\n } else {\n pen.fillColor = 'orange';\n orange++;\n }\n pen.drawRect(x, y, 1, 1);\n }\n\n pen.fillColor = 'white';\n pen.drawRect(0, 0, 400, 50);\n print(4*red/(red + orange), 10, 10, 'black', 30);\n};\n\n","created_at":"2020-06-18T17:32:40.707+08:00","updated_at":"2024-01-16T20:09:59.428+08:00","name":"蒙地卡羅求 PI(完整版)","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/159720/b41b6caeca5e63736528586e3c21736c.jpg"},"parent_id":3,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":313,"hashid":"vngszvrm","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦