当前位置: 首页 > article >正文

端午编程小游戏--艾草驱邪

刚刚过去的端午,参加了学校的一个活动,用python做了一个小游戏,当然这个小游戏还可以继续改进,可以加个bgm什么的......

可以小玩一下

import pygame
import random
import math
import sys
import timepygame.init()
pygame.mixer.init()# 屏幕设置
WIDTH, HEIGHT = 800, 600
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("端午节:艾草驱邪")
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREEN = (0, 200, 0)
LIGHT_GREEN = (144, 238, 144, 100)
RED = (255, 0, 0)
BLUE = (0, 0, 255)
YELLOW = (255, 255, 0)
PURPLE = (128, 0, 128)
GRAY = (150, 150, 150)font_small = pygame.font.SysFont('SimHei', 20)
font_medium = pygame.font.SysFont('SimHei', 30)
font_large = pygame.font.SysFont('SimHei', 50)FPS = 60
clock = pygame.time.Clock()MENU = 0
PLAYING = 1
GAME_OVER = 2
INSTRUCTIONS = 3
game_state = MENUNORMAL_MODE = 0
SURVIVAL_MODE = 1
TIME_ATTACK_MODE = 2
current_mode = NORMAL_MODEscore = 0
max_moxa = 30
start_time = 0
time_limit = 60
survival_time = 0class Moxa:def __init__(self, x, y, moxa_type="normal"):self.x = xself.y = yself.type = moxa_typeself.radius = 10self.effect_radius = 80 if moxa_type == "normal" else (120 if moxa_type == "strong" else 60) # 不同类型艾草效果范围self.color = GREEN if moxa_type == "normal" else BLUE if moxa_type == "strong" else YELLOW # 不同类型艾草颜色self.active = Truedef draw(self, surface):if self.active:effect_surface = pygame.Surface((self.effect_radius*2, self.effect_radius*2), pygame.SRCALPHA)pygame.draw.circle(effect_surface, (*self.color[:3], 50), (self.effect_radius, self.effect_radius), self.effect_radius)surface.blit(effect_surface, (self.x - self.effect_radius, self.y - self.effect_radius))pygame.draw.circle(surface, self.color, (self.x, self.y), self.radius)class Evil:def __init__(self, x, y, evil_type="normal"):self.x = xself.y = yself.type = evil_typeself.radius = 8 if evil_type == "normal" else (12 if evil_type == "strong" else 6) # 不同类型邪气大小self.color = RED if evil_type == "normal" else PURPLE if evil_type == "strong" else (200, 100, 0) # 不同类型邪气颜色self.speed = 1.5 if evil_type == "normal" else 2.5 if evil_type == "strong" else 1.0 # 不同类型邪气速度self.direction = random.uniform(0, 2 * math.pi)self.change_dir_counter = 0self.change_dir_interval = random.randint(30, 90)self.being_repelled = Falseself.repulsion_strength = 0self.alpha = 255def move(self, moxas):if self.being_repelled and self.repulsion_strength > 0:self.x += math.cos(self.direction) * self.repulsion_strengthself.y += math.sin(self.direction) * self.repulsion_strengthself.repulsion_strength *= 0.95self.radius *= 0.98self.alpha -= 5if self.repulsion_strength < 0.1 or self.alpha <= 0:return Falsereturn Trueself.change_dir_counter += 1if self.change_dir_counter >= self.change_dir_interval:self.direction = random.uniform(0, 2 * math.pi)self.change_dir_counter = 0self.change_dir_interval = random.randint(30, 90)self.x += math.cos(self.direction) * self.speedself.y += math.sin(self.direction) * self.speedif self.x < self.radius:self.x = self.radiusself.direction = math.pi - self.directionelif self.x > WIDTH - self.radius:self.x = WIDTH - self.radiusself.direction = math.pi - self.directionif self.y < self.radius:self.y = self.radiusself.direction = -self.directionelif self.y > HEIGHT - self.radius:self.y = HEIGHT - self.radiusself.direction = -self.directionfor moxa in moxas:if moxa.active:distance = math.sqrt((self.x - moxa.x)**2 + (self.y - moxa.y)**2)if distance < moxa.effect_radius + self.radius:self.being_repelled = Trueself.direction = math.atan2(self.y - moxa.y, self.x - moxa.x)repel_force = 3 if moxa.type == "normal" else (5 if moxa.type == "strong" else 2)self.repulsion_strength = repel_forcereturn Truereturn Truedef draw(self, surface):color_with_alpha = (*self.color, self.alpha)evil_surface = pygame.Surface((self.radius*2, self.radius*2), pygame.SRCALPHA)pygame.draw.circle(evil_surface, color_with_alpha, (self.radius, self.radius), self.radius)surface.blit(evil_surface, (self.x - self.radius, self.y - self.radius))moxas = []
evils = []
evil_spawn_timer = 0
evil_spawn_interval = 60selected_moxa_type = "normal"
show_type_selection = False
type_selection_timer = 0for _ in range(5):x = random.randint(50, WIDTH - 50)y = random.randint(50, HEIGHT - 50)evil_type = random.choice(["normal", "normal", "strong", "weak"]) # 初始邪气以普通为主evils.append(Evil(x, y, evil_type))running = True
while running:for event in pygame.event.get():if event.type == pygame.QUIT:running = Falseif event.type == pygame.KEYDOWN:if event.key == pygame.K_ESCAPE:if game_state == PLAYING:game_state = MENUelif game_state == INSTRUCTIONS:game_state = MENUelif game_state == GAME_OVER:game_state = MENUelse:running = Falseif event.key == pygame.K_r and game_state == GAME_OVER:game_state = PLAYINGscore = 0moxas = []evils = []for _ in range(5):x = random.randint(50, WIDTH - 50)y = random.randint(50, HEIGHT - 50)evils.append(Evil(x, y, "normal"))start_time = time.time()if current_mode == TIME_ATTACK_MODE:start_time = time.time()elif current_mode == SURVIVAL_MODE:survival_time = 0if event.key == pygame.K_1:selected_moxa_type = "normal"show_type_selection = Truetype_selection_timer = 60if event.key == pygame.K_2:selected_moxa_type = "strong"show_type_selection = Truetype_selection_timer = 60if event.key == pygame.K_3:selected_moxa_type = "weak"show_type_selection = Truetype_selection_timer = 60if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:if game_state == MENU:mouse_x, mouse_y = pygame.mouse.get_pos()button_width, button_height = 200, 50button_y = HEIGHT // 2 - 75if WIDTH // 2 - button_width // 2 <= mouse_x <= WIDTH // 2 + button_width // 2 and button_y <= mouse_y <= button_y + button_height:current_mode = NORMAL_MODEmax_moxa = 30game_state = PLAYINGscore = 0moxas = []evils = []for _ in range(5):x = random.randint(50, WIDTH - 50)y = random.randint(50, HEIGHT - 50)evils.append(Evil(x, y, "normal"))start_time = time.time()button_y += 75if WIDTH // 2 - button_width // 2 <= mouse_x <= WIDTH // 2 + button_width // 2 and button_y <= mouse_y <= button_y + button_height:current_mode = SURVIVAL_MODEmax_moxa = 999game_state = PLAYINGscore = 0moxas = []evils = []for _ in range(5):x = random.randint(50, WIDTH - 50)y = random.randint(50, HEIGHT - 50)evils.append(Evil(x, y, "normal"))survival_time = time.time()button_y += 75if WIDTH // 2 - button_width // 2 <= mouse_x <= WIDTH // 2 + button_width // 2 and button_y <= mouse_y <= button_y + button_height:current_mode = TIME_ATTACK_MODEmax_moxa = 999game_state = PLAYINGscore = 0moxas = []evils = []for _ in range(5):x = random.randint(50, WIDTH - 50)y = random.randint(50, HEIGHT - 50)evils.append(Evil(x, y, "normal"))start_time = time.time()button_y += 75if WIDTH // 2 - button_width // 2 <= mouse_x <= WIDTH // 2 + button_width // 2 and button_y <= mouse_y <= button_y + button_height:game_state = INSTRUCTIONSelif game_state == INSTRUCTIONS:game_state = MENUelif game_state == PLAYING:if current_mode == NORMAL_MODE and len(moxas) >= max_moxa:continue# 放置艾草mouse_x, mouse_y = pygame.mouse.get_pos()moxas.append(Moxa(mouse_x, mouse_y, selected_moxa_type))show_type_selection = Truetype_selection_timer = 60if game_state == PLAYING:evil_spawn_timer += 1if evil_spawn_timer >= evil_spawn_interval:evil_spawn_timer = 0if current_mode == SURVIVAL_MODE:spawn_interval_factor = max(0.5, 1 - survival_time / 300)evil_spawn_interval = int(60 * spawn_interval_factor)if survival_time > 120:evil_type_weights = {"normal": 3, "strong": 5, "weak": 2}else:evil_type_weights = {"normal": 5, "strong": 3, "weak": 2}elif current_mode == TIME_ATTACK_MODE:spawn_interval_factor = max(0.7, 1 - (time.time() - start_time) / time_limit)evil_spawn_interval = int(60 * spawn_interval_factor)if (time.time() - start_time) > time_limit * 0.6:evil_type_weights = {"normal": 4, "strong": 4, "weak": 2}else:evil_type_weights = {"normal": 6, "strong": 2, "weak": 2}else: # NORMAL_MODEevil_type_weights = {"normal": 7, "strong": 2, "weak": 1}evil_type_choices = []for evil_type, weight in evil_type_weights.items():evil_type_choices.extend([evil_type] * weight)new_evil_type = random.choice(evil_type_choices)side = random.randint(0, 3)if side == 0:x = random.randint(0, WIDTH)y = 0elif side == 1:x = WIDTHy = random.randint(0, HEIGHT)elif side == 2:x = random.randint(0, WIDTH)y = HEIGHTelse:x = 0y = random.randint(0, HEIGHT)evils.append(Evil(x, y, new_evil_type))evils_to_remove = []for evil in evils:if not evil.move(moxas):evils_to_remove.append(evil)score += 1for evil in evils_to_remove:evils.remove(evil)if current_mode == SURVIVAL_MODE:survival_time = time.time() - survival_time_start if 'survival_time_start' in locals() else 0if 'survival_time_start' not in locals():survival_time_start = time.time()if current_mode == TIME_ATTACK_MODE:elapsed_time = time.time() - start_timeif elapsed_time >= time_limit:game_state = GAME_OVERif current_mode == NORMAL_MODE and len(moxas) >= max_moxa:game_state = GAME_OVERif show_type_selection:type_selection_timer -= 1if type_selection_timer <= 0:show_type_selection = Falsescreen.fill(BLACK)if game_state == MENU:title_text = font_large.render("端午节:艾草驱邪模拟器", True, WHITE)screen.blit(title_text, (WIDTH // 2 - title_text.get_width() // 2, HEIGHT // 4))button_width, button_height = 200, 50button_x = WIDTH // 2 - button_width // 2button_y = HEIGHT // 2 - 75# 正常模式按钮pygame.draw.rect(screen, GREEN, (button_x, button_y, button_width, button_height))normal_text = font_medium.render("正常模式", True, WHITE)screen.blit(normal_text, (button_x + button_width // 2 - normal_text.get_width() // 2, button_y + button_height // 2 - normal_text.get_height() // 2))# 生存模式按钮button_y += 75pygame.draw.rect(screen, BLUE, (button_x, button_y, button_width, button_height))survival_text = font_medium.render("生存模式", True, WHITE)screen.blit(survival_text, (button_x + button_width // 2 - survival_text.get_width() // 2, button_y + button_height // 2 - survival_text.get_height() // 2))# 限时模式按钮button_y += 75pygame.draw.rect(screen, YELLOW, (button_x, button_y, button_width, button_height))time_text = font_medium.render("限时模式", True, BLACK)screen.blit(time_text, (button_x + button_width // 2 - time_text.get_width() // 2, button_y + button_height // 2 - time_text.get_height() // 2))# 说明按钮button_y += 75pygame.draw.rect(screen, GRAY, (button_x, button_y, button_width, button_height))instructions_text = font_medium.render("游戏说明", True, WHITE)screen.blit(instructions_text, (button_x + button_width // 2 - instructions_text.get_width() // 2, button_y + button_height // 2 - instructions_text.get_height() // 2))elif game_state == INSTRUCTIONS:# 绘制游戏说明title_text = font_large.render("游戏说明", True, WHITE)screen.blit(title_text, (WIDTH // 2 - title_text.get_width() // 2, 50))instructions = ["- 点击屏幕放置艾草,驱散邪气。","- 按数字键 1、2、3 选择不同类型的艾草:","  1: 普通艾草 (绿色,中等效果)","  2: 强效艾草 (蓝色,范围大,驱散力强)","  3: 弱效艾草 (黄色,范围小,驱散力弱)","","- 邪气 (红色/紫色/橙色小点) 会随机移动。","- 当邪气进入艾草的清香范围时,会被驱散。","","- **正常模式**: 限制艾草数量,驱散所有邪气后继续生成,直到放置满艾草数量。","- **生存模式**: 无限艾草,邪气会随时间变强,坚持时间越长分数越高。","- **限时模式**: 无限艾草,在限定时间内驱散尽可能多的邪气。","","按 ESC 返回主菜单。"]y_offset = 120for line in instructions:text = font_small.render(line, True, WHITE)screen.blit(text, (WIDTH // 2 - text.get_width() // 2, y_offset))y_offset += 30elif game_state == PLAYING:for moxa in moxas:moxa.draw(screen)for evil in evils:evil.draw(screen)score_text = font_medium.render(f"得分: {score}", True, WHITE)screen.blit(score_text, (10, 10))if current_mode == NORMAL_MODE:moxa_count_text = font_small.render(f"艾草: {len(moxas)}/{max_moxa}", True, WHITE)screen.blit(moxa_count_text, (10, 50))if show_type_selection:type_names = {"normal": "普通艾草", "strong": "强效艾草", "weak": "弱效艾草"}type_text = font_small.render(f"已选择: {type_names[selected_moxa_type]}", True, WHITE)screen.blit(type_text, (WIDTH - type_text.get_width() - 10, 10))mode_names = {NORMAL_MODE: "正常模式", SURVIVAL_MODE: "生存模式", TIME_ATTACK_MODE: "限时模式"}mode_text = font_small.render(f"模式: {mode_names[current_mode]}", True, WHITE)screen.blit(mode_text, (10, HEIGHT - 30))if current_mode == TIME_ATTACK_MODE:elapsed_time = time.time() - start_timeremaining_time = max(0, time_limit - elapsed_time)time_text = font_small.render(f"剩余时间: {int(remaining_time)}秒", True, WHITE)screen.blit(time_text, (WIDTH - time_text.get_width() - 10, HEIGHT - 30))elif current_mode == SURVIVAL_MODE:survival_time_text = font_small.render(f"生存时间: {int(survival_time)}秒", True, WHITE)screen.blit(survival_time_text, (WIDTH - survival_time_text.get_width() - 10, HEIGHT - 30))elif game_state == GAME_OVER:game_over_text = font_large.render("游戏结束", True, WHITE)screen.blit(game_over_text, (WIDTH // 2 - game_over_text.get_width() // 2, HEIGHT // 3))score_text = font_medium.render(f"最终得分: {score}", True, WHITE)screen.blit(score_text, (WIDTH // 2 - score_text.get_width() // 2, HEIGHT // 2))if current_mode == SURVIVAL_MODE:survival_time_text = font_medium.render(f"生存时间: {int(survival_time)}秒", True, WHITE)screen.blit(survival_time_text, (WIDTH // 2 - survival_time_text.get_width() // 2, HEIGHT // 2 + 50))restart_text = font_small.render("按 R 键重新开始,按 ESC 返回主菜单", True, WHITE)screen.blit(restart_text, (WIDTH // 2 - restart_text.get_width() // 2, HEIGHT * 2 // 3))pygame.display.flip()clock.tick(FPS)pygame.quit()
sys.exit()

