{"id":99776,"date":"2022-03-30T21:44:56","date_gmt":"2022-03-30T13:44:56","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=99776"},"modified":"2022-03-30T21:45:44","modified_gmt":"2022-03-30T13:45:44","slug":"6a764fc302","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=99776","title":{"rendered":"PONG &#8211; 100\u884c\u4ee3\u7801\u5199\u4e00\u4e2a\u5f39\u7403\u6e38\u620f"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\"><span style=\"letter-spacing: 0.544px; caret-color: #000000; background-color: #ffffff;\">\u00a0<\/span><\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\"><span style=\"letter-spacing: 0.544px; caret-color: #000000; background-color: #ffffff;\">\u4eca\u5929\u8ddf\u5927\u5bb6\u8bb2\u4e00\u8bb2\uff1a<strong>\u5982\u4f55\u505a\u6e38\u620f<\/strong><\/span><\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section class=\"channels_iframe_wrp\"><\/section>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u6e38\u620f\u7684\u4e3b\u9898\u662f\u5f39\u7403\u6e38\u620f\u300a<strong>PONG<\/strong>\u300b\uff0c\u5b83\u662f\u53f2\u4e0a\u7b2c\u4e00\u6b3e\u8857\u673a\u6e38\u620f\u3002\u56e0\u6b64\u9009\u5b83\u4f5c\u4e3a\u6211\u8fd9\u4e2a\u6e38\u620f\u5f00\u53d1\u7cfb\u5217\u7684\u7b2c\u4e00\u671f\u4e3b\u9898\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u6e38\u620f\u5f15\u64ce\u7528\u7684\u662f Python \u7684\u4e00\u4e2a\u6e38\u620f\u5e93\uff1a<strong>pgzero<\/strong>\u3002\u5b83\u662f\u5bf9 <strong>pygame<\/strong> \u7684\u4e00\u4e2a\u5c01\u88c5\uff0c\u8ba9\u4f60\u4e0d\u9700\u8981\u5199\u591a\u4f59\u7684\u5957\u8def\u4ee3\u7801\uff0c\u53ea\u8981\u914d\u7f6e\u6e38\u620f\u7684\u5185\u5bb9\u903b\u8f91\u5373\u53ef\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u6211\u4eec\u8fd9\u4e2a\u6e38\u620f\u7528\u5b83\u6765\u5199\uff0c\u4e00\u5171\u53ea\u9700\u8981100\u884c\u4ee3\u7801\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u9996\u5148\u9700\u8981\u5b89\u88c5 python \u73af\u5883\u3002\u8fd9\u4e00\u6b65\u6ca1\u641e\u5b9a\u7684\u540c\u5b66\uff0c\u53ef\u4ee5\u53c2\u8003\u6211\u4eec python \u5165\u95e8\u6559\u7a0b\uff1a<span style=\"color: #ff4c41;\"><strong>python666.cn<\/strong><\/span>\uff0c\u4e0a\u9762\u6709\u8be6\u7ec6\u56fe\u6587\u4ecb\u7ecd\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u7136\u540e\u9700\u8981\u5b89\u88c5 pgzero \u5e93\uff0c\u53ef\u4ee5\u547d\u4ee4\u884c\u4e0b\u901a\u8fc7 pip \u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attribute\">pip<\/span>\u00a0install\u00a0pgzero<\/span><\/code><\/pre>\n<\/section>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u5b89\u88c5\u5b8c\uff0c\u8fd0\u884c\u4e00\u53e5<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__selector-tag\">pgzrun<\/span><span class=\"code-snippet__selector-class\">.go<\/span>()<\/span><\/code><\/pre>\n<\/section>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u6211\u4eec\u7684\u6e38\u620f\u4e16\u754c\u4e4b\u95e8\u5c31\u5df2\u7ecf\u6253\u5f00\u4e86\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"width: 338px; height: 227px;\" title=\"PONG - 100\u884c\u4ee3\u7801\u5199\u4e00\u4e2a\u5f39\u7403\u6e38\u620f\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2022\/03\/3-1648647896.png\" alt=\"PONG - 100\u884c\u4ee3\u7801\u5199\u4e00\u4e2a\u5f39\u7403\u6e38\u620f\" \/><\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u73b0\u5728\u4e0a\u9762\u8fd8\u662f\u6df7\u6c8c\u521d\u5f00\uff0c\u4e00\u7247\u6f06\u9ed1\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u8bbe\u5b9a\u4e00\u4e2a\u77e9\u5f62\u7684\u5de6\u4e0a\u89d2\u5750\u6807\u548c\u957f\u5bbd\uff0c\u5728\u6e38\u620f\u7684\u7ed8\u5236\u51fd\u6570<strong> draw <\/strong>\u4e2d\u7528\u6307\u5b9a\u989c\u8272\u586b\u5145\uff0c\u6211\u4eec\u5c31\u5f97\u5230\u4e86\u4e00\u4e2a\u77e9\u5f62\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__attr\">pad_1<\/span> = Rect((<span class=\"code-snippet__number\">20<\/span>, <span class=\"code-snippet__number\">20<\/span>), (<span class=\"code-snippet__number\">10<\/span>, <span class=\"code-snippet__number\">100<\/span>))<\/span><\/code><code><span class=\"code-snippet_outer\">\n<\/span><\/code><code><span class=\"code-snippet_outer\">def draw():<\/span><\/code><code><span class=\"code-snippet_outer\">    screen.clear()<\/span><\/code><code><span class=\"code-snippet_outer\">\u00a0\u00a0\u00a0\u00a0screen.draw.filled_rect(pad_1,\u00a0'white')<\/span><\/code><\/pre>\n<\/section>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\"><span style=\"display: none; line-height: 0px;\">\u200d<\/span><\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u9002\u5f53\u8c03\u6574\u4e00\u4e0b\uff0c\u5c31\u5f97\u5230\u4e86\u4e00\u5757\u6e38\u620f\u4e2d\u7528\u6765\u6321\u7403\u7684\u677f\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img\" style=\"width: 356px; height: 270px;\" title=\"PONG - 100\u884c\u4ee3\u7801\u5199\u4e00\u4e2a\u5f39\u7403\u6e38\u620f\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2022\/03\/6-1648647896.png\" alt=\"PONG - 100\u884c\u4ee3\u7801\u5199\u4e00\u4e2a\u5f39\u7403\u6e38\u620f\" \/><\/p>\n<p>\u5728\u6e38\u620f\u7684\u66f4\u65b0\u51fd\u6570\u4e2d\u589e\u52a0\u5224\u65ad\uff0c\u5f53\u952e\u76d8\u4e0a\u7684\u201c\u4e0a\u201d\u3001\u201c\u4e0b\u201d\u6309\u952e\u88ab\u6309\u4e0b\u65f6\uff0c\u4fee\u6539\u6321\u677f\u7684y\u5750\u6807\uff0c\u5c31\u53ef\u4ee5\u5728\u6e38\u620f\u4e2d\u63a7\u5236\u6321\u677f\u7684\u79fb\u52a8\u4e86\u3002<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\">PAD_SPEED = <span class=\"code-snippet__number\">10<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">\n<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span>\u00a0<span class=\"code-snippet__title\">update<\/span><span class=\"code-snippet__params\">(dt)<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">if<\/span> keyboard.up:<\/span><\/code><code><span class=\"code-snippet_outer\">        pad_1.y -= PAD_SPEED<\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">elif<\/span> keyboard.down:<\/span><\/code><code><span class=\"code-snippet_outer\">        pad_1.y += PAD_SPEED<\/span><\/code><\/pre>\n<\/section>\n<p>\u8fd9\u6837\u5c31\u5df2\u7ecf\u5b8c\u6210 PONG \u6e38\u620f\u4e2d\u7684\u73a9\u5bb6\u64cd\u63a7\u89d2\u8272\uff1a\u4e00\u5757\u53ef\u4e0a\u4e0b\u79fb\u52a8\u7684\u6321\u677f\u3002\u800c\u73b0\u5728\u6211\u4eec\u7528\u5230\u7684\u4ee3\u7801\u4ec5\u4ec510\u884c\u3002<\/p>\n<p><span style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;\">\u00a0<\/span><\/p>\n<p><span style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;\">\u6709\u7684\u5c0f\u4f19\u4f34\u53ef\u80fd\u6ce8\u610f\u5230\u4e86\uff0c\u8fd9\u91cc\u6709\u4e24\u4e2a\u51fd\u6570\uff0c\u4e00\u4e2a\u53eb <strong>draw<\/strong>\uff0c\u5b83\u662f\u8d1f\u8d23\u6e38\u620f\u4e2d\u7684\u753b\u9762\u7ed8\u5236\uff0c\u53e6\u4e00\u4e2a\u53eb <strong>update<\/strong>\uff0c\u5b83\u8d1f\u8d23\u6e38\u620f\u4e2d\u7684\u903b\u8f91\u66f4\u65b0\u3002<\/span><\/p>\n<p><span style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;\">\u00a0<\/span><\/p>\n<p><span style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;\">\u6211\u4eec\u7ecf\u5e38\u542c\u5230\u8bf4\u6e38\u620f\u8fd0\u884c\u65f6\u901f\u5ea6\u662f\u6bcf\u79d230\u5e27\u300160\u5e27\u4e4b\u7c7b\uff0c\u6216\u8005\u53eb\u505a FPS\uff08Frames Per Second\uff09\u3002draw \u548c update \u5c31\u662f\u5728\u6e38\u620f\u7684\u201c\u4e00\u5e27\u201d\u753b\u9762\u4e2d\u6240\u8981\u505a\u7684\u4e8b\u60c5\u3002\u4f60\u7684\u8ba1\u7b97\u673a\u6216\u8005\u6e38\u620f\u4e3b\u673a\u7684\u6027\u80fd\u8d8a\u9ad8\uff0c\u6bcf\u4e00\u5e27\u6240\u82b1\u8d39\u7684\u8ba1\u7b97\u65f6\u95f4\u5c31\u8d8a\u5c11\uff0c\u6e38\u620f\u5e27\u6570\u5c31\u53ef\u4ee5\u66f4\u9ad8\uff0c\u6e38\u620f\u4f53\u9a8c\u4e5f\u5c31\u66f4\u6d41\u7545\u3002<\/span><\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u521b\u5efa\u4e00\u4e2a\u53eb\u505a <strong>Ball<\/strong> \u7684\u7c7b\u578b\uff0c\u5c5e\u6027\u503c\u5305\u62ec\u4f4d\u7f6e\u548c\u901f\u5ea6\u3002\u7136\u540e\uff0c\u5728\u7ed8\u56fe\u51fd\u6570\u4e2d\u4ee5\u5c0f\u7403\u7684\u4f4d\u7f6e\u4e3a\u5706\u5fc3\u753b\u4e00\u4e2a\u5706\uff0c\u5728\u66f4\u65b0\u51fd\u6570\u4e2d\u6309\u7167\u5300\u901f\u76f4\u7ebf\u8fd0\u52a8\u4f4d\u79fb\u516c\u5f0f\uff0c\u4e5f\u5c31\u662f <strong>\u4f4d\u79fb=\u901f\u5ea6x\u65f6\u95f4<\/strong>\uff0c\u8ba1\u7b97\u51fa\u5c0f\u7403\u4e0b\u4e00\u5e27\u7684\u4f4d\u7f6e\u3002\u5982\u6b64\u5c31\u5b9e\u73b0\u4e86\u4e00\u4e2a\u4f1a\u8fd0\u52a8\u7684\u5c0f\u7403\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__class\"><span class=\"code-snippet__keyword\">class<\/span> <span class=\"code-snippet__title\">Ball<\/span>():<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">\u00a0\u00a0\u00a0\u00a0<span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span>\u00a0<span class=\"code-snippet__title\">__init__<\/span><span class=\"code-snippet__params\">(<span class=\"code-snippet__keyword\">self<\/span>)<\/span><\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span class=\"code-snippet__keyword\">self<\/span>.pos\u00a0=\u00a0[<span class=\"code-snippet__number\">300<\/span>,\u00a0<span class=\"code-snippet__number\">200<\/span>]<\/span><\/code><code><span class=\"code-snippet_outer\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span class=\"code-snippet__keyword\">self<\/span>.speed\u00a0=\u00a0[<span class=\"code-snippet__number\">1<\/span>, <span class=\"code-snippet__number\">1<\/span>]\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">update<\/span><span class=\"code-snippet__params\">(<span class=\"code-snippet__keyword\">self<\/span>, dt)<\/span><\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">for<\/span> i <span class=\"code-snippet__keyword\">in<\/span> range(<span class=\"code-snippet__number\">2<\/span>):<\/span><\/code><code><span class=\"code-snippet_outer\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span class=\"code-snippet__keyword\">self<\/span>.pos[i]\u00a0+=\u00a0<span class=\"code-snippet__keyword\">self<\/span>.speed[i]\u00a0*\u00a0dt<\/span><\/code><code><span class=\"code-snippet_outer\">\n<\/span><\/code><code><span class=\"code-snippet_outer\">ball\u00a0=\u00a0Ball()<\/span><\/code><code><span class=\"code-snippet_outer\">\n<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">draw<\/span><span class=\"code-snippet__params\">()<\/span><\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">    screen.clear()<\/span><\/code><code><span class=\"code-snippet_outer\">    screen.draw.filled_rect(pad_1, <span class=\"code-snippet__string\">'white'<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\">    screen.draw.filled_circle(ball.pos, BALL_RADIUS, <span class=\"code-snippet__string\">'white'<\/span>)<\/span><\/code><code><span class=\"code-snippet_outer\">\u00a0\u00a0<\/span><\/code><\/pre>\n<\/section>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u518d\u8bbe\u7f6e\u4e00\u4e0b\u8fb9\u754c\u6761\u4ef6\uff0c\u8ba9\u5c0f\u7403\u5230\u8fbe\u5c4f\u5e55\u8fb9\u7f18\u65f6\u53ef\u4ee5\u6539\u53d8\u5bf9\u5e94\u7684\u901f\u5ea6\u65b9\u5411\uff0c\u78b0\u5230\u4e0a\u4e0b\u8fb9\u7f18\u5c31\u5c06y\u901f\u5ea6\u5206\u91cf\u4e58\u4ee5-1\uff0c\u8d85\u51fa\u5de6\u53f3\u8fb9\u7f18\u5219\u4f4d\u7f6e\u91cd\u65b0\u8bbe\u7f6e\u56de\u5c4f\u5e55\u4e2d\u5fc3\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__class\"><span class=\"code-snippet__keyword\">class<\/span> <span class=\"code-snippet__title\">Ball<\/span>():<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    ...      <\/span><\/code><code><span class=\"code-snippet_outer\">\n<\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">update<\/span><span class=\"code-snippet__params\">(<span class=\"code-snippet__keyword\">self<\/span>, dt)<\/span><\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">for<\/span> i <span class=\"code-snippet__keyword\">in<\/span> range(<span class=\"code-snippet__number\">2<\/span>):<\/span><\/code><code><span class=\"code-snippet_outer\">            <span class=\"code-snippet__keyword\">self<\/span>.pos[i] += <span class=\"code-snippet__keyword\">self<\/span>.speed[i]<\/span><\/code><code><span class=\"code-snippet_outer\">\n<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">if<\/span> <span class=\"code-snippet__keyword\">self<\/span>.pos[<span class=\"code-snippet__number\">1<\/span>] &lt; <span class=\"code-snippet__number\">0<\/span> <span class=\"code-snippet__keyword\">or<\/span> <span class=\"code-snippet__keyword\">self<\/span>.pos[<span class=\"code-snippet__number\">1<\/span>] &gt; <span class=\"code-snippet__symbol\">HEIGHT:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">            <span class=\"code-snippet__keyword\">self<\/span>.speed[<span class=\"code-snippet__number\">1<\/span>] *= -<span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">if<\/span> <span class=\"code-snippet__keyword\">self<\/span>.pos[<span class=\"code-snippet__number\">0<\/span>] &lt; <span class=\"code-snippet__number\">0<\/span> <span class=\"code-snippet__keyword\">or<\/span> <span class=\"code-snippet__keyword\">self<\/span>.pos[<span class=\"code-snippet__number\">0<\/span>] &gt; <span class=\"code-snippet__symbol\">WIDTH:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">            <span class=\"code-snippet__keyword\">self<\/span>.reset()<\/span><\/code><\/pre>\n<\/section>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u6709\u4e86\u677f\uff0c\u6709\u4e86\u7403\uff0c\u63a5\u4e0b\u6765\u5c31\u662f\u8ba9\u4ed6\u4eec\u4e4b\u95f4\u4ea7\u751f\u5173\u8054\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u5728\u66f4\u65b0\u51fd\u6570\u4e2d\u505a\u4e00\u4e2a\u78b0\u649e\u68c0\u6d4b\uff1a\u5982\u679c\u677f\u5b50\u7684\u77e9\u5f62\u4e0e\u7403\u7684\u5706\u5fc3\u4ea7\u751f\u4e86\u4ea4\u96c6\uff0c\u5c31\u8ba9\u7403\u53cd\u5f39\u56de\u53bb\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">update<\/span><span class=\"code-snippet__params\">(dt)<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">\u00a0\u00a0\u00a0\u00a0...<\/span><\/code><code><span class=\"code-snippet_outer\">\u00a0\u00a0\u00a0\u00a0<\/span><\/code><code><span class=\"code-snippet_outer\">    ball.update(dt)<\/span><\/code><code><span class=\"code-snippet_outer\">\n<\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">if<\/span> pad_1.collidepoint(ball.pos) <span class=\"code-snippet__keyword\">and<\/span> ball.speed[<span class=\"code-snippet__number\">0<\/span>] &lt; <span class=\"code-snippet__number\">0<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">        ball.speed[<span class=\"code-snippet__number\">0<\/span>] *= <span class=\"code-snippet__number\">-1<\/span><\/span><\/code><\/pre>\n<\/section>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u5230\u8fd9\u4e00\u6b65\uff0c\u6e38\u620f\u7684\u6838\u5fc3\u7269\u7406\u89c4\u5219\u5c31\u5df2\u7ecf\u5b9a\u4e49\u5b8c\u6bd5\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\u6309\u7167\u540c\u6837\u7684\u65b9\u6cd5\uff0c\u5728\u5c4f\u5e55\u7684\u53f3\u4fa7\u521b\u5efa\u7b2c\u4e8c\u5757\u677f\uff0c\u901a\u8fc7\u53e6\u5916\u7684\u6309\u952e\u8fdb\u884c\u63a7\u5236\u3002\u7136\u540e\uff0c\u5f53\u5c0f\u7403\u8d85\u51fa\u5de6\u53f3\u8fb9\u754c\u65f6\uff0c\u5206\u522b\u7ed9\u5bf9\u9762\u4e00\u65b9\u5f97\u5206\u3002<\/p>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__class\"><span class=\"code-snippet__keyword\">class<\/span> <span class=\"code-snippet__title\">Ball<\/span>():<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    ...      <\/span><\/code><code><span class=\"code-snippet_outer\">\n<\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">dead<\/span><span class=\"code-snippet__params\">(<span class=\"code-snippet__keyword\">self<\/span>, side)<\/span><\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">        scores[side] += <span class=\"code-snippet__number\">1<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">self<\/span>.reset()<\/span><\/code><\/pre>\n<\/section>\n<p style=\"caret-color: #000000; white-space: normal; max-width: 100%; min-height: 1em; font-family: -apple-system-font, system-ui, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; letter-spacing: 0.544px; background-color: #ffffff; box-sizing: border-box !important; overflow-wrap: break-word !important;\">\n<p>\u8fd9\u6837\uff0c\u4e00\u4e2a\u6700\u6700\u7b80\u5355\u7684\uff0c\u53cc\u4eba\u7248\u5f39\u7403\u6e38\u620f\u5c31\u5b8c\u6210\u4e86\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u5982\u679c\u4f60\u627e\u4e0d\u5230\u53e6\u4e00\u4e2a\u4eba\u966a\u4f60\u4e00\u8d77\u73a9\uff0c\u4e5f\u53ef\u4ee5\u8ba9\u81ea\u5df1\u7684\u5de6\u624b\u8ddf\u53f3\u624b\u73a9\u3002<\/p>\n<p>\u6216\u8005\uff0c\u7ed9\u4e00\u4fa7\u677f\u589e\u52a0\u4e00\u70b9\u81ea\u52a8\u8ffd\u8e2a\u7684\u4ee3\u7801\uff1a\u8ba9\u677f\u7684\u4f4d\u7f6e\u968f\u7740\u7403\u7684\u4f4d\u7f6e\u79fb\u52a8\u3002\u8fd9\u4e5f\u7b97\u662f\u4e00\u4e2a\u6e38\u620fAI\u4e86\u3002<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__function\"><span class=\"code-snippet__keyword\">def<\/span> <span class=\"code-snippet__title\">auto_move_pad<\/span><span class=\"code-snippet__params\">(dt)<\/span>:<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">    <span class=\"code-snippet__keyword\">if<\/span> ball.pos[<span class=\"code-snippet__number\">0<\/span>] &gt; WIDTH \/ <span class=\"code-snippet__number\">2<\/span> <span class=\"code-snippet__keyword\">and<\/span> ball.speed[<span class=\"code-snippet__number\">0<\/span>] &gt; <span class=\"code-snippet__number\">0<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">if<\/span> pad_2.y + pad_2.height * <span class=\"code-snippet__number\">0.25<\/span> &gt; ball.pos[<span class=\"code-snippet__number\">1<\/span>]:<\/span><\/code><code><span class=\"code-snippet_outer\">            pad_2.y -= PAD_SPEED * dt<\/span><\/code><code><span class=\"code-snippet_outer\">            <span class=\"code-snippet__keyword\">if<\/span> pad_2.top &lt; <span class=\"code-snippet__number\">0<\/span>:<\/span><\/code><code><span class=\"code-snippet_outer\">                pad_2.top = <span class=\"code-snippet__number\">0<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">        <span class=\"code-snippet__keyword\">elif<\/span> pad_2.y + pad_2.height * <span class=\"code-snippet__number\">0.75<\/span> &lt; ball.pos[<span class=\"code-snippet__number\">1<\/span>]:<\/span><\/code><code><span class=\"code-snippet_outer\">            pad_2.y += PAD_SPEED * dt<\/span><\/code><code><span class=\"code-snippet_outer\">            <span class=\"code-snippet__keyword\">if<\/span> pad_2.bottom &gt; HEIGHT:<\/span><\/code><code><span class=\"code-snippet_outer\">                pad_2.bottom = HEIGHT<\/span><\/code><\/pre>\n<\/section>\n<p>\u81f3\u6b64\uff0c\u4e00\u4e2a\u5177\u5907\u5b8c\u6574\u6838\u5fc3\u73a9\u6cd5\u7684\u5f39\u7403\u6e38\u620f PONG \u5df2\u7ecf\u5b8c\u6210\u4e86\u3002\u52a0\u4e0a\u7a7a\u683c\u4e5f\u4e0d\u5230100\u884c\u4ee3\u7801\u3002\u7279\u522b\u9002\u5408\u7f16\u7a0b\u65b0\u624b\u521a\u521a\u63a5\u89e6\u6e38\u620f\u5f00\u53d1\u7684\u5c0f\u4f19\u4f34\u8fdb\u884c\u7ec3\u4e60\u3002<\/p>\n<p>\u4e0d\u8fc7\uff0c\u6211\u8fd8\u7ed9\u6e38\u620f\u589e\u52a0\u4e86\u4e00\u70b9\u70b9\u7ec6\u8282\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u53ef\u70b9\u51fb\u6587\u7ae0\u5f00\u5934\u7684\u89c6\u9891\u8fdb\u884c\u89c2\u770b\u3002\u559c\u6b22\u7684\u8bdd\u6b22\u8fce\u70b9\u8d5e\u548c\u8f6c\u53d1\uff01<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img js_insertlocalimg\" title=\"PONG - 100\u884c\u4ee3\u7801\u5199\u4e00\u4e2a\u5f39\u7403\u6e38\u620f\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2022\/03\/4-1648647897.gif\" alt=\"PONG - 100\u884c\u4ee3\u7801\u5199\u4e00\u4e2a\u5f39\u7403\u6e38\u620f\" \/><\/p>\n<p>\u4e4b\u540e\u6211\u8fd8\u4f1a\u6765\u5c1d\u8bd5\u66f4\u591a\u7684\u6e38\u620f\u7c7b\u578b\uff0c\u66f4\u591a\u7684\u73a9\u6cd5\u3002\u4e89\u53d6\u5b8c\u6210\u6700\u521d\u7acb\u4e0b\u7684FLAG\uff1a<strong>\u5b9e\u73b0100\u4e2a\u6e38\u620f<\/strong>\u3002<span style=\"font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;\">\u5982\u679c\u4f60\u60f3\u770b\u67d0\u7c7b\u6e38\u620f\u6216\u8005\u67d0\u4e2a\u6e38\u620f\u7684\u5b9e\u73b0\uff0c\u6216\u8005\u5bf9\u67d0\u4e2a\u5b9e\u73b0\u7ec6\u8282\u6709\u7591\u95ee\uff0c\u4e5f\u53ef\u4ee5\u7559\u8a00\u4e2d\u544a\u8bc9\u6211\uff0c\u6211\u4f1a\u4f18\u5148\u8003\u8651\u3002<\/span><\/p>\n<p>\u4ee3\u7801\u5df2\u7ecf\u5f00\u6e90\uff0c\u83b7\u53d6\u8bf7\u5728\u516c\u4f17\u53f7\u201c<strong>Crossin\u7684\u7f16\u7a0b\u6559\u5ba4<\/strong>\u201d\u540e\u53f0\u56de\u590d\u5173\u952e\u8bcd\uff1a<span style=\"color: #ff4c41;\"><strong>pong<\/strong><\/span><\/p>\n<section><\/section>\n<section><\/section>\n<hr style=\"caret-color: #000000; white-space: normal; border-style: solid; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-color: rgba(0, 0, 0, 0.1); transform-origin: 0px 0px; transform: scale(1, 0.5);\" \/>\n<hr style=\"caret-color: #000000; max-width: 100%; letter-spacing: 0.544px; font-family: monospace; white-space: pre-wrap; text-align: center; word-spacing: 2px; border-style: solid; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-color: rgba(0, 0, 0, 0.1); transform-origin: 0px 0px; transform: scale(1, 0.5); box-sizing: border-box !important; overflow-wrap: break-word !important;\" \/>\n<p>\u8f6c\u81ea\uff1ahttps:\/\/mp.weixin.qq.com\/s\/64iupQIhUf0n45p0qlJ9xw<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u4eca\u5929\u8ddf\u5927\u5bb6\u8bb2\u4e00\u8bb2\uff1a\u5982\u4f55\u505a\u6e38\u620f \u6e38\u620f\u7684\u4e3b\u9898\u662f\u5f39\u7403\u6e38\u620f\u300aPONG\u300b\uff0c\u5b83\u662f\u53f2\u4e0a\u7b2c\u4e00\u6b3e\u8857\u673a\u6e38\u620f\u3002\u56e0\u6b64\u9009\u5b83\u4f5c\u4e3a\u6211\u8fd9\u4e2a &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=99776\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cPONG &#8211; 100\u884c\u4ee3\u7801\u5199\u4e00\u4e2a\u5f39\u7403\u6e38\u620f\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[8,890],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/99776"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=99776"}],"version-history":[{"count":2,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/99776\/revisions"}],"predecessor-version":[{"id":99783,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/99776\/revisions\/99783"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=99776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=99776"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=99776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}