{"id":318765,"student_id":3469,"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 a = 0; //橘色的點\nvar b = 0; //紅色的點\n\nforever(loop); //重複不斷執行遊戲迴圈\n\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 if (d \u003c= 500) {\n pen.fillColor = 'orange';\n a++;\n } else {\n pen.fillColor = 'red';\n b++;\n }\n pen.drawRect(x, y, 1, 1);\n }\n pen.fillColor = 'white';\n pen.drawRect(0, 20, 500, 50);\n print(a/(a+b)*4, 10, 40, 'black', 40);\n};\n\n","created_at":"2021-11-27T13:25:48.243+08:00","updated_at":"2021-11-27T13:56:44.245+08:00","name":"蒙地卡羅求 PI(預設版) 副本","language":"javascript","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/318765/0beaded81343183551f7d5a2c7175017.jpg"},"parent_id":183395,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":141,"hashid":"zpesj2knq","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
到這台電腦