植物大战僵尸Python版,附带源码注解

目录

一、实现功能

二、安装环境要求

三、如何开始游戏

四、怎么玩

五、演示

六、部分源码注释

6.1main.py

6.2map.py

6.3Menubar.py

七、自定义

7.1plant.json

7.2zombie.json

一、实现功能

  • 实施植物:向日葵、豌豆射手、壁桃、雪豆射手、樱桃炸弹、三豌豆射手、大口蘑菇,海扁蘑菇,土豆,尖刺草,惊吓蘑菇,南瓜,惊吓蘑菇,墨西哥辣椒,太阳蘑菇,冰蘑菇,催眠蘑菇。
  • 实现僵尸:僵尸、旗帜僵尸、锥头僵尸、桶头僵尸、报纸僵尸。
  • 使用JSON文件存储关卡数据(例如僵尸的位置和时间,背景信息)
  • 支持在关卡开始时选择植物卡
  • 支持日间关卡、夜间关卡、移动卡选择关卡和壁桃保龄球关卡

二、安装环境要求

  • Python 3.7
  • Notice:建议使用 python 3.7 版本,但不是必需的。对于 LINUX:如果您的 Linux 系统预装了 python 3+,则可以运行此游戏。直接更新到 python 3.7 可能会破坏 LINUX Mint。
  • Python-Pygame 1.9

三、如何开始游戏

python main.py

四、怎么玩

  • 使用鼠标收集阳光,选择植物卡片并播种植物
  • 您可以通过更改 source/constants.py 中的START_LEVEL_NUM值来设置起始级别
    • 级别 1 和 2:天级别
    • 第 3 级:夜间级别
    • 第 4 级:移动卡片选择级别
    • 第5级:墙果保龄球级别

五、演示

六、部分源码注释

项目结构如下:

6.1main.py

import pygame as pg
from source.main import mainif __name__=='__main__':main()pg.quit()

6.2map.py

   定义了一个地图类 Map,包含了地图的初始化、位置验证、可移动性检查、位置转换等方法。

__author__ = 'marble_xu'# 导入必要的模块
import random
import pygame as pg
from .. import tool
from .. import constants as c# 地图类定义
class Map():def __init__(self, width, height):# 初始化地图的宽度和高度self.width = widthself.height = height# 创建一个二维数组来表示地图,初始值为0self.map = [[0 for x in range(self.width)] for y in range(self.height)]# 检查指定位置是否在地图范围内def isValid(self, map_x, map_y):if (map_x < 0 or map_x >= self.width ormap_y < 0 or map_y >= self.height):return Falsereturn True# 检查指定位置是否可移动def isMovable(self, map_x, map_y):return (self.map[map_y][map_x] == c.MAP_EMPTY)# 根据实际坐标获取地图索引def getMapIndex(self, x, y):x -= c.MAP_OFFSET_Xy -= c.MAP_OFFSET_Yreturn (x // c.GRID_X_SIZE, y // c.GRID_Y_SIZE)# 根据地图索引获取网格的中心位置坐标def getMapGridPos(self, map_x, map_y):return (map_x * c.GRID_X_SIZE + c.GRID_X_SIZE//2 + c.MAP_OFFSET_X,map_y * c.GRID_Y_SIZE + c.GRID_Y_SIZE//5 * 3 + c.MAP_OFFSET_Y)# 设置指定位置的地图网格类型def setMapGridType(self, map_x, map_y, type):self.map[map_y][map_x] = type# 获取一个随机的地图索引def getRandomMapIndex(self):map_x = random.randint(0, self.width-1)map_y = random.randint(0, self.height-1)return (map_x, map_y)# 在指定位置显示植物,返回植物显示的位置def showPlant(self, x, y):pos = Nonemap_x, map_y = self.getMapIndex(x, y)# 检查位置是否有效且可移动if self.isValid(map_x, map_y) and self.isMovable(map_x, map_y):# 获取植物显示的位置pos = self.getMapGridPos(map_x, map_y)return pos

6.3Menubar.py

