Python+Pygame实现简单的单词小游戏

语言是一种艺术,但是作为语言的基础——词汇,却不像艺术那样赏心悦目。不断的记忆与复习,让词汇成为很多孩子在学习英语时,最难完全攻克的关卡。本文就来用Python制作一个简单的英语单词游戏吧

前言

语言是一种艺术,但是作为语言的基础——词汇,却不像艺术那样赏心悦目。不断的记忆与复习,让词汇成为很多孩子在学习英语时,最难完全攻克的关卡。

今天这篇代码文章为大家介绍了一个简单好玩儿的单词小游戏程序,将原本枯燥无味的单词与生动有趣的游戏相结合,寓教于乐。

这种兼具挑战性和趣味性的游戏,很容易激起孩子的兴趣,并且色彩斑斓的画面,帮助他们更好的把形与意结合。小编认为,虽然单词对于英语的学习很重要,家长也不能强行让他们去记忆,而是尝试以各种形式引导,化解抵触与畏难情绪,才有利于后续的学习哦~

记单词,也可以玩游戏一样打通关,又紧张又兴奋,不刻意,还过瘾,马上跟我一起来体验吧!

一、环境准备

1)运行环境 

环境安装:python 3.8: 解释器、pycharm: 代码编辑器、pygame、numpy、部分自带的模块直接安装Python就可以使用了。

 2)模块安装

 第三方库的安装方式如下:

 一般安装:pip install +模块名 镜像源安装:pip install -i 

pypi.douban.com/simple/+模块名 (还有很多国内镜像源,这里是豆瓣的用习惯了) 

3)图片文字素材等

 

二、代码展示

主程序——

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

import pygame

import sys

import traceback

import os

from pygame.locals import *

from random import *

import numpy as np

import linecache

pygame.init()  # 游戏初始化

pygame.mixer.init()  # 音效初始化

bg_size = width, height = 480, 700  # 屏幕大小

screen = pygame.display.set_mode(bg_size)

