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

长春有什么好的网站制作公司建筑企业登录建设厅网站密码

长春有什么好的网站制作公司,建筑企业登录建设厅网站密码,个人网页设计模板html代码,10种网络营销方式2012年认证杯SPSSPRO杯数学建模 D题 人机游戏中的数学模型 原题再现#xff1a; 计算机游戏在社会和生活中享有特殊地位。游戏设计者主要考虑易学性、趣味性和界面友好性。趣味性是本质吸引力#xff0c;使玩游戏者百玩不厌。网络游戏一般考虑如何搭建安全可靠、丰富多彩的…2012年认证杯SPSSPRO杯数学建模 D题 人机游戏中的数学模型 原题再现 计算机游戏在社会和生活中享有特殊地位。游戏设计者主要考虑易学性、趣味性和界面友好性。趣味性是本质吸引力使玩游戏者百玩不厌。网络游戏一般考虑如何搭建安全可靠、丰富多彩的交互平台。人机游戏主要是考虑如何设计模型和算法使其难度、趣味性达到恰当的平衡玩家感觉既有难度又有解决的信心。设计者既要像导演规划玩家的行为又要加入一定随机因素使玩家觉得不是简单重复。所以在游戏创意和模型确定下来后参数选择和优化变得非常关键。   现在考虑“植物大战僵尸”游戏中的一些简单模型参赛者不必更深入地了解该游戏。现在只有三种角色向日葵、豌豆荚和一种僵尸。向日葵产生阳光用鼠标点击阳光才能将其收集存储过一定时间不点击阳光就会消失。种植向日葵和豌豆荚需要花费阳光豌豆荚当其所在格或右侧有僵尸存在时一粒一粒地发射豌豆每个豌豆荚内的豌豆数量无限豌豆向右飞行打击飞行路线上的僵尸豌豆不受向日葵和豌豆荚的阻挡但不能射穿僵尸僵尸只从屏幕最右边产生沿着直线从右向左行进它要吃掉沿途遇到的向日葵和豌豆荚但会被豌豆打死立即消失。僵尸走到屏幕最左边则计算机获胜游戏结束。屏幕上的游戏场地是横平竖直、大小相等的网格一个格内只能种植一株豌豆荚或向日葵但可以有任意多个僵尸。   第一阶段问题   假设僵尸 3 步走一个格豌豆荚发射豌豆的频率与僵尸的步频相等豌豆飞行 6 格的时间僵尸走一步僵尸被 9 粒豌豆打中立即消亡。僵尸走到豌豆荚或向日葵所在的格开始吞噬用走 3 步的时间将其吃掉。向日葵产生 1 朵阳光所用时间僵尸恰好走 4 个格僵尸走 1 格的时间不点击阳光阳光就会消失。2 朵阳光可以种植 1 株向日葵4 朵阳光可以种植 1 棵豌豆荚。场地只有从左至右的 9 个格。   1. 将以上假设用更简洁明了的方式进行复述   2. 场地只在最左边的 1 个格内有豌豆荚没有向日葵和阳光。问最小多大间隔产生 1 个僵尸计算机永远不会赢   3. 场地在最左边的若干格内种有豌豆荚没有向日葵和阳光等间隔每次产生 1 个僵尸。问最少种几棵豌豆荚使产生僵尸的间隔最小而计算机永远不会赢。   4. 假设游戏开始时有 6 朵阳光每次产生 1 个僵尸。请设置最佳的种植方案和僵尸产生方案使计算机永远不会赢并且游戏紧张有趣。 整体求解过程概述(摘要) 本文从颇有新意的角度出发重点研究“植物大战僵尸”的游戏问题。以游戏中的向日葵、豌豆荚和僵尸为讨论对象利用数学建模的方法对不同的游戏要求给出合理有效的设计方案。然后应用我们所建立的模型求得问题 3 最优解为最少种 5 棵豌 豆荚使僵尸产生的最小间隔为2m/v 而计算机永远不会赢。文章的最后部分对问题 4 的三种方案进行了详细分析选择出了最佳方案为种植 1 株向日葵和 1 棵豌豆荚。 问题分析 对于问题 1要求用更简洁明了的方式对题中的假设进行复述。   对于问题 2题目告诉我们场地只在最左边的 1 个格内有豌豆荚没有向日葵和阳光。要求我们求出产生 1 个僵尸的最小间隔使得计算机永远不会赢也就是要让僵尸永远不能吃掉豌豆荚。经过分析我们觉得必须先计算出第一只僵尸从产生到被射死时 走过的步数以及死时所在的位置。然后就上一只僵尸还在场地上的情形对下一只僵尸何时产生的情况进行分析找出最小的产生间隔。   对于问题 3题目以场地在最左边的若干格内种有豌豆荚没有向日葵和阳光等间隔产生 1 个僵尸为已知条件 让我们求出最少种几棵豌豆荚 使产生僵尸的间隔最小而计算机永远不会赢。本题也涉及到产生僵尸的最小间隔问题所以我们可以在问题 2所探索出的僵尸产生的最小间隔的情况这个基础上对本题进行分析求解。分别计算出种2—8 棵豌豆荚每一只僵尸从产生到被射死所走过的步数以此来计算出在种植不同棵数的情况下僵尸产生的最小间隔通过对比找出其中最小的间隔。   对于问题 4已经假设游戏开始时有 6 朵阳光每次产生 1 个僵尸要让我们设置最佳的种植方案和僵尸产生方案使计算机永远不会赢并且游戏紧张有趣。根据所给的 6 朵阳光我们可以设置出三种不同的种植方案然后对三种不同方案分别进行分析计算得出最佳的方案。 模型假设 1僵尸出现的次数为无穷   2豌豆发射子弹跟僵尸进入场地是同时发生的 论文缩略图 全部论文请见下方“ 只会建模 QQ名片” 点击QQ名片即可 部分程序代码(代码和文档not free) #1 引入需要的模块 import pygame import random #1 配置图片地址 IMAGE_PATH imgs/ #1 设置页面宽高 scrrr_width800 scrrr_height 560 #1 创建控制游戏结束的状态 GAMEOVER False #4 图片加载报错处理 LOG 文件:{}中的方法:{}出错.format(__file__,__name__) #3 创建地图类 class Map():#3 存储两张不同颜色的图片名称map_names_list [IMAGE_PATH map1.png, IMAGE_PATH map2.png]#3 初始化地图def __init__(self, x, y, img_index):self.image pygame.image.load(Map.map_names_list[img_index])self.position (x, y)# 是否能够种植self.can_grow True#3 加载地图def load_map(self):MainGame.window.blit(self.image,self.position) #4 植物类 class Plant(pygame.sprite.Sprite):def __init__(self):super(Plant, self).__init__()self.liveTrue# 加载图片def load_image(self):if hasattr(self, image) and hasattr(self, rect):MainGame.window.blit(self.image, self.rect)else:print(LOG) #5 向日葵类 class Sunflower(Plant):def __init__(self,x,y):super(Sunflower, self).__init__()self.image pygame.image.load(imgs/sunflower.png)self.rect self.image.get_rect()self.rect.x xself.rect.y yself.price 50self.hp 100#5 时间计数器self.time_count 0#5 新增功能生成阳光def produce_money(self):self.time_count 1if self.time_count 25:MainGame.money 5self.time_count 0#5 向日葵加入到窗口中def display_sunflower(self):MainGame.window.blit(self.image,self.rect) #6 豌豆射手类 class PeaShooter(Plant):def __init__(self,x,y):super(PeaShooter, self).__init__()# self.image 为一个 surfaceself.image pygame.image.load(imgs/peashooter.png)self.rect self.image.get_rect()self.rect.x xself.rect.y yself.price 50self.hp 200#6 发射计数器self.shot_count 0#6 增加射击方法def shot(self):#6 记录是否应该射击should_fire Falsefor zombie in MainGame.zombie_list:if zombie.rect.y self.rect.y and zombie.rect.x 800 and zombie.rect.x self.rect.x:should_fire True#6 如果活着if self.live and should_fire:self.shot_count 1#6 计数器到25发射一次if self.shot_count 25:#6 基于当前豌豆射手的位置创建子弹peabullet PeaBullet(self)#6 将子弹存储到子弹列表中MainGame.peabullet_list.append(peabullet)self.shot_count 0#6 将豌豆射手加入到窗口中的方法def display_peashooter(self):MainGame.window.blit(self.image,self.rect)#7 豌豆子弹类 class PeaBullet(pygame.sprite.Sprite):def __init__(self,peashooter):self.live Trueself.image pygame.image.load(imgs/peabullet.png)self.damage 50self.speed 10self.rect self.image.get_rect()self.rect.x peashooter.rect.x 60self.rect.y peashooter.rect.y 15def move_bullet(self):#7 在屏幕范围内实现往右移动if self.rect.x scrrr_width:self.rect.x self.speedelse:self.live False#7 新增子弹与僵尸的碰撞def hit_zombie(self):for zombie in MainGame.zombie_list:if pygame.sprite.collide_rect(self,zombie):#打中僵尸之后修改子弹的状态self.live False#僵尸掉血zombie.hp - self.damageif zombie.hp 0:zombie.live Falseself.nextLevel()#7闯关方法def nextLevel(self):MainGame.score 20MainGame.remnant_score -20for i in range(1,100):if MainGame.score100*i and MainGame.remnant_score0:MainGame.remnant_score100*iMainGame.shaoguan1MainGame.produce_zombie50def display_peabullet(self):MainGame.window.blit(self.image,self.rect) #9 僵尸类 class Zombie(pygame.sprite.Sprite):def __init__(self,x,y):super(Zombie, self).__init__()self.image pygame.image.load(imgs/zombie.png)self.rect self.image.get_rect()self.rect.x xself.rect.y yself.hp 1000self.damage 2self.speed 1self.live Trueself.stop False#9 僵尸的移动def move_zombie(self):if self.live and not self.stop:self.rect.x - self.speedif self.rect.x -80:#8 调用游戏结束方法MainGame().gameOver()#9 判断僵尸是否碰撞到植物如果碰撞调用攻击植物的方法def hit_plant(self):for plant in MainGame.plants_list:if pygame.sprite.collide_rect(self,plant):#8 僵尸移动状态的修改self.stop Trueself.eat_plant(plant)#9 僵尸攻击植物def eat_plant(self,plant):#9 植物生命值减少plant.hp - self.damage#9 植物死亡后的状态修改以及地图状态的修改if plant.hp 0:a plant.rect.y // 80 - 1b plant.rect.x // 80map MainGame.map_list[a][b]map.can_grow Trueplant.live False#8 修改僵尸的移动状态self.stop False#9 将僵尸加载到地图中def display_zombie(self):MainGame.window.blit(self.image,self.rect) #1 主程序 class MainGame():#2 创建关数得分剩余分数钱数shaoguan 1score 0remnant_score 100money 200#3 存储所有地图坐标点map_points_list []#3 存储所有的地图块map_list []#4 存储所有植物的列表plants_list []#7 存储所有豌豆子弹的列表peabullet_list []#9 新增存储所有僵尸的列表zombie_list []count_zombie 0produce_zombie 100#1 加载游戏窗口def init_window(self):#1 调用显示模块的初始化pygame.display.init()#1 创建窗口MainGame.window pygame.display.set_mode([scrrr_width,scrrr_height])#2 文本绘制def draw_text(self, content, size, color):pygame.font.init()font pygame.font.SysFont(kaiti, size)text font.render(content, True, color)return text#2 加载帮助提示def load_help_text(self):text1 self.draw_text(1.按左键创建向日葵 2.按右键创建豌豆射手, 26, (255, 0, 0))MainGame.window.blit(text1, (5, 5))#3 初始化坐标点def init_plant_points(self):for y in range(1, 7):points []for x in range(10):point (x, y)points.append(point)MainGame.map_points_list.append(points)print(MainGame.map_points_list, MainGame.map_points_list)#3 初始化地图def init_map(self):for points in MainGame.map_points_list:temp_map_list list()for point in points:# map Noneif (point[0] point[1]) % 2 0:map Map(point[0] * 80, point[1] * 80, 0)else:map Map(point[0] * 80, point[1] * 80, 1)# 将地图块加入到窗口中temp_map_list.append(map)print(temp_map_list, temp_map_list)MainGame.map_list.append(temp_map_list)print(MainGame.map_list, MainGame.map_list)#3 将地图加载到窗口中def load_map(self):for temp_map_list in MainGame.map_list:for map in temp_map_list:map.load_map()#6 增加豌豆射手发射处理def load_plants(self):for plant in MainGame.plants_list:#6 优化加载植物的处理逻辑if plant.live:if isinstance(plant, Sunflower):plant.display_sunflower()plant.produce_money()elif isinstance(plant, PeaShooter):plant.display_peashooter()plant.shot()else:MainGame.plants_list.remove(plant)#7 加载所有子弹的方法def load_peabullets(self):for b in MainGame.peabullet_list:if b.live:b.display_peabullet()b.move_bullet()# v1.9 调用子弹是否打中僵尸的方法b.hit_zombie()else:MainGame.peabullet_list.remove(b)#8事件处理def deal_events(self):#8 获取所有事件eventList pygame.event.get()#8 遍历事件列表判断for e in eventList:if e.type pygame.QUIT:self.gameOver()elif e.type pygame.MOUSEBUTTONDOWN:# print(按下鼠标按键)print(e.pos)# print(e.button)#左键1 按下滚轮2 上转滚轮为4 下转滚轮为5 右键 3x e.pos[0] // 80y e.pos[1] // 80print(x, y)map MainGame.map_list[y - 1][x]print(map.position)#8 增加创建时候的地图装填判断以及金钱判断if e.button 1:if map.can_grow and MainGame.money 50:sunflower Sunflower(map.position[0], map.position[1])MainGame.plants_list.append(sunflower)print(当前植物列表长度:{}.format(len(MainGame.plants_list)))map.can_grow FalseMainGame.money - 50elif e.button 3:if map.can_grow and MainGame.money 50:peashooter PeaShooter(map.position[0], map.position[1])MainGame.plants_list.append(peashooter)print(当前植物列表长度:{}.format(len(MainGame.plants_list)))map.can_grow FalseMainGame.money - 50#9 新增初始化僵尸的方法def init_zombies(self):for i in range(1, 7):dis random.randint(1, 5) * 200zombie Zombie(800 dis, i * 80)MainGame.zombie_list.append(zombie)#9将所有僵尸加载到地图中def load_zombies(self):for zombie in MainGame.zombie_list:if zombie.live:zombie.display_zombie()zombie.move_zombie()# v2.0 调用是否碰撞到植物的方法zombie.hit_plant()else:MainGame.zombie_list.remove(zombie)#1 开始游戏def start_game(self):#1 初始化窗口self.init_window()#3 初始化坐标和地图self.init_plant_points()self.init_map()#9 调用初始化僵尸的方法self.init_zombies()#1 只要游戏没结束就一直循环while not GAMEOVER:#1 渲染白色背景MainGame.window.fill((255, 255, 255))#2 渲染的文字和坐标位置MainGame.window.blit(self.draw_text(当前钱数$: {}.format(MainGame.money), 26, (255, 0, 0)), (500, 40))MainGame.window.blit(self.draw_text(当前关数{}得分{},距离下关还差{}分.format(MainGame.shaoguan, MainGame.score, MainGame.remnant_score), 26,(255, 0, 0)), (5, 40))self.load_help_text()#3 需要反复加载地图self.load_map()#6 调用加载植物的方法self.load_plants()#7 调用加载所有子弹的方法self.load_peabullets()#8 调用事件处理的方法self.deal_events()#9 调用展示僵尸的方法self.load_zombies()#9 计数器增长每数到100调用初始化僵尸的方法MainGame.count_zombie 1if MainGame.count_zombie MainGame.produce_zombie:self.init_zombies()MainGame.count_zombie 0#9 pygame自己的休眠pygame.time.wait(10)#1 实时更新pygame.display.update()#10 程序结束方法def gameOver(self):MainGame.window.blit(self.draw_text(游戏结束, 50, (255, 0, 0)), (300, 200))print(游戏结束)pygame.time.wait(400)global GAMEOVERGAMEOVER True #1 启动主程序 if __name__ __main__:game MainGame()game.start_game()全部论文及程序请见下方“ 只会建模 QQ名片” 点击QQ名片即可
http://www.zqtcl.cn/news/276101/