相关文章:

端午编程小游戏--艾草驱邪

刚刚过去的端午&#xff0c;参加了学校的一个活动&#xff0c;用python做了一个小游戏&#xff0c;当然这个小游戏还可以继续改进&#xff0c;可以加个bgm什么的...... 可以小玩一下 import pygame import random import math import sys import timepygame.init() pygame.mi…...

新成果:GaN基VCSEL动态物理模型开发

作为高速数据传输与光电信号处理的核心器件&#xff0c;垂直腔面发射激光器&#xff08;VCSEL&#xff09;在高速光通信、激光雷达等领域应用广泛&#xff0c;其动态特性直接关联器件调制速率及稳定性等关键参数。近期&#xff0c;天津赛米卡尔科技有限公司技术团队开发了GaN基…...

0x-4-Oracle 23 ai-sqlcl 25.1.1 独立安装-配置和优化

一、独立安装sqlcl 1. ​安装 Java 环境​ SQLcl 需要 Java 1.8.0_220 或更高版本&#xff0c; Oracle Linux9.6 上已经默认安装Oracle 23ai后Java 是11 lts版本 如果java jdk安装错误将遇上SQLcl困扰n多人的bug sql /nolog 错误&#xff1a;找不到或加载主类 oracle.dbto…...

Appium+python自动化(十一)- 元素定位- 下