# 导入必要的模块
import random
import pygame as pg
from .. import tool
from .. import constants as c# 面板初始位置及间距
PANEL_Y_START = 87
PANEL_X_START = 22
PANEL_Y_INTERNAL = 74
PANEL_X_INTERNAL = 53
CARD_LIST_NUM = 8# 植物卡片名称列表
card_name_list = [c.CARD_SUNFLOWER, c.CARD_PEASHOOTER, c.CARD_SNOWPEASHOOTER, c.CARD_WALLNUT,c.CARD_CHERRYBOMB, c.CARD_THREEPEASHOOTER, c.CARD_REPEATERPEA, c.CARD_CHOMPER,c.CARD_PUFFSHROOM, c.CARD_POTATOMINE, c.CARD_SQUASH, c.CARD_SPIKEWEED,c.CARD_JALAPENO, c.CARD_SCAREDYSHROOM, c.CARD_SUNSHROOM, c.CARD_ICESHROOM,c.CARD_HYPNOSHROOM, c.CARD_WALLNUT, c.CARD_REDWALLNUT]
# 植物名称列表
plant_name_list = [c.SUNFLOWER, c.PEASHOOTER, c.SNOWPEASHOOTER, c.WALLNUT,c.CHERRYBOMB, c.THREEPEASHOOTER, c.REPEATERPEA, c.CHOMPER,c.PUFFSHROOM, c.POTATOMINE, c.SQUASH, c.SPIKEWEED,c.JALAPENO, c.SCAREDYSHROOM, c.SUNSHROOM, c.ICESHROOM,c.HYPNOSHROOM, c.WALLNUTBOWLING, c.REDWALLNUTBOWLING]
# 植物所需阳光值列表
plant_sun_list = [50, 100, 175, 50, 150, 325, 200, 150, 0, 25, 50, 100, 125, 25, 25, 75, 75, 0, 0]
# 植物冷冻时间列表
plant_frozen_time_list = [7500, 7500, 7500, 30000, 50000, 7500, 7500, 7500, 7500, 30000,30000, 7500, 50000, 7500, 7500, 50000, 30000, 0, 0]
# 所有卡片索引列表
all_card_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]# 获取阳光值图片
def getSunValueImage(sun_value):font = pg.font.SysFont(None, 22)width = 32msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW)msg_rect = msg_image.get_rect()msg_w = msg_rect.widthimage = pg.Surface([width, 17])x = width - msg_wimage.fill(c.LIGHTYELLOW)image.blit(msg_image, (x, 0), (0, 0, msg_rect.w, msg_rect.h))image.set_colorkey(c.BLACK)return image# 获取卡片池
def getCardPool(data):card_pool = []for card in data:tmp = card['name']for i, name in enumerate(plant_name_list):if name == tmp:card_pool.append(i)breakreturn card_pool# 卡片类
class Card():def __init__(self, x, y, name_index, scale=0.78):self.loadFrame(card_name_list[name_index], scale)self.rect = self.orig_image.get_rect()self.rect.x = xself.rect.y = yself.name_index = name_indexself.sun_cost = plant_sun_list[name_index]self.frozen_time = plant_frozen_time_list[name_index]self.frozen_timer = -self.frozen_timeself.refresh_timer = 0self.select = True# 加载卡片帧def loadFrame(self, name, scale):frame = tool.GFX[name]rect = frame.get_rect()width, height = rect.w, rect.hself.orig_image = tool.get_image(frame, 0, 0, width, height, c.BLACK, scale)self.image = self.orig_image# 检查鼠标点击位置def checkMouseClick(self, mouse_pos):x, y = mouse_posif(x >= self.rect.x and x <= self.rect.right andy >= self.rect.y and y <= self.rect.bottom):return Truereturn False# 检查是否可以点击def canClick(self, sun_value, current_time):if self.sun_cost <= sun_value and (current_time - self.frozen_timer) > self.frozen_time:return Truereturn False# 检查是否可选中def canSelect(self):return self.select# 设置是否选中def setSelect(self, can_select):self.select = can_selectif can_select:self.image.set_alpha(255)else:self.image.set_alpha(128)# 设置冷冻时间def setFrozenTime(self, current_time):self.frozen_timer = current_time# 创建卡片图片以显示冷却状态或阳光值不足状态def createShowImage(self, sun_value, current_time):time = current_time - self.frozen_timerif time < self.frozen_time: # 冷却状态image = pg.Surface([self.rect.w, self.rect.h])frozen_image = self.orig_image.copy()frozen_image.set_alpha(128)frozen_height = (self.frozen_time - time)/self.frozen_time * self.rect.himage.blit(frozen_image, (0,0), (0, 0, self.rect.w, frozen_height))image.blit(self.orig_image, (0,frozen_height),(0, frozen_height, self.rect.w, self.rect.h - frozen_height))elif self.sun_cost > sun_value: # 阳光值不足状态image = self.orig_image.copy()image.set_alpha(192)else:image = self.orig_imagereturn image# 更新卡片状态def update(self, sun_value, current_time):if (current_time - self.refresh_timer) >= 250:self.image = self.createShowImage(sun_value, current_time)self.refresh_timer = current_time# 绘制卡片def draw(self, surface):surface.blit(self.image, self.rect)# 菜单栏类
class MenuBar():def __init__(self, card_list, sun_value):self.loadFrame(c.MENUBAR_BACKGROUND)self.rect = self.image.get_rect()self.rect.x = 10self.rect.y = 0self.sun_value = sun_valueself.card_offset_x = 32self.setupCards(card_list)# 加载背景帧def loadFrame(self, name):frame = tool.GFX[name]rect = frame.get_rect()frame_rect = (rect.x, rect.y, rect.w, rect.h)self.image = tool.get_image(tool.GFX[name], *frame_rect, c.WHITE, 1)# 更新菜单栏状态def update(self, current_time):self.current_time = current_timefor card in self.card_list:card.update(self.sun_value, self.current_time)# 创建图片def createImage(self, x, y, num):if num == 1:returnimg = self.imagerect = self.image.get_rect()width = rect.wheight = rect.hself.image = pg.Surface((width * num, height)).convert()self.rect = self.image.get_rect()self.rect.x = xself.rect.y = yfor i in range(num):x = i * widthself.image.blit(img, (x,0))self.image.set_colorkey(c.BLACK)# 设置卡片def setupCards(self, card_list):self.card_list = []x = self.card_offset_xy = 8for index in card_list:x += 55self.card_list.append(Card(x, y, index))# 检查卡片点击def checkCardClick(self, mouse_pos):result = Nonefor card in self.card_list:if card.checkMouseClick(mouse_pos):if card.canClick(self.sun_value, self.current_time):result = (plant_name_list[card.name_index], card)breakreturn result# 检查菜单栏点击def checkMenuBarClick(self, mouse_pos):x, y = mouse_posif(x >= self.rect.x and x <= self.rect.right andy >= self.rect.y and y <= self.rect.bottom):return Truereturn False# 减少阳光值def decreaseSunValue(self, value):self.sun_value -= value# 增加阳光值def increaseSunValue(self, value):self.sun_value += value# 设置卡片冷冻时间def setCardFrozenTime(self, plant_name):for card in self.card_list:if plant_name_list[card.name_index] == plant_name:card.setFrozenTime(self.current_time)break# 绘制阳光值def drawSunValue(self):self.value_image = getSunValueImage(self.sun_value)self.value_rect = self.value_image.get_rect()self.value_rect.x = 21self.value_rect.y = self.rect.bottom - 21self.image.blit(self.value_image, self.value_rect)# 绘制菜单栏def draw(self, surface):self.drawSunValue()surface.blit(self.image, self.rect)for card in self.card_list:card.draw(surface)# 面板类
class Panel():def __init__(self, card_list, sun_value):self.loadImages(sun_value)self.selected_cards = []self.selected_num = 0self.setupCards(card_list)# 加载图片def loadFrame(self, name):frame = tool.GFX[name]rect = frame.get_rect()frame_rect = (rect.x, rect.y, rect.w, rect.h)return tool.get_image(tool.GFX[name], *frame_rect, c.WHITE, 1)# 加载图片及设置def loadImages(self, sun_value):self.menu_image = self.loadFrame(c.MENUBAR_BACKGROUND)self.menu_rect = self.menu_image.get_rect()self.menu_rect.x = 0self.menu_rect.y = 0self.panel_image = self.loadFrame(c.PANEL_BACKGROUND)self.panel_rect = self.panel_image.get_rect()self.panel_rect.x = 0self.panel_rect.y = PANEL_Y_STARTself.value_image = getSunValueImage(sun_value)self.value_rect = self.value_image.get_rect()self.value_rect.x = 21self.value_rect.y = self.menu_rect.bottom - 21self.button_image =  self.loadFrame(c.START_BUTTON)self.button_rect = self.button_image.get_rect()self.button_rect.x = 155self.button_rect.y = 547# 设置卡片def setupCards(self, card_list):self.card_list = []x = PANEL_X_START - PANEL_X_INTERNALy = PANEL_Y_START + 43 - PANEL_Y_INTERNALfor i, index in enumerate(card_list):if i % 8 == 0:x = PANEL_X_START - PANEL_X_INTERNALy += PANEL_Y_INTERNALx += PANEL_X_INTERNALself.card_list.append(Card(x, y, index, 0.75))# 检查卡片点击def checkCardClick(self, mouse_pos):delete_card = Nonefor card in self.selected_cards:if delete_card: # 当删除卡片时,将右边的卡片左移card.rect.x -= 55elif card.checkMouseClick(mouse_pos):self.deleteCard(card.name_index)delete_card = cardif delete_card:self.selected_cards.remove(delete_card)self.selected_num -= 1if self.selected_num == CARD_LIST_NUM:returnfor card in self.card_list:if card.checkMouseClick(mouse_pos):if card.canSelect():self.addCard(card)break# 添加卡片def addCard(self, card):card.setSelect(False)y = 8x = 78 + self.selected_num * 55self.selected_cards.append(Card(x, y, card.name_index))self.selected_num += 1# 删除卡片def deleteCard(self, index):self.card_list[index].setSelect(True)# 检查开始按钮点击def checkStartButtonClick(self, mouse_pos):if self.selected_num < CARD_LIST_NUM:return Falsex, y = mouse_posif (x >= self.button_rect.x and x <= self.button_rect.right andy >= self.button_rect.y and y <= self.button_rect.bottom):return Truereturn False# 获取选中卡片def getSelectedCards(self):card_index_list = []for card in self.selected_cards:card_index_list.append(card.name_index)return card_index_list# 绘制面板def draw(self, surface):self.menu_image.blit(self.value_image, self.value_rect)surface.blit(self.menu_image, self.menu_rect)surface.blit(self.panel_image, self.panel_rect)for card in self.card_list:card.draw(surface)for card in self.selected_cards:card.draw(surface)if self.selected_num == CARD_LIST_NUM:surface.blit(self.button_image, self.button_rect)# 移动卡片类
class MoveCard():def __init__(self, x, y, card_name, plant_name, scale=0.78):self.loadFrame(card_name, scale)self.rect = self.orig_image.get_rect()self.rect.x = xself.rect.y = yself.rect.w = 1self.image = self.createShowImage()self.card_name = card_nameself.plant_name = plant_nameself.move_timer = 0self.select = True# 加载帧def loadFrame(self, name, scale):frame = tool.GFX[name]rect = frame.get_rect()width, height = rect.w, rect.hself.orig_image = tool.get_image(frame, 0, 0, width, height, c.BLACK, scale)self.orig_rect = self.orig_image.get_rect()self.image = self.orig_image# 检查鼠标点击位置def checkMouseClick(self, mouse_pos):x, y = mouse_posif(x >= self.rect.x and x <= self.rect.right andy >= self.rect.y and y <= self.rect.bottom):return Truereturn False# 创建图片def createShowImage(self):'''create a part card image when card appears from left'''if self.rect.w < self.orig_rect.w: #create a part card imageimage = pg.Surface([self.rect.w, self.rect.h])image.blit(self.orig_image, (0, 0), (0, 0, self.rect.w, self.rect.h))self.rect.w += 1else:image = self.orig_imagereturn image# 更新卡片位置def update(self, left_x, current_time):if self.move_timer == 0:self.move_timer = current_timeelif (current_time - self.move_timer) >= c.CARD_MOVE_TIME:if self.rect.x > left_x:self.rect.x -= 1self.image = self.createShowImage()self.move_timer += c.CARD_MOVE_TIME# 绘制卡片def draw(self, surface):surface.blit(self.image, self.rect)# 移动菜单栏类
class MoveBar():def __init__(self, card_pool):self.loadFrame(c.MOVEBAR_BACKGROUND)self.rect = self.image.get_rect()self.rect.x = 90self.rect.y = 0self.card_start_x = self.rect.x + 8self.card_end_x = self.rect.right - 5self.card_pool = card_poolself.card_list = []self.create_timer = -c.MOVEBAR_CARD_FRESH_TIME# 加载背景帧def loadFrame(self, name):frame = tool.GFX[name]rect = frame.get_rect()frame_rect = (rect.x, rect.y, rect.w, rect.h)self.image = tool.get_image(tool.GFX[name], *frame_rect, c.WHITE, 1)# 创建卡片def createCard(self):if len(self.card_list) > 0 and self.card_list[-1].rect.right > self.card_end_x:return Falsex = self.card_end_xy = 6index = random.randint(0, len(self.card_pool) - 1)card_index = self.card_pool[index]card_name = card_name_list[card_index] + '_move'plant_name = plant_name_list[card_index]self.card_list.append(MoveCard(x, y, card_name, plant_name))return True# 更新状态def update(self, current_time):self.current_time = current_timeleft_x = self.card_start_xfor card in self.card_list:card.update(left_x, self.current_time)left_x = card.rect.right + 1if(self.current_time - self.create_timer) > c.MOVEBAR_CARD_FRESH_TIME:if self.createCard():self.create_timer = self.current_time# 检查卡片点击def checkCardClick(self, mouse_pos):result = Nonefor index, card in enumerate(self.card_list):if card.checkMouseClick(mouse_pos):result = (card.plant_name, card)breakreturn result# 检查菜单栏点击def checkMenuBarClick(self, mouse_pos):x, y = mouse_posif(x >= self.rect.x and x <= self.rect.right andy >= self.rect.y and y <= self.rect.bottom):return Truereturn False# 删除卡片def deleateCard(self, card):self.card_list.remove(card)# 绘制def draw(self, surface):surface.blit(self.image, self.rect)for card in self.card_list:card.draw(surface)