相关文章:

  • 江西网站建设优化服务营销软文范例大全100字
  • 图片类网站怎样做高并发专业做旗袍花的网站是什么网站
  • 我要建网站需要什么专业网站制作全包
  • 网站开发合同印花税自定义手机网站建设
  • 营销型网站开发流程制作网站需要钱吗
  • 提供有经验的网站建设百度识图识别
  • html手机网站怎么做湖南关键词优化品牌推荐
  • 网站定制开发收费标准是多少易语言如何做浏网站
  • 网站怎么做实名认证新手怎么开婚庆公司
  • .net做网站用什么技术网站优化排名方案
  • 电商网站备案流程网站移动端优化的重点有哪些
  • 数据需求 网站建设做qq空间的网站
  • 微信网站游戏网络规划设计师可以挂证吗
  • 有个做特价的购物网站网站建设与维护题库及答案
  • 长沙网站优化价格创意设计师个人网站
  • 滨河网站建设南京免费发布信息网站
  • 蓝色系列的网站邓砚谷电子商务网站建设
  • 德阳市住房和城乡建设局网站首页一个服务器可以建多少个网站
  • 建一个电商网站多少钱一起做网店货源app
  • 做网站用lunx代理记账 营销型网站
  • 凡客做网站怎么样WordPress分类目录 前100篇
  • 腾讯wordpress 建站教程本地的上海网站建设公司
  • 深圳市南山区住房和建设局官方网站上海专业网站建设公司站霸网络
  • 建网站的8个详细步骤网站集约化建设讲话
  • 建设局哪个网站查证南京注册公司多少钱
  • 免费的网站制作郑州中森网站建设
  • 网站关键词搜不到了濮阳网络教育
  • 推荐股票的好网站如何做好网站宣传
  • 免费网站模板网大型网络游戏
  • 网站开发语言数据库有几种广东省建设厅官网查询