1、 List定位 List顾名思义就是一个列表&#xff0c;在python里面也有list这一个说法&#xff0c;如果你不是很理解什么是list&#xff0c;这里暂且理解为一个数组或者说一个集合。首先一个list是一个集合&#xff0c;那么他的个数也就成了不确定性&#xff0c;所以这里需要用复…...

免费批量PDF转Word工具

免费批量PDF转Word工具 工具简介 这是一款简单易用的批量PDF转Word工具&#xff0c;支持&#xff1a; 批量转换多个PDF文件保留原始格式和布局快速高效的转换速度完全免费使用 工具地址 下载链接 网盘下载地址&#xff1a;点击下载 提取码&#xff1a;8888 功能特点 ✅…...

OD 算法题 B卷【水果摊小买卖】

文章目录 水果摊小买卖 水果摊小买卖 小王手里有点闲钱&#xff0c;想做点水果买卖&#xff0c;给出两个数组m, n&#xff0c; m[i]表示第i个水果的成本价&#xff0c;n[i]表示第i个水果能卖出的价格&#xff1b;假如现在有本钱k&#xff0c;试问最后最多能赚多少钱&#xff1…...

Mac/iOS 如何解压 RAR 格式压缩包:常用工具与详细操作步骤

一、Mac 系统解压 RAR 文件之法 Mac 系统上解压 RAR 文件有多种方法&#xff0c;除了系统自带的一些简单功能外&#xff0c;还可以借助特定的软件来实现高效解压。以下将介绍几款常用工具的解压操作。 &#xff08;一&#xff09;解压专家解压步骤 解压专家 是一款在 Mac 和 …...

