{"id":219670,"student_id":3463,"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); //重複不斷執行遊戲迴圈\nvar b = 0;\nvar a = 0;\n\n//遊戲主迴圈\nfunction loop () {\n \n for (var i = 0; i \u003c 1000; i++) {\n\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 \u003e 500) {\n pen.fillColor = 'red';\n a += 1\n } else {\n pen.fillColor = 'orange';\n b += 1;\n a += 1\n }\n pen.drawRect(x, y, 1, 1);\n var c = (b/a)*4;\n pen.fillColor = 'whi'\n pen.drawRect(0, 20, 500, 50);\n\n\n print(c,10,40,'black',40)\n }\n\n};","created_at":"2021-01-16T13:39:43.419+08:00","updated_at":"2021-01-16T14:30:12.885+08:00","name":"蒙地卡羅求 PI(預設版) 副本","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/219670/dea55bad718ab314c706795f1742cb0c.jpg"},"parent_id":183395,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":84,"hashid":"d5msvyjy8","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
到這台電腦