ImageVerifierCode 换一换
格式:PPT , 页数:26 ,大小:88KB ,
资源ID:2639349      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/2639349.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(人工智能课件第三次课.ppt)为本站会员(b****2)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

人工智能课件第三次课.ppt

1、运动模式Pattern MovementoThe computer-controlled characters move according to some predefined pattern that makes it appear as though they are performing complex,thought-out maneuvers.计算机控制的人物按照某种预定的运动模式移动,好像他们执行复杂的、预先想好的策略执行。circle、square、zigzag、curve标准算法Standard AlgorithmoThe standard pattern movement

2、algorithm uses lists or arrays of encoded instructions,or control instructions,that tell the computer-controlled character how to move each step through the game loop.标准运动模式算法用预先编好的指令或控制指令存于列表或数组,能够指导计算机控制的人物如何在游戏循环中移动每一步。控制指令数据结构 control instructions data structureControlData double turnRight;/右转 d

3、ouble turnLeft;/左转 double stepForward;/前进 double stepBackward;/后退变量说明turnRight,turnLeft /the number of degrees 角度stepForward,stepBackward /the number of distance units or tiled 长度模式初始化Pattern initializationPattern0.turnRight=0;Pattern0.turnLeft=0;Pattern0.stepForward=2;Pattern0.stepBackward=0;处理模式数组

4、Processing the pattern arrayVoid GameLoop(void)Object.orientation+=PatternCurrentIndex.turnRight;Object.orientation-=PatternCurrentIndex.turnLeft;Object.x+=PatternCurrentIndex.stepForward;Object.x-=PatternCurrentIndex.stepBackward;CurrentIndex+;基于方块的模式运动Pattern Movement in tile-based environmentsoPa

5、ths will be made up of line segments.路径是由一些线段组成。oEach line is only a segment of the overall pattern.每一条线段是整个运动模式的一部分。初始化路径数组Initialize path arraysVoid InitializePathArrays(void)int i;for(i=0;ikMaxPathLength;i+)pathRowi=-1;pathColi=-1;Calculate line segmentVoid ai_Entity:BuildPathSegment(void)int i;i

6、nt nextCol=col;int nextRow=row;int deltaRow=endRow-row;int deltaCol=endCol-col;int stepCol;int stepRow;int currentStep;int fraction;int i;for(i=0;ikMaxPathLength;i+)if(pathRowi=-1)&(pathColi=-1)currentStep=i;break;if(deltaRow0)stepRow=-1;else stepRow=1;if(deltaCol=kMaxPathLength)return;if(deltaColde

7、ltaRow)fraction=deltaRow*2-deltaCol;while(nextCol!=endCol)if(fraction=0)nextRow+=stepRow;fraction=fraction-deltaCol;nextCol=nextCol+stepCol;fraction=fraction+deltaRow;pathRowcurrentStep=nextRow;pathColcurrentStep=nextCol;currentStep+;if(currentStep=kMaxPathLength)return;else fraction=deltaCol*2-delt

8、aRow;while(nextRow!=endRow)if(fraction=0)nextCol=nextCol+stepCol;fraction=fraction-deltaRow;nextRow=nextRow+stepRow;fraction=fraction+deltaCol;pathRowcurrentStep=nextRow;pathColcurrentStep=nextCol;currentStep+;if(currentStep=kMaxPathLength)return;矩形模式Rectangular patternentityList1.InitializaPathArra

9、ys();entityList1.BuildPathSegment(10,3,18,3);entityList1.BuildPathSegment(18,3,18,12);entityList1.BuildPathSegment(18,12,10,12);entityList1.BuildPathSegment(10,12,10,3);entityList1.NormalizePattern();entityList1.patternRowOffet=5;entityList1.patternColOffet=2;Rectangular pattern movementNormalizePat

10、tern functionvoid ai_Entity:NormalizePattern(void)int i;int rowOrigin=pathRow0;int colOrigin=pathCol0;for(i=0;ikMaxPathLength;i+)if(pathRowi=-1)&(pathColi=-1)pathSize=i-1;break;for(i=0;i=pathSize;i+)pathRowi=pathRowi-rowOrigin;pathColi=pathColi-colOrigin;Simple patrolling patternentityList1.Initiali

11、zePathArrays();entityList1.BuildPathSegment(10,3,18,3);entityList1.BuildPathSegment(18,3,10,3);entityList1.NormalizePattern();entityList1.patternRowOffset=5;entityList1.patternColOffset=2;Complex patrolling patternentityList1.BuildPathSegment(4,2,4,11);entityList1.BuildPathSegment(4,11,2,24);entityL

12、ist1.BuildPathSegment(2,24,13,27);entityList1.BuildPathSegment(13,27,16,24);entityList1.BuildPathSegment(16,24,13,17);entityList1.BuildPathSegment(13,17,13,13);entityList1.BuildPathSegment(13,13,17,5);entityList1.BuildPathSegment(17,5,4,2);entityList1.NormalizePattern();entityList1.patternRowOffset=

13、5;entityList1.patternColOffset=2;Complex tile pattern movement初始化模式矩阵Initialize pattern matrixfor(i=0;ikMaxRows;i+)for(j=0;jkMaxCols;j+)patternij=0;Pattern SetupBuildPatternSegment(3,2,16,2);BuildPatternSegment(16,2,16,11);BuildPatternSegment(16,11,9,11);BuildPatternSegment(9,11,9,6);BuildPatternSeg

14、ment(9,6,3,6);BuildPatternSegment(3,6,3,2);Follow pattern matrixvoid ai_Entity:FollowPattern(void)int i,j;int possibleRowPath8=0,0,0,0,0,0,0,0;int possibleColPath8=0,0,0,0,0,0,0,0;int rowOffset8=-1,-1,-1,0,0,1,1,1;int colOffset8=-1,0,1,-1,1,-1,0,1;关于rowOffset,colOffset说明-1,-1-1,0-1,10,-1当前点(row,col)

15、0,11,-11,01,1 j=0;for(i=0;i8;i+)if(patternrow+rowOffseticol+colOffseti=1)if(!(row+rowOffseti)=previousRow)&(col+colOffseti)=previousCol)possibleRowPathj=row+rowOffseti;possibleColPathj=col+colOffseti;j+;i=Rnd(0,j-1);/随机函数 previousRow=row;previousCol=col;row=possibleRowPathi;col=possibleColPathi;实验2 说明o本次实验可以完成上次的实验内容。o已完成上次实验,可以设计运动模式。如矩形、圆或其他模式。编写实验报告。

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1