{"id":765926,"student_id":10,"content":"from game import *\nfrom random import *\n\ngrid = []\ncover = []\n\nfor y in range(18):\n grid.append([])\n cover.append([])\n for x in range(24):\n n = create_sprite([str(i) + '.png' for i in range(9)] + ['bomb.png'])\n b = create_sprite('cover_0.png', 'cover_1.png')\n b.x = n.x = x * 50 + 25\n b.y = n.y = y * 50 + 25\n b.costume_id = (x + y) % 2\n grid[y].append(n)\n cover[y].append(b)\n \ndef click():\n x = cursor.x // 50\n y = cursor.y // 50\n open_block(x, y)\n \ndef open_block(x, y):\n if x \u003c 0 or y \u003c 0 or x \u003e= 24 or y \u003e= 18: return\n if cover[y][x].hidden == False:\n cover[y][x].hidden = True\n if grid[y][x].costume_id == 0:\n for dx in range(-1, 2):\n for dy in range(-1, 2):\n open_block(x + dx, y + dy)\n if grid[y][x].costume_id == 9: stop()\n \ndef init():\n count = 0\n while count \u003c 24:\n rx = randrange(24)\n ry = randrange(18)\n if grid[ry][rx].costume_id != 9:\n grid[ry][rx].costume_id = 9\n count += 1\n for dx in range(-1, 2):\n for dy in range(-1, 2):\n xx = rx + dx\n yy = ry + dy\n if xx \u003e= 0 and yy \u003e= 0 and xx \u003c 24 and yy \u003c 18:\n if grid[yy][xx].costume_id != 9:\n grid[yy][xx].costume_id += 1\n \ndef loop():\n count = 0\n for x in range(24):\n for y in range(18):\n if cover[y][x].hidden: count += 1\n if count == 24 * 18 - 24:\n stop()\n\non('click', click)\nforever(loop)\ninit()","created_at":"2024-06-06T16:57:05.613+08:00","updated_at":"2024-06-06T18:03:08.664+08:00","name":"踩地雷","language":"python","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/765926/b2128c1747db862fc60a2115ba5cb007.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":49,"hashid":"rdvsvqy2y","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":17096638,"file_name":"2.png","project_id":765926,"asset_id":746720,"created_at":"2024-06-06T16:57:22.396+08:00","updated_at":"2024-06-06T16:57:22.396+08:00"},{"id":17096639,"file_name":"1.png","project_id":765926,"asset_id":746721,"created_at":"2024-06-06T16:57:22.399+08:00","updated_at":"2024-06-06T16:57:22.399+08:00"},{"id":17096632,"file_name":"8.png","project_id":765926,"asset_id":746714,"created_at":"2024-06-06T16:57:21.057+08:00","updated_at":"2024-06-06T16:57:21.057+08:00"},{"id":17096633,"file_name":"7.png","project_id":765926,"asset_id":746715,"created_at":"2024-06-06T16:57:21.059+08:00","updated_at":"2024-06-06T16:57:21.059+08:00"},{"id":17096630,"file_name":"bomb.png","project_id":765926,"asset_id":746712,"created_at":"2024-06-06T16:57:20.672+08:00","updated_at":"2024-06-06T16:57:20.672+08:00"},{"id":17096631,"file_name":"0.png","project_id":765926,"asset_id":746713,"created_at":"2024-06-06T16:57:20.674+08:00","updated_at":"2024-06-06T16:57:20.674+08:00"},{"id":17096636,"file_name":"4.png","project_id":765926,"asset_id":746718,"created_at":"2024-06-06T16:57:21.895+08:00","updated_at":"2024-06-06T16:57:21.895+08:00"},{"id":17096637,"file_name":"3.png","project_id":765926,"asset_id":746719,"created_at":"2024-06-06T16:57:21.897+08:00","updated_at":"2024-06-06T16:57:21.897+08:00"},{"id":17096640,"file_name":"cover_1.png","project_id":765926,"asset_id":746722,"created_at":"2024-06-06T16:59:20.838+08:00","updated_at":"2024-06-06T16:59:20.838+08:00"},{"id":17096641,"file_name":"cover_0.png","project_id":765926,"asset_id":746723,"created_at":"2024-06-06T16:59:20.840+08:00","updated_at":"2024-06-06T16:59:20.840+08:00"},{"id":17096634,"file_name":"6.png","project_id":765926,"asset_id":746716,"created_at":"2024-06-06T16:57:21.476+08:00","updated_at":"2024-06-06T16:57:21.476+08:00"},{"id":17096635,"file_name":"5.png","project_id":765926,"asset_id":746717,"created_at":"2024-06-06T16:57:21.478+08:00","updated_at":"2024-06-06T16:57:21.478+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