{"id":180065,"student_id":130,"content":"import game\nimport random\n\n# 建立骰子及初始化\ndice1 = game.create_sprite(\"1.png\", \"2.png\", \"3.png\", \"4.png\", \"5.png\", \"6.png\")\ndice2 = game.create_sprite(\"1.png\", \"2.png\", \"3.png\", \"4.png\", \"5.png\", \"6.png\")\ndice3 = game.create_sprite(\"1.png\", \"2.png\", \"3.png\", \"4.png\", \"5.png\", \"6.png\")\ndice4 = game.create_sprite(\"1.png\", \"2.png\", \"3.png\", \"4.png\", \"5.png\", \"6.png\")\n\ndice1.x = 300\ndice1.y = 180\ndice2.x = 500\ndice2.y = 180\ndice3.x = 700\ndice3.y = 180\ndice4.x = 900\ndice4.y = 180\n\nscore = 0\n\ndef dice():\n global score\n a=random.randint(0,5)\n b=random.randint(0,5)\n c=random.randint(0,5)\n d=random.randint(0,5)\n dice1.costume_id=a\n dice2.costume_id=b\n dice3.costume_id=c\n dice4.costume_id=d\n # 隨機產生骰子點數\n if a==b and b==c and c==d:\n score=10000\n if a==b :\n if c==d:\n if a\u003ec:\n score=a+b+2\n else :\n score=c+d+2\n else :\n score=c+d+2\n \n if a==c : \n if b==d:\n if a\u003eb:\n score=a+c+2\n else :\n score=b+d+2\n score=b+d+2\n if a==d:\n if c==b:\n if a\u003ec:\n score=a+d+2\n else:\n score=c+b+2\n else :\n score=b+c+2\n if b==c:\n if a==d:\n if b\u003ea:\n score=b+c+2\n else :\n score=c+a+2\n else :\n score=a+d+2\n if b==d:\n if c==a:\n if b\u003ec:\n score=b+d+2\n else :\n score=c+a+2\n else :\n score=a+c+2\n # 分數顯示以及停止\n if score \u003e 1 and score != 10000:\n game.draw_text(str(score), 600, 620, 'black', 90)\n if score == 10000:\n game.draw_text(\"win\", 600, 620, 'black', 90)\n game.stop()\n\n# enter鍵按下偵測\ngame.on(\"keydown\",\"enter\" ,dice)","created_at":"2020-08-12T09:23:33.908+08:00","updated_at":"2020-08-12T10:56:43.730+08:00","name":"十八仔_S 副本","language":"python","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/180065/84446dbd7f2d810f4ec300d5cb38fbbf.jpg"},"parent_id":162837,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":85,"hashid":"kdmsq3g4","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3070864,"file_name":"player.png","project_id":180065,"asset_id":232683,"created_at":"2020-08-12T09:23:33.914+08:00","updated_at":"2020-08-12T09:23:33.914+08:00"},{"id":3070865,"file_name":"2.png","project_id":180065,"asset_id":23146,"created_at":"2020-08-12T09:23:33.915+08:00","updated_at":"2020-08-12T09:23:33.915+08:00"},{"id":3070866,"file_name":"3.png","project_id":180065,"asset_id":23147,"created_at":"2020-08-12T09:23:33.916+08:00","updated_at":"2020-08-12T09:23:33.916+08:00"},{"id":3070867,"file_name":"4.png","project_id":180065,"asset_id":23148,"created_at":"2020-08-12T09:23:33.917+08:00","updated_at":"2020-08-12T09:23:33.917+08:00"},{"id":3070868,"file_name":"5.png","project_id":180065,"asset_id":23149,"created_at":"2020-08-12T09:23:33.917+08:00","updated_at":"2020-08-12T09:23:33.917+08:00"},{"id":3070869,"file_name":"6.png","project_id":180065,"asset_id":23150,"created_at":"2020-08-12T09:23:33.918+08:00","updated_at":"2020-08-12T09:23:33.918+08:00"},{"id":3070870,"file_name":"1.png","project_id":180065,"asset_id":23145,"created_at":"2020-08-12T09:23:33.919+08:00","updated_at":"2020-08-12T09:23:33.919+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