人工智能课件第三次课优质PPT.ppt
- 文档编号:15553678
- 上传时间:2022-11-04
- 格式:PPT
- 页数:26
- 大小:88KB
人工智能课件第三次课优质PPT.ppt
《人工智能课件第三次课优质PPT.ppt》由会员分享,可在线阅读,更多相关《人工智能课件第三次课优质PPT.ppt(26页珍藏版)》请在冰豆网上搜索。
Object.orientation-=PatternCurrentIndex.turnLeft;
Object.x+=PatternCurrentIndex.stepForward;
Object.x-=PatternCurrentIndex.stepBackward;
CurrentIndex+;
基于方块的模式运动PatternMovementintile-basedenvironmentsoPathswillbemadeupoflinesegments.路径是由一些线段组成。
oEachlineisonlyasegmentoftheoverallpattern.每一条线段是整个运动模式的一部分。
初始化路径数组InitializepatharraysVoidInitializePathArrays(void)inti;
for(i=0;
ikMaxPathLength;
i+)pathRowi=-1;
pathColi=-1;
CalculatelinesegmentVoidai_Entity:
BuildPathSegment(void)inti;
intnextCol=col;
intnextRow=row;
intdeltaRow=endRow-row;
intdeltaCol=endCol-col;
intstepCol;
intstepRow;
intcurrentStep;
intfraction;
inti;
i+)if(pathRowi=-1)&
(pathColi=-1)currentStep=i;
break;
if(deltaRow0)stepRow=-1;
elsestepRow=1;
if(deltaCol=kMaxPathLength)return;
if(deltaColdeltaRow)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;
elsefraction=deltaCol*2-deltaRow;
while(nextRow!
=endRow)if(fraction=0)nextCol=nextCol+stepCol;
fraction=fraction-deltaRow;
nextRow=nextRow+stepRow;
fraction=fraction+deltaCol;
矩形模式RectangularpatternentityList1.InitializaPathArrays();
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;
RectangularpatternmovementNormalizePatternfunctionvoidai_Entity:
NormalizePattern(void)inti;
introwOrigin=pathRow0;
intcolOrigin=pathCol0;
(pathColi=-1)pathSize=i-1;
i=pathSize;
i+)pathRowi=pathRowi-rowOrigin;
pathColi=pathColi-colOrigin;
SimplepatrollingpatternentityList1.InitializePathArrays();
entityList1.BuildPathSegment(18,3,10,3);
entityList1.patternRowOffset=5;
entityList1.patternColOffset=2;
ComplexpatrollingpatternentityList1.BuildPathSegment(4,2,4,11);
entityList1.BuildPathSegment(4,11,2,24);
entityList1.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);
Complextilepatternmovement初始化模式矩阵Initializepatternmatrixfor(i=0;
ikMaxRows;
i+)for(j=0;
jkMaxCols;
j+)patternij=0;
PatternSetupBuildPatternSegment(3,2,16,2);
BuildPatternSegment(16,2,16,11);
BuildPatternSegment(16,11,9,11);
BuildPatternSegment(9,11,9,6);
BuildPatternSegment(9,6,3,6);
BuildPatternSegment(3,6,3,2);
Followpatternmatrixvoidai_Entity:
FollowPattern(void)inti,j;
intpossibleRowPath8=0,0,0,0,0,0,0,0;
intpossibleColPath8=0,0,0,0,0,0,0,0;
introwOffset8=-1,-1,-1,0,0,1,1,1;
intcolOffset8=-1,0,1,-1,1,-1,0,1;
关于rowOffset,colOffset说明-1,-1-1,0-1,10,-1当前点(row,col)0,11,-11,01,1j=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已完成上次实验,可以设计运动模式。
如矩形、圆或其他模式。
编写实验报告。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 人工智能 课件 第三次
![提示](https://static.bdocx.com/images/bang_tan.gif)