七、自定义

在PythonPlantsVsZombies-master\source\data,我们可以进行自定义配置,例如僵尸的位置和时间,背景信息。

7.1plant.json

{"plant_image_rect":{"PeaNormal":{"x":28, "y":0, "width":28, "height":34},"PeaIce":{"x":26, "y":0, "width":30, "height":34},"Chomper":{"x":0, "y":0, "width":100, "height":114},"PuffShroom":{"x":0, "y":28, "width":35, "height":38},"PuffShroomSleep":{"x":1, "y":0, "width":39, "height":65},"BulletMushRoom":{"x":0, "y":1, "width":55, "height":21},"PotatoMine":{"x":0, "y":0, "width":75, "height":55},"Squash":{"x":10, "y":140, "width":80, "height":86},"SquashAim":{"x":10, "y":140, "width":80, "height":86},"Spikeweed":{"x":3, "y":0, "width":80, "height":35}}
}

7.2zombie.json

{"zombie_image_rect":{"Zombie":{"x":62, "width":90},"ZombieAttack":{"x":62, "width":90},"ZombieLostHead":{"x":62, "width":90},"ZombieLostHeadAttack":{"x":62, "width":90},"ZombieDie":{"x":0, "width":164},"BoomDie":{"x":68, "width":80},"ConeheadZombie":{"x":80, "width":80},"ConeheadZombieAttack":{"x":79, "width":87},"BucketheadZombie":{"x":54, "width":90},"BucketheadZombieAttack":{"x":46, "width":90},"FlagZombie":{"x":56, "width":110},"FlagZombieAttack":{"x":60, "width":100},"FlagZombieLostHead":{"x":55, "width":110},"FlagZombieLostHeadAttack":{"x":55, "width":110},"NewspaperZombie":{"x":48, "width":92},"NewspaperZombieAttack":{"x":48, "width":92},"NewspaperZombieNoPaper":{"x":40, "width":98},"NewspaperZombieNoPaperAttack":{"x":48, "width":92},"NewspaperZombieLostHead":{"x":44, "width":96},"NewspaperZombieLostHeadAttack":{"x":48, "width":92},"NewspaperZombieDie":{"x":0, "width":100}}
}

