Fight

CF1901 D Yet Another Monster Fight 题解

Link CF1901 D Yet Another Monster Fight Question 现在给你一堆怪物,你拥有法术(一个法术可以连续攻击这n个所有怪物),你可以选择任意一个怪物作为法术的第一个攻击目标(伤害为 \(x\) ),然后除了第一个攻击目标可以任意,其他攻击目标只能为曾经攻击目标 ......
题解 Another Monster Fight 1901

D. Yet Another Monster Fight

原题链接 1.导论 这道题能不能用贪心做?答案是不能,具体为什么已经有题解给出回答。当贪心无法求解时,我们考虑一下动态规划。 2.算法设计 对于任一节点,其最坏情况(即所需最大起始威力值,后文称最大值)是什么? 当第一个被攻击的怪物(以下称头怪物)在其右边时,其最大值为右边怪物的数量加上自身初始值, ......
Another Monster Fight Yet

Fight Hard for Ecological Protection and Governance of the Yellow River to Address the Water Contamination

1.Effective measure aimed at addressing the water contamination: We will fight hard for ecological protection and governance of the Yellow River. We w ......

Helping China Fight Air Pollution

Over the last 40 years, China has experienced the fastest economic growth anywhere but also paid a heavy environmental price. China has many of the wo ......
Pollution Helping China Fight Air

Fight Aliens 显示飞船生命/分数/游戏结束

游戏的基本功能搞定,现在来实现一下我们比较关注的游戏中的生命值、武力值等等信息吧 1. 飞船生命值显示: # 显示飞船的生命 def show_ship_life(screen, gc): """ 显示飞船的生命 :param screen: 屏幕对象 :param gc: GameConfig 配 ......
飞船 分数 生命 Aliens Fight

Fight Aliens 碰撞检测 -- 实现子弹击中外星人

为了方便维护且,主文件中的代码会越来越多,做如下调整: 主文件main.py文件代码抽取出来封装成功能函数来实现, 1.目录结构如下: 2.子弹和外星人碰撞检测: # 检查子弹和外星人是否发生碰撞, 即是否击中 def check_bullets_aliens_is_collided(gc, bul ......
外星 外星人 子弹 Aliens Fight

Fight Aliens 飞船发射子弹初级版

有了飞船,我们要发射子弹,不然如何保护我们的领地呢?我们在AlienGame目录下新建bullet.py文件,即子弹的模块 代码如下: # -*- coding: utf-8 -*- # 作者: guos # 日期: 2023/3/29 import pygame class Bullet: """ ......
飞船 子弹 Aliens Fight

Fight Aliens 飞船出现在游戏窗口底部中间位置和移动

一、飞船显示,最终效果如下: 在根目录AlienGame 下新建ship模块来管理飞船 代码如下: # -*- coding: utf-8 -*- # 作者: guos # 日期: 2023/3/29 import pygame # 保存 飞船类的模块 class Ship: """ 表示飞船【玩家 ......
飞船 底部 位置 Aliens Fight

Fight Aliens 配置模块创建和抽取

游戏中会有很多配置信息,我们为了后期维护更加方便,我们把一些初始化的配置信息抽取出来,然后创建配置模块,即新建 game_config.py文件 代码如下: # -*- coding: utf-8 -*- # 作者: guos # 日期: 2023/3/29 # 该模块[即一个py文件就是一个模块, ......
模块 Aliens Fight

Python pygame-Fight Aliens

环境:python3.9 pygame 2.1.2 --> 安装 pip install pygame 之前有小球移动的初步学习了pygame的使用,接下来我们开始做外星人入侵游戏,主要使用面向对象编程来做 第一步先把基础的窗口搭建出来代码如下: 新建AlienGame目录,在目录下新建 main. ......
pygame-Fight Python Aliens pygame Fight
共10篇  :1/1页 首页上一页1下一页尾页