二进制安全-IDA Pro-API

idaapi 是 IDA Pro&#xff08;Interactive Disassembler Professional&#xff09; 反汇编工具的 Python API 接口&#xff0c;用于开发自动化脚本、插件和自定义分析工具。通过 idaapi&#xff0c;开发者可以访问 IDA Pro 的核心功能&#xff08;如反汇编、符号分析、交叉引用…...

机器学习监督学习实战四:九种回归算法对波士顿房价数据进行回归预测和评估方法可视化

本项目代码在个人github链接&#xff1a;https://github.com/KLWU07/Machine-learning-Project-practice/tree/main 处理流程 1.导入波士顿房价数据集并进行预处理。2.使用 GradientBoostingRegressor 模型进行回归分析。3.通过交叉验证评估模型的性能&#xff0c;计算 MAE、…...

1. Web网络基础 - IP地址核心知识解析

深入解析IP地址与ipconfig命令&#xff1a;网络工程师的必备技能 在网络世界中&#xff0c;IP地址是设备通信的基石。本文将全面解析IP地址的核心概念&#xff0c;并通过ipconfig命令实战演示如何获取关键网络配置信息。 一、IP地址核心知识解析 1. IP地址的本质 定义&#x…...

微软重磅发布Magentic UI,交互式AI Agent助手实测!

微软重磅发布Magentic UI,交互式AI Agent助手实测! 何为Magentic UI? Magentic UI 是微软于5.19重磅发布的开源Agent助手,并于24日刚更新了第二个版本0.04版 从官方的介绍来看,目标是打造一款 以人为中心 的智能助手,其底层由多个不同的智能体系统驱动,能够实现网页浏览…...

c# 完成恩尼格玛加密扩展

c# 完成恩尼格玛加密扩展 恩尼格玛扩展为可见字符恩尼格玛的设备原始字符顺序转子的设置反射器的设置连接板的设置 初始数据的设置第一版 C# 代码第二版 C# 代码 总结 恩尼格玛 在之前&#xff0c;我们使用 python 实现了一版恩尼格玛的加密算法&#xff0c;但是这一版&#x…...

华为 “一底双长焦” 专利公布,引领移动影像新变革

6 月 6 日&#xff0c;国家知识产权局公布的一项专利发明申请吸引了众多目光&#xff0c;该专利发明人为华为技术有限公司&#xff0c;名为 “光学镜头、摄像头模组及电子设备” 。从展示的技术图来看&#xff0c;这一光学镜头呈现出独特的 “一底双镜头结构”&#xff0c;其中…...

老年生活照护实训室建设规划:照护质量评估与持续改进实训体系