参考:

https://blog.csdn.net/m0_68089732/article/details/137202714

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

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux下批量的批量操作

批量删除docker 镜像 docker images | grep ent-form-web |awk ‘{print $3}’ | xargs docker rmi docker images: 列出所有的docker 镜像 docker images | grep ent-form-web : 选取出结果带 ent-form-web的信息 docker images | grep ent-form-web |awk ‘{print $3}’ 选取…

YOLOv5实战记录05 Pyside6可视化界面

个人打卡&#xff0c;慎看。 指路大佬&#xff1a;【手把手带你实战YOLOv5-入门篇】YOLOv5 Pyside6可视化界面_哔哩哔哩_bilibili 零、虚拟环境迁移路径后pip报错解决 yolov5-master文件夹我换位置后&#xff0c;无法pip install了。解决如下&#xff1a; activate.bat中修改…

wsl 2在windows11上的设置

详细参考&#xff1a;Manual installation steps for older versions of WSL | Microsoft Learn 1.系统组件要打开 分别是&#xff1a;Hyper-V、虚拟机平台、适用于Windows的Linux子系统 2.以管理员方式运行命令行&#xff0c;逐步执行下面的命令 update to WSL 2, you must…

js爬虫puppeteer库 解决网页动态渲染无法爬取

我们爬取这个网址上面的股票实时部分宇通客车(600066)_股票价格_行情_走势图—东方财富网 我们用正常的方法爬取会发现爬取不下来&#xff0c;是因为这个网页这里是实时渲染的&#xff0c;我们直接通过网址接口访问这里还没有渲染出来 于是我们可以通过下面的代码来进行爬取: …