pygame.display.set_caption("英语单词挑战"# 标题

# 背景图片

background = pygame.image.load("source/背景.png"# .convert()

BLACK = (0, 0, 0)

WHITE = (255, 255, 255)

GREEN = (0, 255, 0)

RED = (255, 0, 0)

# 游戏音乐

pygame.mixer.music.load("source/背景音乐.mp3")

pygame.mixer.music.set_volume(0.2)

success_sound = pygame.mixer.Sound("source/正确.wav")

success_sound.set_volume(0.2)

lost_sound = pygame.mixer.Sound("source/失败.wav")

lost_sound.set_volume(0.2)

win_sound = pygame.mixer.Sound("source/胜利.wav")

win_sound.set_volume(0.2)

class Word(pygame.sprite.Sprite):

    def __init__(self, bg_size, showword):

        pygame.sprite.Sprite.__init__(self)

        self.word = showword  # 获取单词

        self.length = len(self.word)  # 单词长度

        self.wordfont = pygame.font.SysFont("arial", 36# 使用系统字体

        self.wordtext = self.wordfont.render(self.word, True, WHITE, BLACK)  # 单词

        self.promptword = "*"*self.length

        self.showtext = self.wordfont.render(self.promptword, True, WHITE, BLACK)  # 隐藏单词

        self.succtext = self.wordfont.render("", True, WHITE)

        self.rect = self.wordtext.get_rect()  # 单词坐标

        self.width, self.height = bg_size[0], bg_size[1]

        self.rect.left, self.rect.top = (self.width - self.rect.width) // 2, 20  # 定义坐标

        self.speed = 1  # 下移速度

        # self.destroy_images = []

        # self.destroy_images.extend([pygame.image.load("爆炸小.png").convert_alpha()])

        self.active = True  # 活动标志

        self.success = False  # 正确标志

    # 判断输入字母是否正确,并显示

    def show(self, a):

        for i in range(self.length):

            if self.promptword[i] == "*":

                if self.word[i] == a:

                    self.promptword =self.promptword[:i] + a + self.promptword[i+1:]

                    self.showtext = self.wordfont.render(self.promptword, True, WHITE, BLACK)  # 隐藏单词

                if self.promptword == self.word:

                    self.success = True

                break

            else:

                continue

    # 单词移动

    def move(self):

        if self.rect.top < self.height - 50:

            self.rect.top += self.speed

        else:

            self.reset()

    # 单词重置

    def reset(self):

        self.active = True

        self.success = False

        self.rect.left, self.rect.top = (self.width - self.rect.width) // 2, 20

    # 中文提示

    def describe(self, prop):

        myprop = prop

        self.propfont = pygame.font.Font("source/楷体_GB2312.ttf", 20# 使用楷体字体

        # print(myprop)

        self.describetext = self.propfont.render(myprop, True, BLACK)  # 中文提示

        self.proprect = self.describetext.get_rect()  # 提示坐标

        self.proprect.left, self.proprect.top = (self.width - self.proprect.width) // 2, (self.height - 30 - self.proprect.height / 2)

        screen.blit(self.describetext, self.proprect)

# 获取单词,读取字典文件

def Getletters(filename):

    words = []  # 保存单词

    prompts = []  # 保存中文提示

    worddict = {}  # 单词字典

    f = open(filename, encoding='utf-8'# 打开文本,定义格式,能够读取中文

    for line in f.readlines():  # 读取行

        line = line.strip()  # 去掉/n

        word = line.split(":")[0# 截取单词

        prompt = line.split(":")[1# .split(";")[0]  # 截取中文提示

        words.append(word)

        prompts.append(prompt)

        worddict.update({word : prompt})  # 字典添加元素

    f.close()

    return worddict

# 保存字典文件

def SaveDict(dict1, filename):

    # 打开字典文件

    with open(filename, mode='w', encoding='utf-8') as f:

        for k, v in dict1.items():

            str = f"{k}:{v}\n"

            f.write(str)

        f.close()

# 随机抽取字典的数据

def ChoseWord(dict1):

    n = len(dict1)

    random.choice(list(dict1.keys()))

    words = dict1.keys()

    prompts = dict1.values()

    i = randint(0, n)

    key = words[i]

    value = prompts[i]

    return key, value

# 主函数

def main():

    pygame.mixer.music.play(-1# 播放背景音乐

    running = True  # 判断运行状态

    clock = pygame.time.Clock()  # 时钟

    delay = 100

    olingefile = "source/words.txt"  # 原始单词文件

    myfile = "source/newword.txt"  # 使用单词文件

    historyfile = "source/record.txt"  # 最高记录文件

    olindict = Getletters(olingefile)  # 获取原始单词

    num = len(olindict)  # 总单词数量

    # getnum = 0

    # record_score = 0  # 最高得分记录

    # record_rate = 0.00  # 最高进度

    myfont_big = pygame.font.SysFont("arial", 36# 使用系统大字体

    myfont_small = pygame.font.SysFont("arial", 24# 使用系统小字体

    # 标志是否暂停游戏

    paused = False

    paused_image = pygame.image.load("source/暂停.png").convert_alpha()

    resume_image = pygame.image.load("source/播放.png").convert_alpha()

    paused_rect = paused_image.get_rect()

    paused_rect.left, paused_rect.top = width - paused_rect.width - 10, 10

    paused_show_image = paused_image

    # 主页

    mained = False  # 主页标志

    main_image = pygame.image.load("source/主页.png").convert_alpha()

    main_rect = main_image.get_rect()

    main_rect.left, main_rect.top = width - paused_rect.width - 70, 10

    # 成功页面

    success_image = pygame.image.load("source/成功.png").convert_alpha()

    # 底部页面

    bottom_image = pygame.image.load("source/底部.png").convert_alpha()

    # 统计得分

    # score = 0  # 当前得分

    # rate = 0.00  # 当前进度

    # 主页面

    goon_image = pygame.image.load("source/继续游戏.png").convert_alpha()

    goon_rect = goon_image.get_rect()

    restart_image = pygame.image.load("source/重新开始.png").convert_alpha()

    restart_rect = restart_image.get_rect()

    gameover_image = pygame.image.load("source/结束游戏.png").convert_alpha()

    gameover_rect = gameover_image.get_rect()

    flag = False  # 新单词标记

    promptflag = False  # 空格提示单词标记

    nextflag = False  # 回车下一个单词标记

    winflag = False  # 胜利标志

    keyvalue = ""  # 获取按键

    if os.path.exists(myfile) and os.path.exists(historyfile):  # 如果有记录

        mydict = Getletters(myfile)

        getnum = num - len(mydict)  # 完成数量

        mained = True

        with open(historyfile, mode='r', encoding='utf-8') as f:

            record_score = int(linecache.getline(historyfile, 1))  # 读取最高记录

            record_rate = float(linecache.getline(historyfile, 2))  # 读取最高进度

            score = int(linecache.getline(historyfile, 3))  # 读取上一次记录

            f.close()

        # print(record_score, record_rate)

    else:

        mydict = Getletters(olingefile)

        getnum = 0

        score = 0

        rate = 0.00

        record_score = score

        record_rate = rate

        mained = False

    while running:

        for event in pygame.event.get():

            if event.type == QUIT:  # 退出

                # 写入记录文件

                with open(historyfile, mode='w', encoding='utf-8') as f:

                    f.write(str(record_score))

                    f.write("\n")

                    f.write(str(record_rate))

                    f.write("\n")

                    f.write(str(score))

                    f.close()

                # 保存剩余单词

                SaveDict(mydict, myfile)

                pygame.quit()

                sys.exit()

            elif event.type == MOUSEBUTTONDOWN:  # 鼠标按下

                # 按下暂停键

                if event.button == 1 and paused_rect.collidepoint(event.pos):  # 检测鼠标是否在范围内

                    paused = not paused

                    if paused:

                        pygame.mixer.music.pause()  # 背景音乐暂停

                        pygame.mixer.pause()  # 音效暂停

                        paused_show_image = resume_image

                    else:

                        pygame.mixer.music.unpause()  # 背景音乐暂停

                        pygame.mixer.unpause()  # 音效暂停

                        paused_show_image = paused_image

                # 按下主页键

                if event.button == 1 and main_rect.collidepoint(event.pos):  # 检测鼠标是否在范围内

                    mained = True

                    if mained:

                        pygame.mixer.music.pause()  # 背景音乐暂停

                        pygame.mixer.pause()  # 音效暂停

            elif event.type == KEYDOWN:  # 按键

                if event.key == K_TAB:  # tab键

                    promptflag = True

                elif event.key == K_RETURN:  # 回车键

                    nextflag = True

                else:

                    keyvalue = chr(event.key)  # 获取ASCII码转字符串

        screen.blit(background, (0, 0))  # 载入背景图片

        screen.blit(bottom_image, (0, height - 60))  # 载入底部图片

        # 绘制得分

        score_text = myfont_big.render(f"score:{str(score)}", True, WHITE)

        screen.blit(score_text, (10, 5))

        # 暂停/播放

        screen.blit(paused_show_image, paused_rect)  # 暂停图片

        # 绘制主页

        screen.blit(main_image, main_rect)  # 主页图片

        # 绘制进度

        pygame.draw.rect(screen, WHITE, ((10, 60), (200, 20)), 2# 画矩形,坐标(10,60),长宽(200,20),线宽2

        # 当进度大于80%显示绿色,否则显示红色

        rate = getnum / num

        if rate > 0.8:

            rate_color = GREEN

        else:

            rate_color = RED

        pygame.draw.rect(screen, rate_color, ((10, 60), (200 * rate, 20)), 0# 填充

        remaintext = myfont_small.render(f"{rate*100:.2f}%", True, WHITE)

        screen.blit(remaintext, (220, 55))

        if not paused and not mained:

            if not flag:

                # 生成单词

                showword = np.random.choice(list(mydict.keys()))  # 随机选择单词

                showprompt = mydict[showword]  # 单词中文提示

                # print(showword, showprompt)

                myword = Word(bg_size, showword)  # 生成单词

                flag = True  # 新单词

            else:

                myword.move()  # 单词向下移动

                myword.describe(showprompt)

                myword.show(keyvalue)  # 获取键盘按键

                if promptflag:

                    screen.blit(myword.wordtext, myword.rect)

                else:

                    screen.blit(myword.showtext, myword.rect)

                    # 成功

                    if myword.success:

                        screen.blit(myword.succtext, myword.rect)  # 清空

                        screen.blit(success_image, myword.rect)  # 成功图片

                        success_sound.play()

                        if not (delay % 10):  # 延时

                            myword.reset()

                            flag = False

                            score += 5

                            getnum += 1

                            del mydict[showword]

                            if getnum == num:

                                winflag = True

                                mained = True

                if nextflag:

                    myword.reset()

                    flag = False

                    nextflag = False

                if myword.rect.top > height - 118:

                    lost_sound.play()

                    flag = False

                    score -= 2

        # 暂停时

        elif paused and not mained:

            myword.active = False

            screen.blit(myword.showtext, myword.rect)

            myword.describe(showprompt)

        # 显示主页

        elif mained and not winflag:

            # myword.active = False

            screen.blit(background, (0, 0))  # 载入背景图片

            # 绘制结束界面

            # 更新最高分

            if score > record_score:

                record_score = score

            # 更新进度

            if rate > record_rate:

                record_rate = rate

            # 最高分

            record_score_text = myfont_big.render(f"Highest Score:{record_score}", True, WHITE)

            screen.blit(record_score_text, (50, 50))

            # 最高进度

            record_rate_text = myfont_big.render(f"Highest Rate:{record_rate*100:.2f}%", True, WHITE)

            screen.blit(record_rate_text, (50, 100))

            # 当前得分

            nowscore_text1 = myfont_big.render("Your Score:", True, WHITE)

            nowscore_text1_rect = nowscore_text1.get_rect()

            nowscore_text1_rect.left, nowscore_text1_rect.top = 50, 150

            screen.blit(nowscore_text1, nowscore_text1_rect)

            nowscore_text2 = myfont_big.render(str(score), True, RED)

            nowscore_text2_rect = nowscore_text2.get_rect()

            nowscore_text2_rect.left, nowscore_text2_rect.top = 50 + nowscore_text1_rect.width, nowscore_text1_rect.top

            screen.blit(nowscore_text2, nowscore_text2_rect)

            # 当前进度

            nowrate_text1 = myfont_big.render("Your Rate:", True, WHITE)

            nowrate_text1_rect = nowrate_text1.get_rect()

            nowrate_text1_rect.left, nowrate_text1_rect.top = 50, 200

            screen.blit(nowrate_text1, nowrate_text1_rect)

            nowrate_text2 = myfont_big.render(f"{rate*100:.2f}%", True, RED)

            nowrate_text2_rect = nowrate_text2.get_rect()

            nowrate_text2_rect.left, nowrate_text2_rect.top = 50 + nowrate_text1_rect.width, nowrate_text1_rect.top

            screen.blit(nowrate_text2, nowrate_text2_rect)

            # 继续游戏

            goon_rect.left, goon_rect.top = (width - goon_rect.width) // 2, 300

            screen.blit(goon_image, goon_rect)

            # 重新开始

            restart_rect.left, restart_rect.top = (width - restart_rect.width) // 2, goon_rect.bottom + 20

            screen.blit(restart_image, restart_rect)

            # 结束游戏

            gameover_rect.left, gameover_rect.top = (width - gameover_rect.width) // 2, restart_rect.bottom + 20

            screen.blit(gameover_image, gameover_rect)

            # 检测用户鼠标操作

            # 如果用户按下鼠标左键

            if pygame.mouse.get_pressed()[0]:

                # 获取鼠标位置

                pos = pygame.mouse.get_pos()

                # 如果用户点击继续游戏

                if goon_rect.left < pos[0] < goon_rect.right and goon_rect.top < pos[1] < goon_rect.bottom:

                    # 跳出主页面

                    mained = False

                # 重新开始

                elif restart_rect.left < pos[0] < restart_rect.right and restart_rect.top < pos[1] < restart_rect.bottom:

                    # 判断最高记录是否更新,保存记录

                    if score > record_score:

                        record_score = score

                    # 写入记录文件

                    with open(historyfile, mode='w', encoding='utf-8') as f:

                        f.write(str(record_score))

                        f.write("\n")

                        f.write(str(record_rate))

                        f.close()

                    # 保存剩余单词

                    SaveDict(mydict, myfile)

                    # 退出主页

                    mained = False

                    score = 0

                    mydict = Getletters(olingefile)  # 获取原始单词

                    getnum = 0

                # 如果用户点击结束游戏

                elif gameover_rect.left < pos[0] < gameover_rect.right and gameover_rect.top < pos[1] < gameover_rect.bottom:

                    # 写入记录文件

                    with open(historyfile, mode='w', encoding='utf-8') as f:

                        f.write(str(record_score))

                        f.write("\n")

                        f.write(str(record_rate))

                        f.write("\n")

                        f.write(str(score))

                        f.close()

                    # 保存剩余单词

                    SaveDict(mydict, myfile)

                    # 退出游戏

                    pygame.quit()

                    sys.exit()

        else:

            # screen.blit(background, (0, 0))  # 载入背景图片

            pygame.mixer.music.pause()  # 背景音乐暂停

            win_sound.play()

            win_text = myfont_big.render("Congratulations! You WIN!!!", True, WHITE)

            screen.blit(win_text, (50, 300))

        # 时间间隔

        delay -= 1

        if not delay:

            delay = 50

            promptflag = False

        pygame.display.flip()  # 页面刷新

        clock.tick(60)

if __name__ == "__main__":

    try:

        main()

    except SystemExit:

        pass

    except:

        traceback.print_exc()

        pygame.quit()

        input()

三、效果展示

1)界面展示

 

到此这篇关于Python+Pygame实现简单的单词小游戏的文章就介绍到这了。


50G+学习视频教程
100+Python初阶、中阶、高阶电子书籍
点击拿去

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/5776.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【ArcGIS Pro二次开发】(17):打开GDB、SHP、CAD等各种数据

一、打开GDB数据库 // 输入一个数据库路径string gdbPath "C:\Users\Administrator\Documents\ArcGIS\Projects\Test\Test.gdb";await QueuedTask.Run(() >{// 如果文件夹存在并且包含有效的地理数据库&#xff0c;则会打开地理数据库。using (Geodatabase geoda…

【单片机/普中A2】学习笔记1-配置环境与STC-ISP烧录

目录前言连接到开发板micro-usb 测试安装串口驱动烧写准备源码烧录前言 目前我们的开发需求很简单&#xff0c;仅需三个软件&#xff1a; keli5 编写代码proteus8 professional 描绘电路板STC-ISP 串口烧录 具体教程在 CSDN 等博客平台上已经有很多&#xff0c;这里就不再赘述…

(排序2)希尔排序

写希尔排序注意&#xff1a; 写新元素融入有序数组的过程(end&tmp)将这个过程给多次类比到需要排序的一串数据中 (for&while)排完一组不够&#xff0c;需要排gap组 (再来for)敲定gap下标关系&#xff1a; 希尔排序与直接插入排序的区别与联系 希尔排序的话也叫做缩小…

刷题笔记【3】| 快速刷完67道剑指offer(Java版)

本文已收录于专栏&#x1f33b;《刷题笔记》文章目录前言&#x1f3a8; 1、斐波那契数列题目描述思路一&#xff08;递归&#xff09;思路二&#xff08;循环&#xff09;&#x1f3a8; 2、跳台阶题目描述思路一&#xff08;递归&#xff09;思路二&#xff08;循环&#xff09…

03-03 周五 镜像安装sshd和jupyter以及修改密码

03-03 周五 镜像安装sshd和jupyter以及修改密码时间版本修改人描述2023年3月3日15:34:49V0.1宋全恒新建文档 简介 由于在镜像中需要进行jupyter和sshd的安装&#xff0c;并且需要进行密码的修改&#xff0c;因此在该文档中记录了这两个交互方式的工程设计。 在线加密 在线加密…

Pycharm创建自定义代码片段

简介 PyCharm允许您创建自定义代码片段&#xff0c;也称为代码模板&#xff0c;以提高您的开发效率 实现步骤 1.添加代码模板 打开PyCharm并导航到File->Settings&#xff0c;或者按快捷键ctrl alt s 打开设置 ​ 按照如下序号步骤进行点击&#xff0c;点击“”按钮以…

基于canvas画布的实用类Fabric.js的使用Part.3

目录一、基于canvas画布的实用类Fabric.js的使用Part.1Fabric.js简介 开始方法事件canvas常用属性对象属性图层层级操作复制和粘贴二、基于canvas画布的实用类Fabric.js的使用Part.2锁定拖拽和缩放画布分组动画图像滤镜渐变右键菜单删除三、基于canvas画布的实用类Fabric.js的使…

gcc在Linux下如何运行一个C/C++程序

安装gcc&#xff1a;sudo apt-get install gcc&#xff08;之后输入密码即可&#xff09; 绝对路径的方式进入usr目录&#xff1a; cd /home /home/&#xff1a;是普通用户的主目录&#xff0c;在创建用户时&#xff0c;每个用户要有一个默认登录和保存自己数据的位置&#x…

【数据结构刷题集】链表经典习题

&#x1f63d;PREFACE&#x1f381;欢迎各位→点赞&#x1f44d; 收藏⭐ 评论&#x1f4dd;&#x1f4e2;系列专栏&#xff1a;数据结构刷题集&#x1f50a;本专栏涉及到题目是数据结构专栏的补充与应用&#xff0c;只更新相关题目&#xff0c;旨在帮助提高代码熟练度&#x…

第14章_视图

第14章_视图 &#x1f3e0;个人主页&#xff1a;shark-Gao &#x1f9d1;个人简介&#xff1a;大家好&#xff0c;我是shark-Gao&#xff0c;一个想要与大家共同进步的男人&#x1f609;&#x1f609; &#x1f389;目前状况&#xff1a;23届毕业生&#xff0c;目前在某公司…

Python 自动化指南(繁琐工作自动化)第二版:六、字符串操作

原文&#xff1a;https://automatetheboringstuff.com/2e/chapter6/ 文本是程序将处理的最常见的数据形式之一。您已经知道如何用操作符将两个字符串值连接在一起&#xff0c;但是您可以做得更多。您可以从字符串值中提取部分字符串&#xff0c;添加或删除空格&#xff0c;将字…

【新2023Q2模拟题JAVA】华为OD机试 - 找数字 or 找等值元素

最近更新的博客 华为od 2023 | 什么是华为od,od 薪资待遇,od机试题清单华为OD机试真题大全,用 Python 解华为机试题 | 机试宝典【华为OD机试】全流程解析+经验分享,题型分享,防作弊指南华为od机试,独家整理 已参加机试人员的实战技巧本篇题解:找数字 or 找等值元素 题目 …

华为OD机试 用java实现 -【重组字符串】

最近更新的博客 华为od 2023 | 什么是华为od,od 薪资待遇,od机试题清单华为OD机试真题大全,用 Python 解华为机试题 | 机试宝典【华为OD机试】全流程解析+经验分享,题型分享,防作弊指南华为od机试,独家整理 已参加机试人员的实战技巧本篇题解:重组字符串 题目 给定一个非…

计算机网络 第一章 概述小结

计算机网络 第一章 概述 1.1 因特网概述 名词解释&#xff1a;因特网服务提供者ISP&#xff08;Internet Service Provider&#xff09; 1.2 三种交换方式 电路交换&#xff1a; 优点&#xff1a;通信时延小、有序传输、没有冲突、适用范围广、实时性强、控制简单&#x…

【美赛】2023年MCM问题Y:理解二手帆船价格(代码思路)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

新导则下的防洪评价报告编制方法及洪水建模实践技术

目录 1、《防洪评价报告编制导则解读河道管理范围内建设项目编制导则》&#xff08;SL/T808- 2021&#xff09;解读 2、防洪评价相关制度与解析 3、防洪评价地形获取及常用计算 4、HEC-RAS软件原理及特点 5、HEC-RAS地形导入 6、一维数学模型计算 7、基于数学模型软件的…

用 云GPU 云服务器训练数据集--yolov5

目录 为何使用云GPU训练我们数据集&#xff1f; 云服务器训练数据集教程&#xff1a; 1.创建实例 2.上传数据&#xff08;OSS命令&#xff09; 以下是oss的操作过程 训练模型时可能出现的报错&#xff1a; 为何使用云GPU训练我们数据集&#xff1f; 我们总是花费长达十几个…

ISO文件内添加kickstart完成自动安装

目录 将待制作的centos iso文件挂载到/mnt/目录 将/mnt/下的所有文件复制到新的目录/tmp/mycentos 创建kickstart文件 修改启动文件 重新制作ISO文件 制作完成 kickstart可以实现根据配置自动安装操作系统&#xff0c;本文主要讲解如何让机器读取到iso文件后自动完成操作…

vue尚品汇商城项目-day02【11.对axios二次封装+12.接口统一管理】

文章目录11.对axios二次封装11.1为什么需要进行二次封装axios&#xff1f;11.2在项目当中经常有API文件夹【axios】12.接口统一管理12.1跨域问题12.2接口统一管理12.3不同请求方式的src/api/index.js说明本人其他相关文章链接11.对axios二次封装 安装命令&#xff1a;cnpm inst…

移动端滑动(touch)选项并实现多选效果

移动端滑动选项实现多选效果通过 touchstart、touchmove、 touchend、touchcancel 事件实现通过父元素代理事件的方式实现子组件点击选中选项如果选项添加 disabled 属性将不会被选中移动端拖拽 .box 和 .options 元素时&#xff0c;是有拖拽效果的&#xff0c;去除拖拽效果有两…
最新文章