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

news2025/6/9 10:15:31

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

可以小玩一下

import pygame
import random
import math
import sys
import time

pygame.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 = MENU

NORMAL_MODE = 0
SURVIVAL_MODE = 1
TIME_ATTACK_MODE = 2
current_mode = NORMAL_MODE

score = 0
max_moxa = 30
start_time = 0
time_limit = 60
survival_time = 0

class Moxa:
    def __init__(self, x, y, moxa_type="normal"):
        self.x = x
        self.y = y
        self.type = moxa_type
        self.radius = 10
        self.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 = True

    def 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 = x
        self.y = y
        self.type = evil_type
        self.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 = 0
        self.change_dir_interval = random.randint(30, 90)
        self.being_repelled = False
        self.repulsion_strength = 0
        self.alpha = 255

    def move(self, moxas):
        if self.being_repelled and self.repulsion_strength > 0:
            self.x += math.cos(self.direction) * self.repulsion_strength
            self.y += math.sin(self.direction) * self.repulsion_strength
            self.repulsion_strength *= 0.95
            self.radius *= 0.98
            self.alpha -= 5
            if self.repulsion_strength < 0.1 or self.alpha <= 0:
                 return False
            return True

        self.change_dir_counter += 1
        if self.change_dir_counter >= self.change_dir_interval:
            self.direction = random.uniform(0, 2 * math.pi)
            self.change_dir_counter = 0
            self.change_dir_interval = random.randint(30, 90)

        self.x += math.cos(self.direction) * self.speed
        self.y += math.sin(self.direction) * self.speed
        if self.x < self.radius:
            self.x = self.radius
            self.direction = math.pi - self.direction
        elif self.x > WIDTH - self.radius:
            self.x = WIDTH - self.radius
            self.direction = math.pi - self.direction
        if self.y < self.radius:
            self.y = self.radius
            self.direction = -self.direction
        elif self.y > HEIGHT - self.radius:
            self.y = HEIGHT - self.radius
            self.direction = -self.direction

        for 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 = True

                    self.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_force
                    return True

        return True

    def 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 = 60

selected_moxa_type = "normal"
show_type_selection = False
type_selection_timer = 0

for _ 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 = False

        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_ESCAPE:
                if game_state == PLAYING:
                    game_state = MENU
                elif game_state == INSTRUCTIONS:
                    game_state = MENU
                elif game_state == GAME_OVER:
                    game_state = MENU
                else:
                    running = False

            if event.key == pygame.K_r and game_state == GAME_OVER:
                game_state = PLAYING
                score = 0
                moxas = []
                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 = 0

            if event.key == pygame.K_1:
                selected_moxa_type = "normal"
                show_type_selection = True
                type_selection_timer = 60
            if event.key == pygame.K_2:
                selected_moxa_type = "strong"
                show_type_selection = True
                type_selection_timer = 60
            if event.key == pygame.K_3:
                selected_moxa_type = "weak"
                show_type_selection = True
                type_selection_timer = 60

        if 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, 50
                button_y = HEIGHT // 2 - 75

                if WIDTH // 2 - button_width // 2 <= mouse_x <= WIDTH // 2 + button_width // 2 and button_y <= mouse_y <= button_y + button_height:
                    current_mode = NORMAL_MODE
                    max_moxa = 30
                    game_state = PLAYING
                    score = 0
                    moxas = []
                    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 += 75
                if WIDTH // 2 - button_width // 2 <= mouse_x <= WIDTH // 2 + button_width // 2 and button_y <= mouse_y <= button_y + button_height:
                    current_mode = SURVIVAL_MODE
                    max_moxa = 999
                    game_state = PLAYING
                    score = 0
                    moxas = []
                    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 += 75
                if 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_MODE
                    max_moxa = 999
                    game_state = PLAYING
                    score = 0
                    moxas = []
                    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 += 75
                if WIDTH // 2 - button_width // 2 <= mouse_x <= WIDTH // 2 + button_width // 2 and button_y <= mouse_y <= button_y + button_height:
                    game_state = INSTRUCTIONS

            elif game_state == INSTRUCTIONS:
                game_state = MENU

            elif 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 = True
                type_selection_timer = 60
    if game_state == PLAYING:
        evil_spawn_timer += 1
        if evil_spawn_timer >= evil_spawn_interval:
            evil_spawn_timer = 0
            if 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_MODE
                evil_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 = 0
            elif side == 1:
                x = WIDTH
                y = random.randint(0, HEIGHT)
            elif side == 2:
                x = random.randint(0, WIDTH)
                y = HEIGHT
            else:
                x = 0
                y = 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 += 1
        for 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 0
            if 'survival_time_start' not in locals():
                 survival_time_start = time.time()

        if current_mode == TIME_ATTACK_MODE:
            elapsed_time = time.time() - start_time
            if elapsed_time >= time_limit:
                game_state = GAME_OVER

        if current_mode == NORMAL_MODE and len(moxas) >= max_moxa:
            game_state = GAME_OVER
        if show_type_selection:
            type_selection_timer -= 1
            if type_selection_timer <= 0:
                show_type_selection = False

    screen.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, 50
        button_x = WIDTH // 2 - button_width // 2
        button_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 += 75
        pygame.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 += 75
        pygame.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 += 75
        pygame.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 = 120
        for line in instructions:
            text = font_small.render(line, True, WHITE)
            screen.blit(text, (WIDTH // 2 - text.get_width() // 2, y_offset))
            y_offset += 30

    elif 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_time
            remaining_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()

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

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

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

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 功能特点 ✅…

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

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

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

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

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

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

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

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

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

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

【大模型】【推荐系统】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…

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

没事的&#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…

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 分…

算法题(165):汉诺塔问题

审题&#xff1a; 本题需要我们找到最优的汉诺塔搬法然后将移动路径输出 思路&#xff1a; 方法一&#xff1a;递归 我们先分析题目 n为2的情况&#xff0c;我们先将第一个盘子移动到三号柱子上&#xff0c;然后再将二号盘子移动到二号柱子上 n为3的情况&#xff0c;我们先将前…

玄机——某次行业攻防应急响应(带镜像)

今天给大家带来一次攻防实战演练复现的过程。 文章目录 简介靶机简介1.根据流量包分析首个进行扫描攻击的IP是2.根据流量包分析第二个扫描攻击的IP和漏扫工具&#xff0c;以flag{x.x.x.x&工具名}3.提交频繁爆破密钥的IP及爆破次数&#xff0c;以flag{ip&次数}提交4. 提…

低代码逻辑引擎配置化实战:三步穿透审批记录查询

在堆积如山的报销单中埋头寻找某笔特殊费用的审批轨迹在跨部门协作时被追问"这个合同到底卡在哪个环节" 在快节奏的办公自动化场景中&#xff0c;这些场景是很常见的&#xff0c;传统OA系统中分散的审批记录查询方式往往太繁琐。 为破解这一痛点&#xff0c;在JVS低…