PowerJob 分布式任务调度简介

目录 适用场景 设计目标 PowerJob 功能全景 任务调度 工作流 分布式计算 动态容器 什么是动态容器? 使用场景 可维护性和灵活性的完美结合 实时日志&在线运维 PowerJob 系统组件 PowerJob 应用场景 PowerJob 的优势 PowerJob&#xff08;原OhMyScheduler&…

无法用raven-js,如何直接使用TraceKit标准化错误字符串(一次有趣的探索)

引子&#xff1a;网上三年前&#xff08;2020&#xff09;的文章介绍了一个raven-js 简单说就是把堆栈信息格式化兼容各浏览器&#xff0c;便于查看错误来源。 **but&#xff1a;**到处找了一下raven-js&#xff0c;已经没有官方出处了&#xff0c;只在Sentry的源码仓库里发现…

Docker使用— Docker部署安装Nginx

Nginx简介 Nginx 是一款高性能的 web 服务器、反向代理服务器以及电子邮件&#xff08;IMAP/POP3/SMTP&#xff09;代理服务器&#xff0c;由俄罗斯开发者伊戈尔塞索耶夫&#xff08;Igor Sysoev&#xff09;编写&#xff0c;并在2004年10月4日发布了首个公开版本0.1.0。Nginx…

简单了解JVM

一.JVM简介 jvm及Java virtual machineJava虚拟机&#xff0c;它是一个虚构出来的计算机&#xff0c;一种规范。其实抛开这么专业的句子不说&#xff0c;就知道 JVM 其实就类似于一台小电脑运行在 windows 或者 linux 这些操作系统环境下即可。它直接和操作系统进行交互&#…

【VS2019】x64 Native Tools Command Prompt for Vs 2019使用conda命令进入环境

【VS2019】x64 Native Tools Command Prompt for Vs 2019使用conda命令进入环境 安装完VS2019后,打开终端x64 Native Tools Command Prompt for Vs 2019,直接运行conda会出现‘conda’ 不是内部或外部命令,也不是可运行的程序 原因分析:这是因为没有设置anaconda的环境变…

SpringBoot学习笔记四

SpringBoot学习笔记四-监听机制 1. SpringBoot监听器1.1 无需配置1.1.1 CommandLineRunner使用1.1.2 ApplicationRunner的使用1.1.3 CommandLineRunner与ApplicationRunner的区别 1.2 需要创建META-INF文件&#xff0c;并在其中创建spring.factories&#xff0c;配置相关的信息…

apline安装redisjson

安装前的说明 由于redis现在下载redisjson很繁琐&#xff0c;还可能需要科学上网&#xff0c;只能自己编译了 系统是apline&#xff0c; 为什么是这个系统&#xff1f;原因是docker安装redis是用了这个系统 下载地址,按照实际情况选择&#xff0c;如果不行就老老实实自己编译吧…

【漏洞复现】用友畅捷通CRM get_usedspace存在SQL注入漏洞

0x01 阅读须知 “如棠安全的技术文章仅供参考&#xff0c;此文所提供的信息只为网络安全人员对自己所负责的网站、服务器等&#xff08;包括但不限于&#xff09;进行检测或维护参考&#xff0c;未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作。利用此文所提供…

2024年最佳网页设计师AI工具

人工智能&#xff08;AI&#xff09;正在改变设计师相当快速的工作方式&#xff0c;为更智能地工作提供新的效率。 人工智能不再只是一个流行词&#xff1b;它改变了游戏规则。但人工智能能为网页设计师做什么呢&#xff1f;新网页设计师AI工具工具可以为从内容创建到图像细化…

Thingsboard PE智慧运维仪表板实例(一)【智慧排口截污实例】

1、仪表板总览 以该实际落地项目为案例,跟着我一起搭建智慧运维大屏!社区版和专业版都通用。本文是致力于快速搭建,所以不会详细去讲Thingsboard的知识点,只讲如何配置和使用部件。 搭建仪表板的整体效果如下: 点击左侧设备列表可以查看设备详细页面: 2、设备 我的设备都…

2024年第十七届 认证杯 网络挑战赛 (C题)| 云中的海盐 | 辐射传输方程 Stefan-Boltzmann分析 |数学建模完整代码+建模过程全解全析

当大家面临着复杂的数学建模问题时&#xff0c;你是否曾经感到茫然无措&#xff1f;作为2022年美国大学生数学建模比赛的O奖得主&#xff0c;我为大家提供了一套优秀的解题思路&#xff0c;让你轻松应对各种难题。 让我们来看看认证杯 网络挑战赛 (C题&#xff09;&#xff01…

P1090 [NOIP2004 提高组] 合并果子

原题链接&#xff1a;[NOIP2004 提高组] 合并果子 / [USACO06NOV] Fence Repair G - 洛谷 目录 1. 题目描述 2. 思路分析 3. 代码实现 1. 题目描述 2. 思路分析 优先队列。 当堆数大于1时&#xff0c;每次将最小的两个&#xff08;最小堆的堆顶&#xff09;取出&#xff…

2017NOIP普及组真题 4. 跳房子

线上OJ&#xff1a; 一本通&#xff1a;http://ybt.ssoier.cn:8088/problem_show.php?pid1417\ 核心思想 首先、本题中提到 “ 至少 要花多少金币改造机器人&#xff0c;能获得 至少 k分 ”。看到这样的话语&#xff0c;基本可以考虑要使用 二分答案。 那么&#xff0c;本题中…

2024.4.11

1.思维导图 2.指针形式验证大小端存储 #include<myhead.h>int main(int argc, const char *argv[]) {int num 0x12345678;char* ptr (char *)&num;if(*ptr 0x12){printf("big endian\n");}else if(*ptr 0x78){printf("little endian\n");}r…

Struts2的入门:新建项目——》导入jar包——》jsp,action,struts.xml,web.xml——》在项目运行

文章目录 配置环境tomcat 新建项目导入jar包新建jsp界面新建action类新建struts.xml,用来配置action文件配置Struts2的核心过滤器&#xff1a;web.xml 启动测试给一个返回界面在struts.xml中配置以实现页面的跳转&#xff1a;result再写个success.jsp最后在项目运行 配置环境 …

C++ //练习 11.22 给定一个map<string, vector<int>>,对此容器的插入一个元素的insert版本,写出其参数类型和返回类型。

C Primer&#xff08;第5版&#xff09; 练习 11.22 练习 11.22 给定一个map<string, vector<int>>&#xff0c;对此容器的插入一个元素的insert版本&#xff0c;写出其参数类型和返回类型。 环境&#xff1a;Linux Ubuntu&#xff08;云服务器&#xff09; 工具…