随着人口老龄化程度的不断加深&#xff0c;老年生活照护需求日益增长&#xff0c;对专业照护人才的培养提出了更高要求。老年生活照护实训室建设方案作为培养高素质照护人才的重要载体&#xff0c;其核心在于构建科学完善的照护质量评估与持续改进实训体系。通过该体系的建设&a…...

【python深度学习】Day 48 PyTorch基本数据类型与操作

知识点&#xff1a; 随机张量的生成&#xff1a;torch.randn函数卷积和池化的计算公式&#xff08;可以不掌握&#xff0c;模型会自动计算的&#xff09;pytorch的广播机制&#xff1a;加法和乘法的广播机制 ps&#xff1a;numpy运算也有类似的广播机制&#xff0c;基本一致 作…...

Go深入学习延迟语句

1 延迟语句是什么 编程的时候&#xff0c;经常会需要申请一些资源&#xff0c;比如数据库连接、文件、锁等&#xff0c;这些资源需要再使用后释放掉&#xff0c;否则会造成内存泄露。但是编程人员经常容易忘记释放这些资源&#xff0c;从而造成一些事故。 Go 语言直接在语言层…...

【大模型】【推荐系统】LLM在推荐系统中的应用价值

文章目录 A 论文出处B 背景B.1 背景介绍B.2 问题提出B.3 创新点B.4 两大推荐方法 C 模型结构C.1 知识蒸馏&#xff08;训练过程&#xff09;C.2 轻量推理&#xff08;部署过程&#xff09; D 实验设计E 个人总结 A 论文出处 论文题目&#xff1a;SLMRec&#xff1a;Distilling…...

uni-app学习笔记二十九--数据缓存

uni.setStorageSync(KEY,DATA) 将 data 存储在本地缓存中指定的 key 中&#xff0c;如果有多个key相同&#xff0c;下面的会覆盖掉原上面的该 key 对应的内容&#xff0c;这是一个同步接口。数据可以是字符串&#xff0c;可以是数组。 <script setup>uni.setStorageSyn…...

csharp基础....

int[][] jaggedArray new int[3][]; jaggedArray[0] new int[] { 1, 2 }; jaggedArray[1] new int[] { 3, 4, 5 }; jaggedArray[2] new int[] { 6, 7, 8, 9 }; 嵌套 反转和排序 List<int> list new List<int> { 1, 2, 3, 4, 5 }; list.Reverse(); Cons…...

【C/C++】EBO空基类优化介绍

空对象优化&#xff08;Empty Base Optimization&#xff0c;简称 EBO&#xff09;是 C 编译器的一种 优化技术&#xff0c;用于消除空类作为基类时占用的内存空间&#xff0c;从而避免浪费空间、提升结构体或类的存储效率。 1 什么是“空对象”&#xff1f; 一个**空类&#…...

工作邮箱收到钓鱼邮件,点了链接进去无法访问,会有什么问题吗?

