{"id":174123,"student_id":10,"content":"import game\nimport random\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.move_to(300, 180)\ndice2.move_to(500, 180)\ndice3.move_to(700, 180)\ndice4.move_to(900, 180)\n\n\ndef onclick ():\n dice1.costume_id = random.randrange(6)\n dice2.costume_id = random.randrange(6)\n dice3.costume_id = random.randrange(6)\n dice4.costume_id = random.randrange(6)\n\ndef loop():\n \n text = ''\n \n n1 = dice1.costume_id + 1\n n2 = dice2.costume_id + 1\n n3 = dice3.costume_id + 1\n n4 = dice4.costume_id + 1\n \n # 如果四個骰子相同\n if n1 == n2 and n2 == n3 and n3 == n4:\n text = '18 啦!'\n \n # 1、2 相同 而且 3、4 不相同 而且沒有 3 個一樣\n elif n1 == n2 and n3 != n4 and n1 != n3 and n1 != n4:\n text = n3 + n4\n \n # 1、3 相同 而且 2、4 不相同 而且沒有 3 個一樣\n elif n1 == n3 and n2 != n4 and n1 != n2 and n1 != n4:\n text = n2 + n4\n \n # 1、4 相同 而且 2、3 不相同 而且沒有 3 個一樣\n elif n1 == n4 and n2 != n4 and n1 != n2 and n1 != n3:\n text = n2 + n3\n \n # 2、3 相同 而且 1、4 不相同 而且沒有 3 個一樣\n elif n2 == n3 and n1 != n4 and n2 != n1 and n2 != n4:\n text = n1 + n4\n \n # 2、4 相同 而且 1、3 不相同 而且沒有 3 個一樣\n elif n2 == n4 and n1 != n3 and n2 != n1 and n2 != n3:\n text = n1 + n3\n \n # 3、4 相同 而且 1、2 不相同 而且沒有 3 個一樣\n elif n3 == n4 and n1 != n2 and n3 != n1 and n3 != n2:\n text = n1 + n2\n \n # 1、2 相同 而且 3、4 相同\n elif n1 == n2 and n3 == n4:\n if n1 \u003e n3:\n text = n1 + n2\n else:\n text = n3 + n4\n \n # 1、3 相同 而且 2、4 相同\n elif n1 == n3 and n2 == n4:\n if n1 \u003e n2:\n text = n1 + n3\n else:\n text = n2 + n4\n \n # 1、3 相同 而且 2、3 相同\n elif n1 == n4 and n2 == n3:\n if n1 \u003e n2:\n text = n1 + n4\n else:\n text = n2 + n3\n \n else:\n text = 'ㄋ要重骰一次囉!'\n \n \n game.draw_text(str(text), 300, 620, 'black', 90)\n game.draw_text('n1', 300, 50, 'black', 60)\n game.draw_text('n2', 500, 50, 'black', 60)\n game.draw_text('n3', 700, 50, 'black', 60)\n game.draw_text('n4', 900, 50, 'black', 60)\n\ngame.on(\"enter\", onclick)\ngame.forever(loop)\n ","created_at":"2020-07-31T12:19:34.538+08:00","updated_at":"2020-07-31T14:24:57.760+08:00","name":"十八仔_T 副本","language":"python","screenshot":{"url":"/uploads/project/screenshot/174123/ad7bb076957d062d69ffbde70a5a3681.jpg"},"parent_id":162838,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":417,"hashid":"6rpsp546","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2987112,"file_name":"1.png","project_id":174123,"asset_id":23145,"created_at":"2020-07-31T12:19:34.545+08:00","updated_at":"2020-07-31T12:19:34.545+08:00"},{"id":2987113,"file_name":"6.png","project_id":174123,"asset_id":23150,"created_at":"2020-07-31T12:19:34.546+08:00","updated_at":"2020-07-31T12:19:34.546+08:00"},{"id":2987114,"file_name":"5.png","project_id":174123,"asset_id":23149,"created_at":"2020-07-31T12:19:34.548+08:00","updated_at":"2020-07-31T12:19:34.548+08:00"},{"id":2987115,"file_name":"4.png","project_id":174123,"asset_id":23148,"created_at":"2020-07-31T12:19:34.549+08:00","updated_at":"2020-07-31T12:19:34.549+08:00"},{"id":2987116,"file_name":"3.png","project_id":174123,"asset_id":23147,"created_at":"2020-07-31T12:19:34.551+08:00","updated_at":"2020-07-31T12:19:34.551+08:00"},{"id":2987117,"file_name":"2.png","project_id":174123,"asset_id":23146,"created_at":"2020-07-31T12:19:34.552+08:00","updated_at":"2020-07-31T12:19:34.552+08:00"},{"id":2987118,"file_name":"player.png","project_id":174123,"asset_id":232683,"created_at":"2020-07-31T12:19:34.553+08:00","updated_at":"2020-07-31T12:19:34.553+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Screenshot
繁中
简中
English
日本語
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer