找回密码
 立即注册
搜索
查看: 69|回复: 10

Python开发的英文打字小游戏

[复制链接]
灌水成绩
5
2
75
主题
帖子
积分

等级头衔 ID : 608
用户组 : 注册会员

积分成就 测量币 : 75
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 2026-4-17 21:55:00 | 显示全部楼层 |阅读模式
最近在教舅舅家上初二的儿子Python编程,觉得对于男孩来说,用Python开发游戏是一个特别好的方式。因为观察到他之前只用过iPad,用电脑的机会很少,打字很慢,而且不会双手十指分工,所有的字母均使用右手食指盯着键盘输入,看着很让人捉急
。因此想着用Python开发一个英文打字小游戏,一是帮助他提高打字速度,二是可以顺便复习英文单词,三是通过这个过程学习Python编程。主要使用的是pygame 2.5.2 (SDL 2.28.3, Python 3.12.6),一共750行代码左右。带背景音乐,正确和错误个数、准确率提示,带计时功能。
下载链接如下(带exe格式的游戏,源代码和音乐素材):
https://pan.baidu.com/s/1bKw7-wZknEO9MhokfvhybA?pwd=52pj

同时把源代码分享如下,请大家多多指教:
[Python] 纯文本查看 复制代码import pygameimport randomimport mathimport sysimport osfrom pygame.locals import *folder_name = os.path.dirname(__file__)bg_music = os.path.join(folder_name, '丛林.ogg')# 初始化Pygamepygame.init()pygame.mixer.init()pygame.mixer.music.load(bg_music)pygame.mixer.music.play(-1)# 游戏窗口设置WIDTH, HEIGHT = 1000, 700screen = pygame.display.set_mode((WIDTH, HEIGHT))pygame.display.set_caption(&quot;Let's Type&quot;)# 颜色定义BACKGROUND = (10, 10, 30)  # 深蓝色背景STAR_COLORS = [    (255, 255, 200),  # 亮黄色    (200, 220, 255),  # 淡蓝色    (255, 220, 180),  # 淡橙色    (220, 255, 220),  # 淡绿色]TEXT_COLOR = (240, 240, 255)  # 亮白色CORRECT_COLOR = (100, 255, 150)  # 绿色INCORRECT_COLOR = (255, 100, 100)  # 红色INPUT_COLOR = (255, 255, 200)  # 黄色STATS_COLOR = (180, 220, 255)  # 淡蓝色PROGRESS_COLOR = (100, 200, 255)  # 蓝色HINT_COLOR = (200, 200, 255)  # 淡紫色BUTTON_COLORS = {    &quot;normal&quot;: (60, 100, 180),    &quot;hover&quot;: (80, 140, 220),    &quot;pressed&quot;: (40, 80, 160)}# 常用300个英文单词(初中水平)及其中文释义WORD_LIST = [    (&quot;the&quot;, &quot;这个&quot;), (&quot;be&quot;, &quot;是&quot;), (&quot;and&quot;, &quot;和&quot;), (&quot;of&quot;, &quot;...的&quot;), (&quot;a&quot;, &quot;一个&quot;),    (&quot;to&quot;, &quot;到&quot;), (&quot;in&quot;, &quot;在...里&quot;), (&quot;have&quot;, &quot;有&quot;), (&quot;it&quot;, &quot;它&quot;),     (&quot;that&quot;, &quot;那个&quot;), (&quot;for&quot;, &quot;为了&quot;), (&quot;you&quot;, &quot;你&quot;), (&quot;he&quot;, &quot;他&quot;), (&quot;with&quot;, &quot;和...一起&quot;),    (&quot;on&quot;, &quot;在...上&quot;), (&quot;do&quot;, &quot;做&quot;), (&quot;say&quot;, &quot;说&quot;), (&quot;this&quot;, &quot;这个&quot;), (&quot;they&quot;, &quot;他们&quot;),    (&quot;at&quot;, &quot;在&quot;), (&quot;but&quot;, &quot;但是&quot;), (&quot;we&quot;, &quot;我们&quot;), (&quot;his&quot;, &quot;他的&quot;), (&quot;from&quot;, &quot;从&quot;),    (&quot;not&quot;, &quot;不&quot;), (&quot;by&quot;, &quot;被&quot;), (&quot;she&quot;, &quot;她&quot;), (&quot;or&quot;, &quot;或者&quot;), (&quot;as&quot;, &quot;如同&quot;),    (&quot;what&quot;, &quot;什么&quot;), (&quot;go&quot;, &quot;去&quot;), (&quot;their&quot;, &quot;他们的&quot;), (&quot;can&quot;, &quot;能&quot;), (&quot;who&quot;, &quot;谁&quot;),    (&quot;get&quot;, &quot;得到&quot;), (&quot;if&quot;, &quot;如果&quot;), (&quot;would&quot;, &quot;将&quot;), (&quot;her&quot;, &quot;她的&quot;), (&quot;all&quot;, &quot;所有&quot;),    (&quot;my&quot;, &quot;我的&quot;), (&quot;make&quot;, &quot;制作&quot;), (&quot;about&quot;, &quot;关于&quot;), (&quot;know&quot;, &quot;知道&quot;), (&quot;will&quot;, &quot;将&quot;),    (&quot;up&quot;, &quot;向上&quot;), (&quot;one&quot;, &quot;一个&quot;), (&quot;time&quot;, &quot;时间&quot;), (&quot;there&quot;, &quot;那里&quot;), (&quot;year&quot;, &quot;年&quot;),    (&quot;so&quot;, &quot;所以&quot;), (&quot;think&quot;, &quot;想&quot;), (&quot;when&quot;, &quot;当...时&quot;), (&quot;which&quot;, &quot;哪一个&quot;), (&quot;them&quot;, &quot;他们&quot;),    (&quot;some&quot;, &quot;一些&quot;), (&quot;me&quot;, &quot;我&quot;), (&quot;people&quot;, &quot;人们&quot;), (&quot;take&quot;, &quot;拿&quot;), (&quot;out&quot;, &quot;出去&quot;),    (&quot;into&quot;, &quot;进入&quot;), (&quot;just&quot;, &quot;刚刚&quot;), (&quot;see&quot;, &quot;看见&quot;), (&quot;him&quot;, &quot;他&quot;), (&quot;your&quot;, &quot;你的&quot;),    (&quot;come&quot;, &quot;来&quot;), (&quot;could&quot;, &quot;能够&quot;), (&quot;now&quot;, &quot;现在&quot;), (&quot;than&quot;, &quot;比&quot;), (&quot;like&quot;, &quot;喜欢&quot;),    (&quot;other&quot;, &quot;其他&quot;), (&quot;how&quot;, &quot;如何&quot;), (&quot;then&quot;, &quot;然后&quot;), (&quot;its&quot;, &quot;它的&quot;), (&quot;our&quot;, &quot;我们的&quot;),    (&quot;two&quot;, &quot;两个&quot;), (&quot;more&quot;, &quot;更多&quot;), (&quot;these&quot;, &quot;这些&quot;), (&quot;want&quot;, &quot;想要&quot;), (&quot;way&quot;, &quot;方式&quot;),    (&quot;look&quot;, &quot;看&quot;), (&quot;first&quot;, &quot;第一&quot;), (&quot;also&quot;, &quot;也&quot;), (&quot;new&quot;, &quot;新的&quot;), (&quot;because&quot;, &quot;因为&quot;),    (&quot;day&quot;, &quot;天&quot;), (&quot;use&quot;, &quot;使用&quot;), (&quot;man&quot;, &quot;男人&quot;), (&quot;find&quot;, &quot;找到&quot;), (&quot;water&quot;, &quot;水&quot;),    (&quot;been&quot;, &quot;曾经&quot;), (&quot;call&quot;, &quot;呼叫&quot;), (&quot;oil&quot;, &quot;油&quot;), (&quot;now&quot;, &quot;现在&quot;), (&quot;find&quot;, &quot;发现&quot;),    (&quot;long&quot;, &quot;长的&quot;), (&quot;down&quot;, &quot;向下&quot;), (&quot;day&quot;, &quot;白天&quot;), (&quot;did&quot;, &quot;做了&quot;), (&quot;get&quot;, &quot;得到&quot;),    (&quot;come&quot;, &quot;来&quot;), (&quot;made&quot;, &quot;制造了&quot;), (&quot;may&quot;, &quot;可能&quot;), (&quot;part&quot;, &quot;部分&quot;), (&quot;over&quot;, &quot;超过&quot;),    (&quot;new&quot;, &quot;新的&quot;), (&quot;sound&quot;, &quot;声音&quot;), (&quot;take&quot;, &quot;拿&quot;), (&quot;only&quot;, &quot;只有&quot;), (&quot;little&quot;, &quot;小的&quot;),    (&quot;work&quot;, &quot;工作&quot;), (&quot;know&quot;, &quot;知道&quot;), (&quot;place&quot;, &quot;地方&quot;), (&quot;year&quot;, &quot;年&quot;), (&quot;live&quot;, &quot;生活&quot;),    (&quot;me&quot;, &quot;我&quot;), (&quot;back&quot;, &quot;后面&quot;), (&quot;give&quot;, &quot;给&quot;), (&quot;most&quot;, &quot;大多数&quot;), (&quot;very&quot;, &quot;非常&quot;),    (&quot;after&quot;, &quot;之后&quot;), (&quot;thing&quot;, &quot;事情&quot;), (&quot;our&quot;, &quot;我们的&quot;), (&quot;just&quot;, &quot;只是&quot;), (&quot;name&quot;, &quot;名字&quot;),    (&quot;good&quot;, &quot;好的&quot;), (&quot;sentence&quot;, &quot;句子&quot;), (&quot;man&quot;, &quot;男人&quot;), (&quot;think&quot;, &quot;认为&quot;), (&quot;say&quot;, &quot;说&quot;),    (&quot;great&quot;, &quot;伟大的&quot;), (&quot;where&quot;, &quot;哪里&quot;), (&quot;help&quot;, &quot;帮助&quot;), (&quot;through&quot;, &quot;通过&quot;), (&quot;much&quot;, &quot;很多&quot;),    (&quot;before&quot;, &quot;之前&quot;), (&quot;line&quot;, &quot;线&quot;), (&quot;right&quot;, &quot;正确&quot;), (&quot;too&quot;, &quot;也&quot;), (&quot;mean&quot;, &quot;意思&quot;),    (&quot;old&quot;, &quot;老的&quot;), (&quot;any&quot;, &quot;任何&quot;), (&quot;same&quot;, &quot;相同的&quot;), (&quot;tell&quot;, &quot;告诉&quot;), (&quot;boy&quot;, &quot;男孩&quot;),    (&quot;follow&quot;, &quot;跟随&quot;), (&quot;came&quot;, &quot;来了&quot;), (&quot;want&quot;, &quot;想要&quot;), (&quot;show&quot;, &quot;展示&quot;), (&quot;around&quot;, &quot;周围&quot;),    (&quot;form&quot;, &quot;形式&quot;), (&quot;three&quot;, &quot;三&quot;), (&quot;small&quot;, &quot;小的&quot;), (&quot;set&quot;, &quot;设置&quot;), (&quot;put&quot;, &quot;放&quot;),    (&quot;end&quot;, &quot;结束&quot;), (&quot;does&quot;, &quot;做&quot;), (&quot;another&quot;, &quot;另一个&quot;), (&quot;well&quot;, &quot;好&quot;), (&quot;large&quot;, &quot;大的&quot;),    (&quot;must&quot;, &quot;必须&quot;), (&quot;big&quot;, &quot;大的&quot;), (&quot;even&quot;, &quot;甚至&quot;), (&quot;such&quot;, &quot;这样的&quot;), (&quot;turn&quot;, &quot;转&quot;),    (&quot;here&quot;, &quot;这里&quot;), (&quot;why&quot;, &quot;为什么&quot;), (&quot;ask&quot;, &quot;问&quot;), (&quot;went&quot;, &quot;去了&quot;), (&quot;men&quot;, &quot;男人们&quot;),    (&quot;read&quot;, &quot;读&quot;), (&quot;need&quot;, &quot;需要&quot;), (&quot;land&quot;, &quot;土地&quot;), (&quot;different&quot;, &quot;不同的&quot;), (&quot;home&quot;, &quot;家&quot;),    (&quot;us&quot;, &quot;我们&quot;), (&quot;move&quot;, &quot;移动&quot;), (&quot;try&quot;, &quot;尝试&quot;), (&quot;kind&quot;, &quot;种类&quot;), (&quot;hand&quot;, &quot;手&quot;),    (&quot;picture&quot;, &quot;图片&quot;), (&quot;again&quot;, &quot;再次&quot;), (&quot;change&quot;, &quot;改变&quot;), (&quot;off&quot;, &quot;离开&quot;), (&quot;play&quot;, &quot;玩&quot;),    (&quot;spell&quot;, &quot;拼写&quot;), (&quot;air&quot;, &quot;空气&quot;), (&quot;away&quot;, &quot;离开&quot;), (&quot;animal&quot;, &quot;动物&quot;), (&quot;house&quot;, &quot;房子&quot;),    (&quot;point&quot;, &quot;点&quot;), (&quot;page&quot;, &quot;页面&quot;), (&quot;letter&quot;, &quot;信&quot;), (&quot;mother&quot;, &quot;母亲&quot;), (&quot;answer&quot;, &quot;答案&quot;),    (&quot;found&quot;, &quot;发现&quot;), (&quot;study&quot;, &quot;学习&quot;), (&quot;still&quot;, &quot;仍然&quot;), (&quot;learn&quot;, &quot;学习&quot;), (&quot;should&quot;, &quot;应该&quot;),    (&quot;world&quot;, &quot;世界&quot;), (&quot;high&quot;, &quot;高的&quot;), (&quot;every&quot;, &quot;每个&quot;), (&quot;near&quot;, &quot;近的&quot;),    (&quot;add&quot;, &quot;添加&quot;), (&quot;food&quot;, &quot;食物&quot;), (&quot;between&quot;, &quot;之间&quot;), (&quot;own&quot;, &quot;自己的&quot;), (&quot;below&quot;, &quot;下面&quot;),    (&quot;country&quot;, &quot;国家&quot;), (&quot;plant&quot;, &quot;植物&quot;), (&quot;last&quot;, &quot;最后的&quot;), (&quot;school&quot;, &quot;学校&quot;), (&quot;father&quot;, &quot;父亲&quot;),    (&quot;keep&quot;, &quot;保持&quot;), (&quot;tree&quot;, &quot;树&quot;), (&quot;never&quot;, &quot;从不&quot;), (&quot;start&quot;, &quot;开始&quot;), (&quot;city&quot;, &quot;城市&quot;),    (&quot;earth&quot;, &quot;地球&quot;), (&quot;eye&quot;, &quot;眼睛&quot;), (&quot;light&quot;, &quot;光&quot;), (&quot;thought&quot;, &quot;思想&quot;), (&quot;head&quot;, &quot;头&quot;),    (&quot;under&quot;, &quot;下面&quot;), (&quot;story&quot;, &quot;故事&quot;), (&quot;saw&quot;, &quot;看见&quot;), (&quot;left&quot;, &quot;左边&quot;),     (&quot;few&quot;, &quot;很少&quot;), (&quot;while&quot;, &quot;当...时&quot;), (&quot;along&quot;, &quot;沿着&quot;), (&quot;might&quot;, &quot;可能&quot;), (&quot;close&quot;, &quot;关闭&quot;),    (&quot;something&quot;, &quot;某事&quot;), (&quot;seem&quot;, &quot;似乎&quot;), (&quot;next&quot;, &quot;下一个&quot;), (&quot;hard&quot;, &quot;困难的&quot;), (&quot;open&quot;, &quot;打开&quot;),    (&quot;example&quot;, &quot;例子&quot;), (&quot;begin&quot;, &quot;开始&quot;), (&quot;life&quot;, &quot;生活&quot;), (&quot;always&quot;, &quot;总是&quot;), (&quot;those&quot;, &quot;那些&quot;),    (&quot;both&quot;, &quot;两者&quot;), (&quot;paper&quot;, &quot;纸&quot;), (&quot;together&quot;, &quot;一起&quot;), (&quot;got&quot;, &quot;得到&quot;), (&quot;group&quot;, &quot;组&quot;),    (&quot;often&quot;, &quot;经常&quot;), (&quot;run&quot;, &quot;跑&quot;), (&quot;important&quot;, &quot;重要的&quot;), (&quot;until&quot;, &quot;直到&quot;), (&quot;children&quot;, &quot;孩子们&quot;),    (&quot;side&quot;, &quot;边&quot;), (&quot;feet&quot;, &quot;脚&quot;), (&quot;car&quot;, &quot;汽车&quot;), (&quot;mile&quot;, &quot;英里&quot;), (&quot;night&quot;, &quot;夜晚&quot;),    (&quot;walk&quot;, &quot;走&quot;), (&quot;white&quot;, &quot;白色&quot;), (&quot;sea&quot;, &quot;海洋&quot;), (&quot;began&quot;, &quot;开始&quot;), (&quot;grow&quot;, &quot;生长&quot;),    (&quot;took&quot;, &quot;拿了&quot;), (&quot;river&quot;, &quot;河流&quot;), (&quot;four&quot;, &quot;四&quot;), (&quot;carry&quot;, &quot;携带&quot;), (&quot;state&quot;, &quot;州&quot;),    (&quot;once&quot;, &quot;一次&quot;), (&quot;book&quot;, &quot;书&quot;), (&quot;hear&quot;, &quot;听到&quot;), (&quot;stop&quot;, &quot;停止&quot;), (&quot;without&quot;, &quot;没有&quot;),    (&quot;second&quot;, &quot;第二&quot;), (&quot;later&quot;, &quot;后来&quot;), (&quot;miss&quot;, &quot;想念&quot;), (&quot;idea&quot;, &quot;想法&quot;), (&quot;enough&quot;, &quot;足够的&quot;),    (&quot;eat&quot;, &quot;吃&quot;), (&quot;face&quot;, &quot;脸&quot;), (&quot;watch&quot;, &quot;观看&quot;), (&quot;far&quot;, &quot;远的&quot;),    (&quot;really&quot;, &quot;真的&quot;), (&quot;almost&quot;, &quot;几乎&quot;), (&quot;let&quot;, &quot;让&quot;), (&quot;above&quot;, &quot;上面&quot;), (&quot;girl&quot;, &quot;女孩&quot;),    (&quot;sometimes&quot;, &quot;有时&quot;), (&quot;mountain&quot;, &quot;山&quot;), (&quot;cut&quot;, &quot;切&quot;), (&quot;young&quot;, &quot;年轻的&quot;), (&quot;talk&quot;, &quot;谈话&quot;),    (&quot;soon&quot;, &quot;很快&quot;), (&quot;list&quot;, &quot;列表&quot;), (&quot;song&quot;, &quot;歌曲&quot;), (&quot;being&quot;, &quot;存在&quot;), (&quot;leave&quot;, &quot;离开&quot;),    (&quot;family&quot;, &quot;家庭&quot;), (&quot;body&quot;, &quot;身体&quot;), (&quot;music&quot;, &quot;音乐&quot;), (&quot;color&quot;, &quot;颜色&quot;),    (&quot;stand&quot;, &quot;站&quot;), (&quot;sun&quot;, &quot;太阳&quot;), (&quot;questions&quot;, &quot;问题&quot;), (&quot;fish&quot;, &quot;鱼&quot;), (&quot;area&quot;, &quot;区域&quot;),    (&quot;mark&quot;, &quot;标记&quot;), (&quot;dog&quot;, &quot;狗&quot;), (&quot;horse&quot;, &quot;马&quot;), (&quot;birds&quot;, &quot;鸟&quot;), (&quot;problem&quot;, &quot;问题&quot;),    (&quot;complete&quot;, &quot;完成&quot;), (&quot;room&quot;, &quot;房间&quot;), (&quot;knew&quot;, &quot;知道&quot;), (&quot;since&quot;, &quot;自从&quot;), (&quot;ever&quot;, &quot;曾经&quot;),    (&quot;piece&quot;, &quot;片&quot;), (&quot;told&quot;, &quot;告诉&quot;), (&quot;usually&quot;, &quot;通常&quot;), (&quot;friends&quot;, &quot;朋友&quot;),    (&quot;easy&quot;, &quot;容易的&quot;), (&quot;heard&quot;, &quot;听到&quot;), (&quot;order&quot;, &quot;顺序&quot;), (&quot;red&quot;, &quot;红色&quot;), (&quot;door&quot;, &quot;门&quot;),    (&quot;sure&quot;, &quot;确定&quot;), (&quot;become&quot;, &quot;成为&quot;), (&quot;top&quot;, &quot;顶部&quot;), (&quot;ship&quot;, &quot;船&quot;), (&quot;across&quot;, &quot;穿过&quot;),    (&quot;today&quot;, &quot;今天&quot;), (&quot;during&quot;, &quot;在...期间&quot;), (&quot;short&quot;, &quot;短的&quot;), (&quot;better&quot;, &quot;更好的&quot;), (&quot;best&quot;, &quot;最好的&quot;),    (&quot;however&quot;, &quot;然而&quot;), (&quot;low&quot;, &quot;低的&quot;), (&quot;hours&quot;, &quot;小时&quot;), (&quot;black&quot;, &quot;黑色&quot;), (&quot;products&quot;, &quot;产品&quot;),    (&quot;happened&quot;, &quot;发生&quot;), (&quot;whole&quot;, &quot;整个&quot;), (&quot;measure&quot;, &quot;测量&quot;), (&quot;remember&quot;, &quot;记住&quot;), (&quot;early&quot;, &quot;早的&quot;),    (&quot;waves&quot;, &quot;波浪&quot;), (&quot;reached&quot;, &quot;到达&quot;), (&quot;listen&quot;, &quot;听&quot;), (&quot;wind&quot;, &quot;风&quot;), (&quot;rock&quot;, &quot;岩石&quot;),    (&quot;space&quot;, &quot;空间&quot;), (&quot;covered&quot;, &quot;覆盖&quot;), (&quot;fast&quot;, &quot;快的&quot;), (&quot;several&quot;, &quot;几个&quot;), (&quot;hold&quot;, &quot;握住&quot;),    (&quot;himself&quot;, &quot;他自己&quot;), (&quot;toward&quot;, &quot;朝向&quot;), (&quot;five&quot;, &quot;五&quot;), (&quot;step&quot;, &quot;步骤&quot;), (&quot;morning&quot;, &quot;早晨&quot;),    (&quot;passed&quot;, &quot;经过&quot;), (&quot;vowel&quot;, &quot;元音&quot;), (&quot;true&quot;, &quot;真的&quot;), (&quot;hundred&quot;, &quot;百&quot;), (&quot;against&quot;, &quot;反对&quot;),    (&quot;pattern&quot;, &quot;模式&quot;), (&quot;numeral&quot;, &quot;数字&quot;), (&quot;table&quot;, &quot;桌子&quot;), (&quot;north&quot;, &quot;北&quot;), (&quot;slowly&quot;, &quot;慢慢地&quot;),    (&quot;money&quot;, &quot;钱&quot;), (&quot;map&quot;, &quot;地图&quot;), (&quot;farm&quot;, &quot;农场&quot;), (&quot;pulled&quot;, &quot;拉&quot;), (&quot;draw&quot;, &quot;画&quot;),    (&quot;voice&quot;, &quot;声音&quot;), (&quot;seen&quot;, &quot;看见&quot;), (&quot;cold&quot;, &quot;冷的&quot;), (&quot;cried&quot;, &quot;哭&quot;), (&quot;plan&quot;, &quot;计划&quot;),    (&quot;notice&quot;, &quot;注意&quot;), (&quot;south&quot;, &quot;南&quot;), (&quot;sing&quot;, &quot;唱&quot;), (&quot;war&quot;, &quot;战争&quot;), (&quot;ground&quot;, &quot;地面&quot;),    (&quot;fall&quot;, &quot;秋天&quot;), (&quot;king&quot;, &quot;国王&quot;), (&quot;town&quot;, &quot;城镇&quot;), (&quot;unit&quot;, &quot;单元&quot;),    (&quot;figure&quot;, &quot;数字&quot;), (&quot;certain&quot;, &quot;确定的&quot;), (&quot;field&quot;, &quot;田野&quot;), (&quot;travel&quot;, &quot;旅行&quot;), (&quot;wood&quot;, &quot;木材&quot;),    (&quot;fire&quot;, &quot;火&quot;), (&quot;upon&quot;, &quot;在...上&quot;), (&quot;done&quot;, &quot;完成&quot;), (&quot;road&quot;, &quot;道路&quot;),    (&quot;half&quot;, &quot;一半&quot;), (&quot;ten&quot;, &quot;十&quot;), (&quot;fly&quot;, &quot;飞&quot;), (&quot;gave&quot;, &quot;给&quot;), (&quot;box&quot;, &quot;盒子&quot;),    (&quot;finally&quot;, &quot;最后&quot;), (&quot;wait&quot;, &quot;等待&quot;), (&quot;correct&quot;, &quot;正确的&quot;), (&quot;oh&quot;, &quot;哦&quot;), (&quot;quickly&quot;, &quot;快速地&quot;),    (&quot;person&quot;, &quot;人&quot;), (&quot;became&quot;, &quot;成为&quot;), (&quot;shown&quot;, &quot;展示&quot;), (&quot;minutes&quot;, &quot;分钟&quot;), (&quot;strong&quot;, &quot;强壮的&quot;),    (&quot;verb&quot;, &quot;动词&quot;), (&quot;stars&quot;, &quot;星星&quot;), (&quot;front&quot;, &quot;前面&quot;), (&quot;feel&quot;, &quot;感觉&quot;), (&quot;fact&quot;, &quot;事实&quot;),    (&quot;inches&quot;, &quot;英寸&quot;), (&quot;street&quot;, &quot;街道&quot;), (&quot;decided&quot;, &quot;决定&quot;), (&quot;contain&quot;, &quot;包含&quot;), (&quot;course&quot;, &quot;课程&quot;),    (&quot;surface&quot;, &quot;表面&quot;), (&quot;produce&quot;, &quot;生产&quot;), (&quot;building&quot;, &quot;建筑&quot;), (&quot;ocean&quot;, &quot;海洋&quot;), (&quot;class&quot;, &quot;班级&quot;),    (&quot;note&quot;, &quot;笔记&quot;), (&quot;nothing&quot;, &quot;没有东西&quot;), (&quot;rest&quot;, &quot;休息&quot;), (&quot;carefully&quot;, &quot;小心地&quot;), (&quot;scientists&quot;, &quot;科学家&quot;),    (&quot;inside&quot;, &quot;里面&quot;), (&quot;wheels&quot;, &quot;轮子&quot;), (&quot;stay&quot;, &quot;停留&quot;), (&quot;green&quot;, &quot;绿色&quot;), (&quot;known&quot;, &quot;知道&quot;),    (&quot;island&quot;, &quot;岛屿&quot;), (&quot;week&quot;, &quot;周&quot;), (&quot;less&quot;, &quot;更少&quot;), (&quot;machine&quot;, &quot;机器&quot;), (&quot;base&quot;, &quot;基础&quot;),    (&quot;ago&quot;, &quot;以前&quot;), (&quot;stood&quot;, &quot;站&quot;), (&quot;plane&quot;, &quot;飞机&quot;), (&quot;system&quot;, &quot;系统&quot;), (&quot;behind&quot;, &quot;后面&quot;),    (&quot;ran&quot;, &quot;跑&quot;), (&quot;round&quot;, &quot;圆的&quot;), (&quot;boat&quot;, &quot;船&quot;), (&quot;game&quot;, &quot;游戏&quot;), (&quot;force&quot;, &quot;力量&quot;),    (&quot;brought&quot;, &quot;带来&quot;), (&quot;understand&quot;, &quot;理解&quot;), (&quot;warm&quot;, &quot;温暖的&quot;), (&quot;common&quot;, &quot;常见的&quot;), (&quot;bring&quot;, &quot;带来&quot;),    (&quot;explain&quot;, &quot;解释&quot;), (&quot;dry&quot;, &quot;干的&quot;), (&quot;though&quot;, &quot;虽然&quot;), (&quot;language&quot;, &quot;语言&quot;), (&quot;shape&quot;, &quot;形状&quot;),    (&quot;deep&quot;, &quot;深的&quot;), (&quot;thousands&quot;, &quot;成千上万&quot;), (&quot;yes&quot;, &quot;是的&quot;), (&quot;clear&quot;, &quot;清楚的&quot;), (&quot;equation&quot;, &quot;方程&quot;),    (&quot;yet&quot;, &quot;尚未&quot;), (&quot;government&quot;, &quot;政府&quot;), (&quot;filled&quot;, &quot;填满&quot;), (&quot;heat&quot;, &quot;热&quot;), (&quot;full&quot;, &quot;满的&quot;),    (&quot;hot&quot;, &quot;热的&quot;), (&quot;check&quot;, &quot;检查&quot;), (&quot;object&quot;, &quot;物体&quot;), (&quot;am&quot;, &quot;是&quot;), (&quot;rule&quot;, &quot;规则&quot;),    (&quot;among&quot;, &quot;在...中&quot;), (&quot;noun&quot;, &quot;名词&quot;), (&quot;power&quot;, &quot;力量&quot;), (&quot;cannot&quot;, &quot;不能&quot;), (&quot;able&quot;, &quot;能够&quot;),    (&quot;six&quot;, &quot;六&quot;), (&quot;size&quot;, &quot;大小&quot;), (&quot;dark&quot;, &quot;黑暗的&quot;), (&quot;ball&quot;, &quot;球&quot;), (&quot;material&quot;, &quot;材料&quot;),    (&quot;special&quot;, &quot;特殊的&quot;), (&quot;heavy&quot;, &quot;重的&quot;), (&quot;fine&quot;, &quot;好的&quot;), (&quot;pair&quot;, &quot;一对&quot;), (&quot;circle&quot;, &quot;圆圈&quot;),    (&quot;include&quot;, &quot;包括&quot;), (&quot;built&quot;, &quot;建造&quot;), (&quot;matter&quot;, &quot;物质&quot;), (&quot;square&quot;, &quot;正方形&quot;),    (&quot;syllables&quot;, &quot;音节&quot;), (&quot;perhaps&quot;, &quot;也许&quot;), (&quot;bill&quot;, &quot;账单&quot;), (&quot;felt&quot;, &quot;感觉&quot;), (&quot;suddenly&quot;, &quot;突然&quot;),    (&quot;test&quot;, &quot;测试&quot;), (&quot;direction&quot;, &quot;方向&quot;), (&quot;center&quot;, &quot;中心&quot;), (&quot;farmers&quot;, &quot;农民&quot;), (&quot;ready&quot;, &quot;准备好的&quot;),    (&quot;anything&quot;, &quot;任何东西&quot;), (&quot;divided&quot;, &quot;分开&quot;), (&quot;general&quot;, &quot;一般的&quot;), (&quot;energy&quot;, &quot;能量&quot;), (&quot;subject&quot;, &quot;主题&quot;),    (&quot;moon&quot;, &quot;月亮&quot;), (&quot;region&quot;, &quot;地区&quot;), (&quot;return&quot;, &quot;返回&quot;), (&quot;believe&quot;, &quot;相信&quot;),    (&quot;dance&quot;, &quot;跳舞&quot;), (&quot;members&quot;, &quot;成员&quot;), (&quot;picked&quot;, &quot;捡起&quot;), (&quot;simple&quot;, &quot;简单的&quot;), (&quot;cells&quot;, &quot;细胞&quot;),    (&quot;paint&quot;, &quot;油漆&quot;), (&quot;mind&quot;, &quot;思想&quot;), (&quot;love&quot;, &quot;爱&quot;), (&quot;cause&quot;, &quot;原因&quot;), (&quot;rain&quot;, &quot;雨&quot;),    (&quot;exercise&quot;, &quot;锻炼&quot;), (&quot;eggs&quot;, &quot;蛋&quot;), (&quot;train&quot;, &quot;火车&quot;), (&quot;blue&quot;, &quot;蓝色&quot;), (&quot;wish&quot;, &quot;希望&quot;),    (&quot;drop&quot;, &quot;掉落&quot;), (&quot;developed&quot;, &quot;发展&quot;), (&quot;window&quot;, &quot;窗口&quot;), (&quot;difference&quot;, &quot;不同&quot;), (&quot;distance&quot;, &quot;距离&quot;),    (&quot;heart&quot;, &quot;心&quot;), (&quot;sit&quot;, &quot;坐&quot;), (&quot;sum&quot;, &quot;总和&quot;), (&quot;summer&quot;, &quot;夏天&quot;), (&quot;wall&quot;, &quot;墙&quot;),    (&quot;forest&quot;, &quot;森林&quot;), (&quot;probably&quot;, &quot;可能&quot;), (&quot;legs&quot;, &quot;腿&quot;), (&quot;sat&quot;, &quot;坐&quot;), (&quot;main&quot;, &quot;主要的&quot;),    (&quot;winter&quot;, &quot;冬天&quot;), (&quot;wide&quot;, &quot;宽的&quot;), (&quot;written&quot;, &quot;写的&quot;), (&quot;length&quot;, &quot;长度&quot;), (&quot;reason&quot;, &quot;原因&quot;),    (&quot;kept&quot;, &quot;保持&quot;), (&quot;interest&quot;, &quot;兴趣&quot;), (&quot;arms&quot;, &quot;手臂&quot;), (&quot;brother&quot;, &quot;兄弟&quot;), (&quot;race&quot;, &quot;种族&quot;),    (&quot;present&quot;, &quot;现在&quot;), (&quot;beautiful&quot;, &quot;美丽的&quot;), (&quot;store&quot;, &quot;商店&quot;), (&quot;job&quot;, &quot;工作&quot;), (&quot;edge&quot;, &quot;边缘&quot;),    (&quot;past&quot;, &quot;过去&quot;), (&quot;sign&quot;, &quot;标志&quot;), (&quot;record&quot;, &quot;记录&quot;), (&quot;finished&quot;, &quot;完成&quot;), (&quot;discovered&quot;, &quot;发现&quot;),    (&quot;wild&quot;, &quot;野生的&quot;), (&quot;happy&quot;, &quot;快乐的&quot;), (&quot;beside&quot;, &quot;在旁边&quot;), (&quot;gone&quot;, &quot;去了&quot;), (&quot;sky&quot;, &quot;天空&quot;),    (&quot;glass&quot;, &quot;玻璃&quot;), (&quot;million&quot;, &quot;百万&quot;), (&quot;west&quot;, &quot;西&quot;), (&quot;lay&quot;, &quot;躺&quot;), (&quot;weather&quot;, &quot;天气&quot;),    (&quot;root&quot;, &quot;根&quot;), (&quot;instruments&quot;, &quot;乐器&quot;), (&quot;meet&quot;, &quot;见面&quot;), (&quot;third&quot;, &quot;第三&quot;), (&quot;months&quot;, &quot;月&quot;),    (&quot;paragraph&quot;, &quot;段落&quot;), (&quot;raised&quot;, &quot;举起&quot;), (&quot;represent&quot;, &quot;代表&quot;), (&quot;soft&quot;, &quot;软的&quot;), (&quot;whether&quot;, &quot;是否&quot;),    (&quot;clothes&quot;, &quot;衣服&quot;), (&quot;flowers&quot;, &quot;花&quot;), (&quot;shall&quot;, &quot;将&quot;), (&quot;teacher&quot;, &quot;老师&quot;), (&quot;held&quot;, &quot;握住&quot;),    (&quot;describe&quot;, &quot;描述&quot;), (&quot;drive&quot;, &quot;驾驶&quot;), (&quot;cross&quot;, &quot;穿过&quot;), (&quot;speak&quot;, &quot;说话&quot;), (&quot;solve&quot;, &quot;解决&quot;),    (&quot;appear&quot;, &quot;出现&quot;), (&quot;metal&quot;, &quot;金属&quot;), (&quot;son&quot;, &quot;儿子&quot;), (&quot;either&quot;, &quot;要么&quot;), (&quot;ice&quot;, &quot;冰&quot;),    (&quot;sleep&quot;, &quot;睡觉&quot;), (&quot;village&quot;, &quot;村庄&quot;), (&quot;factors&quot;, &quot;因素&quot;), (&quot;result&quot;, &quot;结果&quot;), (&quot;jumped&quot;, &quot;跳&quot;),    (&quot;snow&quot;, &quot;雪&quot;), (&quot;ride&quot;, &quot;骑&quot;), (&quot;care&quot;, &quot;关心&quot;), (&quot;floor&quot;, &quot;地板&quot;), (&quot;hill&quot;, &quot;山&quot;),    (&quot;pushed&quot;, &quot;推&quot;), (&quot;baby&quot;, &quot;婴儿&quot;), (&quot;buy&quot;, &quot;买&quot;), (&quot;century&quot;, &quot;世纪&quot;), (&quot;outside&quot;, &quot;外面&quot;),    (&quot;everything&quot;, &quot;每件事&quot;), (&quot;tall&quot;, &quot;高的&quot;), (&quot;already&quot;, &quot;已经&quot;), (&quot;instead&quot;, &quot;代替&quot;), (&quot;phrase&quot;, &quot;短语&quot;),    (&quot;soil&quot;, &quot;土壤&quot;), (&quot;bed&quot;, &quot;床&quot;), (&quot;copy&quot;, &quot;复制&quot;), (&quot;free&quot;, &quot;自由的&quot;), (&quot;hope&quot;, &quot;希望&quot;),    (&quot;spring&quot;, &quot;春天&quot;), (&quot;case&quot;, &quot;案例&quot;), (&quot;laughed&quot;, &quot;笑&quot;), (&quot;nation&quot;, &quot;国家&quot;), (&quot;quite&quot;, &quot;相当&quot;),    (&quot;type&quot;, &quot;类型&quot;), (&quot;themselves&quot;, &quot;他们自己&quot;), (&quot;temperature&quot;, &quot;温度&quot;), (&quot;bright&quot;, &quot;明亮的&quot;), (&quot;lead&quot;, &quot;领导&quot;),    (&quot;everyone&quot;, &quot;每个人&quot;), (&quot;method&quot;, &quot;方法&quot;), (&quot;section&quot;, &quot;部分&quot;), (&quot;lake&quot;, &quot;湖&quot;), (&quot;consonant&quot;, &quot;辅音&quot;),    (&quot;within&quot;, &quot;在...内&quot;), (&quot;dictionary&quot;, &quot;字典&quot;), (&quot;hair&quot;, &quot;头发&quot;), (&quot;age&quot;, &quot;年龄&quot;), (&quot;amount&quot;, &quot;数量&quot;),    (&quot;scale&quot;, &quot;规模&quot;), (&quot;pounds&quot;, &quot;磅&quot;), (&quot;although&quot;, &quot;虽然&quot;), (&quot;per&quot;, &quot;每&quot;), (&quot;broken&quot;, &quot;破碎的&quot;),    (&quot;moment&quot;, &quot;时刻&quot;), (&quot;tiny&quot;, &quot;微小的&quot;), (&quot;possible&quot;, &quot;可能的&quot;), (&quot;gold&quot;, &quot;金&quot;), (&quot;milk&quot;, &quot;牛奶&quot;),    (&quot;quiet&quot;, &quot;安静的&quot;), (&quot;natural&quot;, &quot;自然的&quot;), (&quot;lot&quot;, &quot;很多&quot;), (&quot;stone&quot;, &quot;石头&quot;), (&quot;act&quot;, &quot;行动&quot;),    (&quot;build&quot;, &quot;建造&quot;), (&quot;middle&quot;, &quot;中间&quot;), (&quot;speed&quot;, &quot;速度&quot;), (&quot;count&quot;, &quot;数&quot;), (&quot;cat&quot;, &quot;猫&quot;),    (&quot;someone&quot;, &quot;某人&quot;), (&quot;sail&quot;, &quot;帆&quot;), (&quot;rolled&quot;, &quot;滚动&quot;), (&quot;bear&quot;, &quot;熊&quot;), (&quot;wonder&quot;, &quot;想知道&quot;),    (&quot;smiled&quot;, &quot;微笑&quot;), (&quot;angle&quot;, &quot;角度&quot;), (&quot;fraction&quot;, &quot;分数&quot;), (&quot;Africa&quot;, &quot;非洲&quot;), (&quot;killed&quot;, &quot;杀&quot;),    (&quot;melody&quot;, &quot;旋律&quot;), (&quot;bottom&quot;, &quot;底部&quot;), (&quot;trip&quot;, &quot;旅行&quot;), (&quot;hole&quot;, &quot;洞&quot;), (&quot;poor&quot;, &quot;贫穷的&quot;),    (&quot;fight&quot;, &quot;战斗&quot;), (&quot;surprise&quot;, &quot;惊讶&quot;), (&quot;died&quot;, &quot;死&quot;),    (&quot;beat&quot;, &quot;打&quot;), (&quot;exactly&quot;, &quot;确切地&quot;), (&quot;remain&quot;, &quot;保持&quot;), (&quot;dress&quot;, &quot;衣服&quot;), (&quot;iron&quot;, &quot;铁&quot;),    (&quot;fingers&quot;, &quot;手指&quot;), (&quot;row&quot;, &quot;行&quot;), (&quot;least&quot;, &quot;最少的&quot;), (&quot;catch&quot;, &quot;抓住&quot;),    (&quot;climbed&quot;, &quot;爬&quot;), (&quot;wrote&quot;, &quot;写&quot;), (&quot;shouted&quot;, &quot;喊&quot;), (&quot;continued&quot;, &quot;继续&quot;), (&quot;itself&quot;, &quot;它自己&quot;),    (&quot;plains&quot;, &quot;平原&quot;), (&quot;gas&quot;, &quot;气体&quot;), (&quot;burning&quot;, &quot;燃烧&quot;), (&quot;design&quot;, &quot;设计&quot;),    (&quot;joined&quot;, &quot;加入&quot;), (&quot;foot&quot;, &quot;脚&quot;), (&quot;law&quot;, &quot;法律&quot;), (&quot;ears&quot;, &quot;耳朵&quot;), (&quot;grass&quot;, &quot;草&quot;),    (&quot;grew&quot;, &quot;生长&quot;), (&quot;skin&quot;, &quot;皮肤&quot;), (&quot;valley&quot;, &quot;山谷&quot;), (&quot;cents&quot;, &quot;分&quot;),    (&quot;key&quot;, &quot;钥匙&quot;), (&quot;president&quot;, &quot;总统&quot;), (&quot;brown&quot;, &quot;棕色&quot;), (&quot;trouble&quot;, &quot;麻烦&quot;), (&quot;cool&quot;, &quot;酷的&quot;),    (&quot;cloud&quot;, &quot;云&quot;), (&quot;lost&quot;, &quot;丢失&quot;), (&quot;sent&quot;, &quot;发送&quot;), (&quot;symbols&quot;, &quot;符号&quot;), (&quot;wear&quot;, &quot;穿&quot;),    (&quot;bad&quot;, &quot;坏的&quot;), (&quot;save&quot;, &quot;保存&quot;), (&quot;experiment&quot;, &quot;实验&quot;), (&quot;engine&quot;, &quot;引擎&quot;), (&quot;alone&quot;, &quot;独自&quot;),    (&quot;drawing&quot;, &quot;绘画&quot;), (&quot;east&quot;, &quot;东&quot;), (&quot;pay&quot;, &quot;支付&quot;), (&quot;single&quot;, &quot;单一的&quot;), (&quot;touch&quot;, &quot;触摸&quot;),    (&quot;information&quot;, &quot;信息&quot;), (&quot;express&quot;, &quot;表达&quot;), (&quot;mouth&quot;, &quot;嘴&quot;), (&quot;yard&quot;, &quot;院子&quot;), (&quot;equal&quot;, &quot;等于&quot;),    (&quot;decimal&quot;, &quot;小数&quot;), (&quot;yourself&quot;, &quot;你自己&quot;), (&quot;control&quot;, &quot;控制&quot;), (&quot;practice&quot;, &quot;练习&quot;), (&quot;report&quot;, &quot;报告&quot;),    (&quot;straight&quot;, &quot;直的&quot;), (&quot;rise&quot;, &quot;上升&quot;), (&quot;statement&quot;, &quot;陈述&quot;), (&quot;stick&quot;, &quot;棍子&quot;), (&quot;party&quot;, &quot;派对&quot;),    (&quot;seeds&quot;, &quot;种子&quot;), (&quot;suppose&quot;, &quot;假设&quot;), (&quot;woman&quot;, &quot;女人&quot;), (&quot;coast&quot;, &quot;海岸&quot;), (&quot;bank&quot;, &quot;银行&quot;),    (&quot;period&quot;, &quot;时期&quot;), (&quot;wire&quot;, &quot;电线&quot;), (&quot;choose&quot;, &quot;选择&quot;), (&quot;clean&quot;, &quot;干净的&quot;), (&quot;visit&quot;, &quot;访问&quot;),    (&quot;bit&quot;, &quot;一点&quot;), (&quot;whose&quot;, &quot;谁的&quot;), (&quot;received&quot;, &quot;收到&quot;), (&quot;garden&quot;, &quot;花园&quot;), (&quot;please&quot;, &quot;请&quot;),    (&quot;strange&quot;, &quot;奇怪的&quot;), (&quot;caught&quot;, &quot;抓住&quot;), (&quot;fell&quot;, &quot;掉落&quot;), (&quot;team&quot;, &quot;团队&quot;),     (&quot;captain&quot;, &quot;队长&quot;), (&quot;direct&quot;, &quot;直接的&quot;), (&quot;ring&quot;, &quot;戒指&quot;), (&quot;serve&quot;, &quot;服务&quot;), (&quot;child&quot;, &quot;孩子&quot;),    (&quot;desert&quot;, &quot;沙漠&quot;), (&quot;increase&quot;, &quot;增加&quot;), (&quot;history&quot;, &quot;历史&quot;), (&quot;cost&quot;, &quot;成本&quot;), (&quot;maybe&quot;, &quot;也许&quot;),    (&quot;business&quot;, &quot;商业&quot;), (&quot;separate&quot;, &quot;分开&quot;), (&quot;break&quot;, &quot;打破&quot;), (&quot;uncle&quot;, &quot;叔叔&quot;), (&quot;hunting&quot;, &quot;狩猎&quot;),    (&quot;flow&quot;, &quot;流动&quot;), (&quot;lady&quot;, &quot;女士&quot;), (&quot;students&quot;, &quot;学生们&quot;), (&quot;human&quot;, &quot;人类&quot;), (&quot;art&quot;, &quot;艺术&quot;),    (&quot;feeling&quot;, &quot;感觉&quot;), (&quot;supply&quot;, &quot;供应&quot;), (&quot;corner&quot;, &quot;角落&quot;), (&quot;electric&quot;, &quot;电的&quot;), (&quot;insects&quot;, &quot;昆虫&quot;),    (&quot;crops&quot;, &quot;庄稼&quot;), (&quot;tone&quot;, &quot;音调&quot;), (&quot;hit&quot;, &quot;打&quot;), (&quot;sand&quot;, &quot;沙&quot;), (&quot;doctor&quot;, &quot;医生&quot;),    (&quot;provide&quot;, &quot;提供&quot;), (&quot;thus&quot;, &quot;因此&quot;), (&quot;cook&quot;, &quot;烹饪&quot;), (&quot;bones&quot;, &quot;骨头&quot;),    (&quot;tail&quot;, &quot;尾巴&quot;), (&quot;board&quot;, &quot;板&quot;), (&quot;modern&quot;, &quot;现代的&quot;), (&quot;compound&quot;, &quot;化合物&quot;), (&quot;mine&quot;, &quot;我的&quot;),    (&quot;fit&quot;, &quot;适合&quot;), (&quot;addition&quot;, &quot;添加&quot;), (&quot;belong&quot;, &quot;属于&quot;), (&quot;safe&quot;, &quot;安全的&quot;),    (&quot;soldiers&quot;, &quot;士兵们&quot;), (&quot;guess&quot;, &quot;猜测&quot;), (&quot;silent&quot;, &quot;安静的&quot;), (&quot;trade&quot;, &quot;贸易&quot;), (&quot;rather&quot;, &quot;宁愿&quot;),    (&quot;compare&quot;, &quot;比较&quot;), (&quot;crowd&quot;, &quot;人群&quot;), (&quot;poem&quot;, &quot;诗歌&quot;), (&quot;enjoy&quot;, &quot;享受&quot;), (&quot;elements&quot;, &quot;元素&quot;),    (&quot;indicate&quot;, &quot;指示&quot;), (&quot;except&quot;, &quot;除了&quot;), (&quot;expect&quot;, &quot;期望&quot;), (&quot;flat&quot;, &quot;平的&quot;), (&quot;seven&quot;, &quot;七&quot;),    (&quot;interesting&quot;, &quot;有趣的&quot;), (&quot;sense&quot;, &quot;感觉&quot;), (&quot;string&quot;, &quot;弦&quot;), (&quot;blow&quot;, &quot;吹&quot;), (&quot;famous&quot;, &quot;著名的&quot;),    (&quot;value&quot;, &quot;价值&quot;)]# 尝试加载中文字体def load_font(font_path, size):    try:        if os.path.exists(font_path):            return pygame.font.Font(font_path, size)    except:        pass    return None# 常见的中文字体路径chinese_font_paths = [    &quot;C:/Windows/Fonts/simsun.ttc&quot;,  # 宋体    &quot;C:/Windows/Fonts/simhei.ttf&quot;,  # 黑体    &quot;C:/Windows/Fonts/msyh.ttc&quot;,    # 微软雅黑    &quot;C:/Windows/Fonts/msyhbd.ttc&quot;,  # 微软雅黑粗体    &quot;/System/Library/Fonts/PingFang.ttc&quot;,  # macOS 苹方字体    &quot;/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf&quot;,  # Linux]# 加载字体font_large = Nonefont_medium = Nonefont_small = Nonefont_tiny = Nonefont_word = Nonefont_input = None# 尝试加载中文字体for font_path in chinese_font_paths:    if font_large is None:        font_large = load_font(font_path, 64)    if font_medium is None:        font_medium = load_font(font_path, 48)    if font_small is None:        font_small = load_font(font_path, 36)    if font_tiny is None:        font_tiny = load_font(font_path, 24)    if font_word is None:        font_word = load_font(font_path, 72)    if font_input is None:        font_input = load_font(font_path, 56)        # 如果都加载成功了就退出循环    if all([font_large, font_medium, font_small, font_tiny, font_word, font_input]):        break# 如果中文字体加载失败,回退到默认字体if font_large is None:    print(&quot;警告:未找到中文字体,将使用默认字体(中文可能显示为方框)&quot;)    try:        font_large = pygame.font.Font(None, 64)        font_medium = pygame.font.Font(None, 48)        font_small = pygame.font.Font(None, 36)        font_tiny = pygame.font.Font(None, 24)        font_word = pygame.font.Font(None, 72)        font_input = pygame.font.Font(None, 56)    except:        font_large = pygame.font.SysFont(None, 64)        font_medium = pygame.font.SysFont(None, 48)        font_small = pygame.font.SysFont(None, 36)        font_tiny = pygame.font.SysFont(None, 24)        font_word = pygame.font.SysFont(None, 72)        font_input = pygame.font.SysFont(None, 56)# 星星类class Star:    def __init__(self):        self.x = random.randint(0, WIDTH)        self.y = random.randint(0, HEIGHT)        self.size = random.uniform(1.0, 3.0)        self.color = random.choice(STAR_COLORS)        self.speed = random.uniform(0.1, 0.5)        self.twinkle_speed = random.uniform(0.01, 0.05)        self.twinkle = random.random() * math.pi * 2        self.original_brightness = random.uniform(0.6, 1.0)        self.current_color = self.color        def update(self):        # 星星闪烁效果        self.twinkle += self.twinkle_speed        brightness = self.original_brightness + 0.2 * math.sin(self.twinkle)                # 确保亮度在0-1之间        brightness = max(0.2, min(1.0, brightness))                # 计算当前颜色        self.current_color = (            int(self.color[0] * brightness),            int(self.color[1] * brightness),            int(self.color[2] * brightness)        )                # 确保颜色值在0-255之间        self.current_color = (            max(0, min(255, self.current_color[0])),            max(0, min(255, self.current_color[1])),            max(0, min(255, self.current_color[2]))        )                # 星星缓慢移动        self.y -= self.speed        if self.y < 0:            self.y = HEIGHT            self.x = random.randint(0, WIDTH)        def draw(self, surface):        pygame.draw.circle(surface, self.current_color, (int(self.x), int(self.y)), int(self.size))# 流星类class ShootingStar:    def __init__(self):        self.reset()        def reset(self):        self.x = random.randint(WIDTH // 2, WIDTH)        self.y = random.randint(0, HEIGHT // 4)        self.length = random.randint(20, 60)        self.speed = random.uniform(8, 15)        self.angle = random.uniform(2.8, 3.5)  # 弧度        self.active = True        self.trail = []        self.max_trail = 10        def update(self):        if not self.active:            if random.random() < 0.005:  # 随机生成新流星                self.reset()            return                # 更新位置        self.x -= self.speed * math.cos(self.angle)        self.y += self.speed * math.sin(self.angle)                # 记录轨迹        self.trail.append((self.x, self.y))        if len(self.trail) > self.max_trail:            self.trail.pop(0)                # 检查是否飞出屏幕        if self.x < 0 or self.y > HEIGHT:            self.active = False        def draw(self, surface):        if not self.active and not self.trail:            return                # 绘制流星轨迹        for i, (trail_x, trail_y) in enumerate(self.trail):            alpha = int(255 * (i / len(self.trail)))            if alpha > 0:  # 只绘制可见的轨迹                # 创建一个临时Surface用于绘制半透明圆                s = pygame.Surface((6, 6), pygame.SRCALPHA)                color_with_alpha = (255, 255, 255, alpha)                pygame.draw.circle(s, color_with_alpha, (3, 3), 3)                surface.blit(s, (trail_x - 3, trail_y - 3))                # 绘制流星头部        if self.active:            pygame.draw.circle(surface, (255, 255, 255), (int(self.x), int(self.y)), 2)# 按钮类class Button:    def __init__(self, x, y, width, height, text, action):        self.rect = pygame.Rect(x, y, width, height)        self.text = text        self.action = action        self.color = BUTTON_COLORS[&quot;normal&quot;]        self.hovered = False        self.pressed = False        self.radius = 15        def draw(self, surface):        # 绘制按钮背景        color = BUTTON_COLORS[&quot;pressed&quot;] if self.pressed else (BUTTON_COLORS[&quot;hover&quot;] if self.hovered else BUTTON_COLORS[&quot;normal&quot;])        pygame.draw.rect(surface, color, self.rect, border_radius=self.radius)        pygame.draw.rect(surface, (255, 255, 255), self.rect, 2, border_radius=self.radius)                # 绘制按钮文字        text_surf = font_medium.render(self.text, True, TEXT_COLOR)        text_rect = text_surf.get_rect(center=self.rect.center)        surface.blit(text_surf, text_rect)        def check_hover(self, pos):        self.hovered = self.rect.collidepoint(pos)        return self.hovered        def handle_event(self, event):        if event.type == MOUSEBUTTONDOWN and event.button == 1:            if self.hovered:                self.pressed = True                return True        elif event.type == MOUSEBUTTONUP and event.button == 1:            if self.pressed and self.hovered:                self.action()            self.pressed = False        return False# 游戏主类class TypingGame:    def __init__(self):        self.reset_game()        self.stars = [Star() for _ in range(150)]  # 减少星星数量以提高性能        self.shooting_stars = [ShootingStar() for _ in range(2)]  # 减少流星数量        self.buttons = []        self.create_buttons()        self.game_state = &quot;menu&quot;  # menu, playing, game_over        def reset_game(self):        self.current_word_idx = 0        self.user_input = &quot;&quot;        self.correct_count = 0        self.incorrect_count = 0        self.total_time = 0        self.start_time = pygame.time.get_ticks()        self.last_word_time = pygame.time.get_ticks()        self.word_times = []        self.accuracy = 100.0        self.current_words = []        self.shuffle_words()        self.get_new_word()        def shuffle_words(self):        # 随机选择30个单词进行练习        self.current_words = random.sample(WORD_LIST, 30)        def get_new_word(self):        if self.current_word_idx < len(self.current_words):            self.current_word, self.current_meaning = self.current_words[self.current_word_idx]            self.user_input = &quot;&quot;            self.last_word_time = pygame.time.get_ticks()        else:            self.game_over()        def game_over(self):        self.game_state = &quot;game_over&quot;        if self.correct_count + self.incorrect_count > 0:            self.accuracy = (self.correct_count / (self.correct_count + self.incorrect_count)) * 100        def create_buttons(self):        button_width, button_height = 200, 60        center_x = WIDTH // 2        self.buttons = [            Button(center_x - button_width // 2, HEIGHT // 2, button_width, button_height, &quot;开始游戏&quot;, self.start_game),            Button(center_x - button_width // 2, HEIGHT // 2 + 100, button_width, button_height, &quot;重新开始&quot;, self.restart_game),            Button(center_x - button_width // 2, HEIGHT // 2 + 200, button_width, button_height, &quot;退出游戏&quot;, self.quit_game)        ]        def start_game(self):        self.reset_game()        self.game_state = &quot;playing&quot;        def restart_game(self):        self.start_game()        def quit_game(self):        pygame.quit()        sys.exit()        def handle_input(self, event):        if self.game_state != &quot;playing&quot;:            for button in self.buttons:                button.handle_event(event)            return                if event.type == KEYDOWN:            if event.key == K_RETURN:  # 回车键提交                self.check_word()            elif event.key == K_BACKSPACE:  # 退格键                self.user_input = self.user_input[:-1]            elif event.key == K_ESCAPE:  # ESC键返回菜单                self.game_state = &quot;menu&quot;            else:  # 普通字符输入                char = event.unicode                if char.isalpha():  # 只接受字母                    self.user_input += char.lower()        def check_word(self):        if not self.user_input:            return                current_time = pygame.time.get_ticks()        time_taken = (current_time - self.last_word_time) / 1000.0        self.word_times.append(time_taken)                if self.user_input == self.current_word:            self.correct_count += 1        else:            self.incorrect_count += 1                self.current_word_idx += 1        self.get_new_word()        def update(self):        # 更新星星        for star in self.stars:            star.update()                # 更新流星        for star in self.shooting_stars:            star.update()                # 更新游戏时间        if self.game_state == &quot;playing&quot;:            self.total_time = (pygame.time.get_ticks() - self.start_time) / 1000.0                # 计算准确率        total = self.correct_count + self.incorrect_count        if total > 0:            self.accuracy = (self.correct_count / total) * 100        def draw_background(self, surface):        # 绘制深蓝色背景        surface.fill(BACKGROUND)                # 绘制星星        for star in self.stars:            star.draw(surface)                # 绘制流星        for shooting_star in self.shooting_stars:            shooting_star.draw(surface)                # 绘制标题装饰        title = &quot;Let's Type&quot;        title_surf = font_large.render(title, True, TEXT_COLOR)        title_shadow = font_large.render(title, True, (50, 50, 100))                # 绘制阴影效果        surface.blit(title_shadow, (WIDTH//2 - title_surf.get_width()//2 + 3, 53))        surface.blit(title_surf, (WIDTH//2 - title_surf.get_width()//2, 50))                # 绘制装饰线        line_y = 120        pygame.draw.line(surface, (100, 150, 255), (WIDTH//2 - 180, line_y), (WIDTH//2 + 180, line_y), 2)                # 绘制星星装饰        for i in range(5):            x = WIDTH//2 - 100 + i * 50            pygame.draw.polygon(surface, (255, 255, 200), [                (x, line_y - 10),                (x + 5, line_y - 15),                (x + 10, line_y - 10),                (x + 5, line_y - 5)            ])        def draw_menu(self, surface):        # 绘制游戏说明        instructions = [            &quot;游戏说明:&quot;,            &quot;1. 输入显示的英文单词&quot;,            &quot;2. 按Enter键提交&quot;,            &quot;3. 按ESC键返回菜单&quot;,            &quot;4. 练习300个最常用英文单词&quot;        ]                for i, line in enumerate(instructions):            text_surf = font_small.render(line, True, TEXT_COLOR)            surface.blit(text_surf, (WIDTH//2 - text_surf.get_width()//2, 150 + i * 40))                # 绘制按钮        for button in self.buttons[:1]:  # 只显示开始游戏按钮            button.draw(surface)        def draw_game(self, surface):        # 绘制进度显示        progress_bg = pygame.Rect(50, 150, WIDTH - 100, 20)        progress_width = (WIDTH - 100) * (self.current_word_idx / max(len(self.current_words), 1))        progress_fg = pygame.Rect(50, 150, progress_width, 20)        pygame.draw.rect(surface, (50, 50, 100), progress_bg, border_radius=10)        pygame.draw.rect(surface, PROGRESS_COLOR, progress_fg, border_radius=10)                progress_text = f&quot;进度: {self.current_word_idx}/{len(self.current_words)}&quot;        text_surf = font_small.render(progress_text, True, TEXT_COLOR)        surface.blit(text_surf, (WIDTH//2 - text_surf.get_width()//2, 120))                # 绘制当前单词        word_surf = font_word.render(self.current_word, True, TEXT_COLOR)        word_x = WIDTH//2 - word_surf.get_width()//2        word_y = 200        surface.blit(word_surf, (word_x, word_y))                # 绘制中文释义        meaning_surf = font_medium.render(f&quot;中文: {self.current_meaning}&quot;, True, HINT_COLOR)        surface.blit(meaning_surf, (WIDTH//2 - meaning_surf.get_width()//2, 300))                # 绘制输入框        input_bg = pygame.Rect(WIDTH//2 - 300, 380, 600, 80)        pygame.draw.rect(surface, (30, 30, 60), input_bg, border_radius=15)        pygame.draw.rect(surface, INPUT_COLOR, input_bg, 3, border_radius=15)                input_surf = font_input.render(self.user_input, True, INPUT_COLOR)        cursor_x = WIDTH//2 - input_surf.get_width()//2                # 绘制输入文本        surface.blit(input_surf, (cursor_x, 400))                # 绘制闪烁的光标        if pygame.time.get_ticks() % 1000 < 500:            cursor_pos = cursor_x + input_surf.get_width() + 5            pygame.draw.line(surface, INPUT_COLOR, (cursor_pos, 400), (cursor_pos, 440), 3)                # 绘制提示        hint_text = &quot;输入单词后按Enter键提交,按ESC返回菜单&quot;        hint_surf = font_tiny.render(hint_text, True, HINT_COLOR)        surface.blit(hint_surf, (WIDTH//2 - hint_surf.get_width()//2, 480))                # 绘制统计数据        stats_y = 520        stats = [            f&quot;正确: {self.correct_count}&quot;,            f&quot;错误: {self.incorrect_count}&quot;,            f&quot;准确率: {self.accuracy:.1f}%&quot;,            f&quot;用时: {self.total_time:.1f}秒&quot;        ]                for i, stat in enumerate(stats):            stat_surf = font_tiny.render(stat, True, STATS_COLOR)            surface.blit(stat_surf, (100 + i * 220, stats_y))                # 如果已经输入了一些字符,在单词上方显示比对        if self.user_input:            for i, (user_char, correct_char) in enumerate(zip(self.user_input, self.current_word)):                if i >= len(self.current_word):                    break                                # 计算每个字符的位置                char_color = CORRECT_COLOR if user_char == correct_char else INCORRECT_COLOR                                # 渲染字符                char_surf = font_word.render(user_char, True, char_color)                                # 计算这个字符在完整单词中的位置                # 首先获取从单词开始到这个字符的子字符串                partial_word = self.current_word[:i]                partial_surf = font_word.render(partial_word, True, TEXT_COLOR)                                # 计算这个字符的x坐标                char_x = word_x + partial_surf.get_width()                                # 在单词上方绘制用户输入的这个字符                # surface.blit(char_surf, (char_x, word_y - 40))                # 在单词原本的位置绘制用户输入的这个字符                surface.blit(char_surf, (char_x, word_y))                                # 可选:在字符下方绘制下划线                if user_char != correct_char:                    underline_y = word_y - 10                    pygame.draw.line(surface, INCORRECT_COLOR,                                     (char_x, underline_y),                                     (char_x + char_surf.get_width(), underline_y), 2)        def draw_game_over(self, surface):        # 绘制游戏结束界面        game_over_text = &quot;练习完成!&quot;        text_surf = font_large.render(game_over_text, True, TEXT_COLOR)        surface.blit(text_surf, (WIDTH//2 - text_surf.get_width()//2, 200))                # 绘制最终统计        stats = [            f&quot;正确单词: {self.correct_count}&quot;,            f&quot;错误单词: {self.incorrect_count}&quot;,            f&quot;最终准确率: {self.accuracy:.1f}%&quot;,            f&quot;总用时: {self.total_time:.1f}秒&quot;        ]                if self.word_times:            avg_time = sum(self.word_times) / len(self.word_times)            stats.append(f&quot;平均每个单词: {avg_time:.2f}秒&quot;)            wpm = (self.correct_count / self.total_time * 60) if self.total_time > 0 else 0            stats.append(f&quot;打字速度: {wpm:.1f} WPM&quot;)                for i, stat in enumerate(stats):            stat_surf = font_medium.render(stat, True, STATS_COLOR)            surface.blit(stat_surf, (WIDTH//2 - stat_surf.get_width()//2, 280 + i * 50))                # 绘制按钮        for button in self.buttons[1:]:  # 显示重新开始和退出按钮            button.draw(surface)        def draw(self, surface):        # 绘制背景        self.draw_background(surface)                # 根据游戏状态绘制不同界面        if self.game_state == &quot;menu&quot;:            self.draw_menu(surface)        elif self.game_state == &quot;playing&quot;:            self.draw_game(surface)        elif self.game_state == &quot;game_over&quot;:            self.draw_game_over(surface)                # 绘制版本信息        version_text = &quot;英文打字练习 - by xhlbudd@52pojie&quot;        version_surf = font_tiny.render(version_text, True, HINT_COLOR)        surface.blit(version_surf, (WIDTH//2 - version_surf.get_width()//2, HEIGHT - 30))# 主游戏循环def main():    game = TypingGame()    clock = pygame.time.Clock()    running = True        while running:        mouse_pos = pygame.mouse.get_pos()                # 处理事件        for event in pygame.event.get():            if event.type == QUIT:                running = False            elif event.type == KEYDOWN and event.key == K_ESCAPE:                if game.game_state == &quot;playing&quot;:                    game.game_state = &quot;menu&quot;                else:                    running = False            else:                game.handle_input(event)                # 更新按钮状态        for button in game.buttons:            button.check_hover(mouse_pos)                # 更新游戏状态        game.update()                # 绘制        game.draw(screen)                # 更新显示        pygame.display.flip()        clock.tick(60)        pygame.quit()    sys.exit()if __name__ == &quot;__main__&quot;:    main()

重要声明:以上内容仅代表作者七千亿房产老板观点,不代表本站测量协会立场。如有涉及侵权请尽快告知,我们将会在第一时间处理。作者原创内容未经允许不得转载!

站长联系邮箱:1339305021@qq.com

站长联系微信:dddnnbbb

灌水成绩
0
21
35
主题
帖子
积分

等级头衔 ID : 837
用户组 : 新手上路

积分成就 测量币 : 35
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 4 天前 | 显示全部楼层
很好的小工具,如果是学习Python的话最好是把里面的词汇都换成Python编程的词汇内容就最好了
回复

使用道具 举报

灌水成绩
1
18
59
主题
帖子
积分

等级头衔 ID : 873
用户组 : 注册会员

积分成就 测量币 : 59
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 6 天前 | 显示全部楼层
谢谢斑竹大大的认可,很高兴小工具被置顶了,以后争取再开发一些小游戏和小工具分享给大家
回复

使用道具 举报

灌水成绩
0
25
56
主题
帖子
积分

等级头衔 ID : 812
用户组 : 注册会员

积分成就 测量币 : 56
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 6 天前 | 显示全部楼层
这个必须给个大大赞
回复

使用道具 举报

灌水成绩
1
18
59
主题
帖子
积分

等级头衔 ID : 873
用户组 : 注册会员

积分成就 测量币 : 59
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 6 天前 | 显示全部楼层
谢谢支持,我以后争取再开发一些好的小游戏、小工具分享给大家~~
回复

使用道具 举报

灌水成绩
3
26
69
主题
帖子
积分

等级头衔 ID : 826
用户组 : 注册会员

积分成就 测量币 : 69
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 5 天前 | 显示全部楼层
这个挺有意思的
回复

使用道具 举报

灌水成绩
2
23
20
主题
帖子
积分

等级头衔 ID : 842
用户组 : 新手上路

积分成就 测量币 : 20
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 5 天前 | 显示全部楼层
这个必须给个大大赞
回复

使用道具 举报

灌水成绩
0
36
38
主题
帖子
积分

等级头衔 ID : 835
用户组 : 新手上路

积分成就 测量币 : 38
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 5 天前 | 显示全部楼层
蛮有意思的,不过能增加点词汇和词汇语音读出来么?
回复

使用道具 举报

灌水成绩
1
20
22
主题
帖子
积分

等级头衔 ID : 808
用户组 : 新手上路

积分成就 测量币 : 22
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 5 天前 | 显示全部楼层
谢谢建议,我看看是否增加到后续的版本~~
回复

使用道具 举报

灌水成绩
1
18
10
主题
帖子
积分

等级头衔 ID : 869
用户组 : 新手上路

积分成就 测量币 : 10
违规 : 0
在线时间 : 0 小时
注册时间 : 2026-4-6
最后登录 : 2026-4-23

勋章

活跃会员最佳新人

联系方式

发表于 5 天前 | 显示全部楼层
很有意思的小游戏!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|测量协会 ( 桂ICP备2026007449号-1 )

GMT+8, 2026-4-25 03:16 , Processed in 0.092352 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表