没事的&#xff0c;很可能是被安全网关拦截了。最近做勒索实验&#xff0c;有感而发&#xff0c;不要乱点击邮箱中的附件。 最初我们采用钓鱼邮件投递恶意载荷&#xff0c;发现邮件网关把我们的 exe/bat 程序直接拦截了&#xff0c;换成压缩包也一样拦截了&#xff0c;载荷始终…...

基于安卓的线上考试APP源码数据库文档

摘 要 21世纪的今天&#xff0c;随着社会的不断发展与进步&#xff0c;人们对于信息科学化的认识&#xff0c;已由低层次向高层次发展&#xff0c;由原来的感性认识向理性认识提高&#xff0c;管理工作的重要性已逐渐被人们所认识&#xff0c;科学化的管理&#xff0c;使信息存…...

【数据结构】顺序表和链表详解(下)

前言&#xff1a;上期我们从顺序表开始讲到了单链表的概念&#xff0c;分类&#xff0c;和实现&#xff0c;而这期我们来将相较于单链表没那么常用的双向链表。 文章目录 一、双向链表二&#xff0c;双向链表的实现一&#xff0c;增1&#xff0c;头插2&#xff0c;尾插3&#x…...

【系统架构设计师】绪论-系统架构概述

目录 绪论 系统架构概述 单选题 绪论 系统架构概述 单选题 1、软件方法学是以软件开发方法为研究对象的学科。其中&#xff0c;&#xff08;&#xff09;是先对最高居次中的问题进行定义、设计、编程和测试&#xff0c;而将其中未解决的问题作为一个子任务放到下一层次中去…...

SQL-事务(2025.6.6-2025.6.7学习篇)

1、简介 事务是一组操作的集合&#xff0c;它是一个不可分割的工作单位&#xff0c;事务会把所有的操作作为一个整体一起向系统提交或撤销操作请求&#xff0c;即这些操作要么同时成功&#xff0c;要么同时失败。 默认MySQL的事务是自动提交的&#xff0c;也就是说&#xff0…...

OpenCV 图像通道的分离与合并

一、知识点 1、一张彩色图像可以由R、G、B三个通道的灰度图合并而成。 2、void split(InputArray m, OutputArrayOfArrays mv); (1)、将多通道阵列划分为几个单通道阵列。 (2)、参数说明: m: 要分离的多通道阵列。 mv: 输出的vector容器&#xff0c;每个元素都…...

Virtex II 系列FPGA的配置原理

对FPGA 芯片的配置&#xff0c;本质上是将根据设计生成的包含配置命令和配置数据的比特流文件写入到配置存储器中。 1 配置模式 Virtex II 系列FPGA 一共有五种配置模式&#xff0c;配置模式的选择是根据管脚M[2:0]来决定。 &#xff08;1&#xff09;串行配置模式 串行配置模…...

蓝桥杯 国赛2024python(b组)题目(1-3)

第一题 试卷答题页 - 蓝桥云课 问题描述 在今年蓝桥杯的决赛中&#xff0c;一共有 1010 道题目&#xff0c;每道题目的分数依次为 55 分&#xff0c;55 分&#xff0c;1010 分&#xff0c;1010 分&#xff0c;1515 分&#xff0c;1515 分&#xff0c;2020 分&#xff0c;2020 分…...

低代码平台前端页面表格字段绑定与后端数据传输交互主要有哪些方式?华为云Astro在这方面有哪些方式?

目录 🔧 一、低代码平台中常见的数据绑定与交互方式 1. 接口绑定(API 调用) 2. 数据源绑定(DataSource) 3. 变量中转(临时变量 / 页面状态) 4. 数据模型绑定(模型驱动) 🌐 二、华为云 Astro 轻应用的实现方式 ✅ 1. 数据源绑定(API服务+API网关) ✅ 2. 变…...

stm32——UART和USART

串口通信协议UART和USART 1. UART与USART协议详解 特性UART (Universal Asynchronous Receiver/Transmitter)USART (Universal Synchronous Asynchronous Receiver/Transmitter)全称通用异步收发器通用同步/异步收发器同步/异步异步&#xff1a;不共享时钟&#xff0c;数据通过…...