亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cbobsmap.cpp

?? 《游戲編程中的人工智能技術》書中源代碼和可執(zhí)行文件
?? CPP
字號:
#include "CBobsMap.h"


//this defines our little maze which Bob wanders
//around in
const int CBobsMap::map[MAP_HEIGHT][MAP_WIDTH] = 
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,
 8, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,
 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1,
 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1,
 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1,
 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1,
 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 5,
 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};


const int CBobsMap::m_iMapHeight = MAP_HEIGHT;
const int CBobsMap::m_iMapWidth  = MAP_WIDTH;

const int CBobsMap::m_iStartX = 14;
const int CBobsMap::m_iStartY = 7;

const int CBobsMap::m_iEndX = 0;
const int CBobsMap::m_iEndY = 2;


//-------------------------------Render -----------------------------

void CBobsMap::Render(const int cxClient,
					  const int cyClient,
					  HDC surface)
{
	const int border = 20;
	
	int BlockSizeX = (cxClient - 2*border)/m_iMapWidth;
	int BlockSizeY = (cyClient - 2*border)/m_iMapHeight;

	HBRUSH	BlackBrush, RedBrush, OldBrush;
	HPEN	NullPen, OldPen;

	//grab a null pen so we can see the outlines of the cells
	NullPen = (HPEN)GetStockObject(NULL_PEN);

	//grab a brush to fill our cells with
	BlackBrush = (HBRUSH)GetStockObject(BLACK_BRUSH);

	//create a brush for the exit/entrance points
	RedBrush = CreateSolidBrush(RGB(255,0,0));

	//select them into the device conext
	OldBrush = (HBRUSH)SelectObject(surface, BlackBrush);
	OldPen	 =	 (HPEN)SelectObject(surface, NullPen);
	
	for (int y=0; y<m_iMapHeight; ++y)
	{
		for (int x=0; x<m_iMapWidth; ++x)
		{
			//calculate the corners of each cell
			int left  = border + (BlockSizeX * x);
			int right = left + BlockSizeX;
			
			int top    = border + (BlockSizeY * y);
			int bottom = top + BlockSizeY;
			
			//draw black rectangle if this is a wall
			if (map[y][x] == 1)
			{
				SelectObject(surface, BlackBrush);

				//draw the cell
				Rectangle(surface, left, top, right, bottom);
			}
			
			//draw red for exit and entrance
			if ( (map[y][x] == 5) || (map[y][x] == 8))
			{
				SelectObject(surface, RedBrush);

				//draw the cell
				Rectangle(surface, left, top, right, bottom);
			}
			
			
		}
	}

	//restore the original brush
	SelectObject(surface, OldBrush);

	//and pen
	SelectObject(surface, OldPen);
}

//-------------------------------MemoryRender ------------------------
//
//	//draws whatever path may be stored in the memory
//--------------------------------------------------------------------
void CBobsMap::MemoryRender(const int cxClient,
							const int cyClient,
							HDC surface)
{
	const int border = 20;
	
	int BlockSizeX = (cxClient - 2*border)/m_iMapWidth;
	int BlockSizeY = (cyClient - 2*border)/m_iMapHeight;
	
	HBRUSH	GreyBrush, OldBrush;
	HPEN	NullPen, OldPen;
	
	//grab a brush to fill our cells with
	GreyBrush = (HBRUSH)GetStockObject(LTGRAY_BRUSH);

	//grab a pen
	NullPen = (HPEN)GetStockObject(NULL_PEN);
	
	//select them into the device conext
	OldBrush = (HBRUSH)SelectObject(surface, GreyBrush);
	OldPen	 =	(HPEN)SelectObject(surface, NullPen);
	
	for (int y=0; y<m_iMapHeight; ++y)
	{
		for (int x=0; x<m_iMapWidth; ++x)
		{
			//calculate the corners of each cell
			int left  = border + (BlockSizeX * x);
			int right = left + BlockSizeX;
			
			int top    = border + (BlockSizeY * y);
			int bottom = top + BlockSizeY;
			
			//draw green rectangle if this is a wall
			if (memory[y][x] == 1)
			{
				Rectangle(surface, left, top, right, bottom);
			}
		}
	}
	
	//restore the original brush
	SelectObject(surface, OldBrush);
	
	//and pen
	SelectObject(surface, OldPen);

}

//---------------------------- TestRoute ---------------------------
//
//	given a decoded vector of directions and a map object representing
//	Bob's memory, this function moves Bob through the maze as far as 
//	he can go updating his memory as he moves.
//-------------------------------------------------------------------
double CBobsMap::TestRoute(const vector<int> &vecPath, CBobsMap &Bobs)
{
	int posX = m_iStartX;
	int posY = m_iStartY;

	for (int dir=0; dir<vecPath.size(); ++dir)
	{
		int NextDir = vecPath[dir];

		switch(vecPath[dir])
		{
		case 0: //North

			//check within bounds and that we can move
			if ( ((posY-1) < 0 ) || (map[posY-1][posX] == 1) )
			{
				break;
			}

			else
			{
				posY -= 1;
			}

			break;

		case 1: //South

			//check within bounds and that we can move
			if ( ((posY+1) >= m_iMapHeight) || (map[posY+1][posX] == 1) )
			{
				break;
			}
			
			else
			{
				posY += 1;
			}

			break;

		case 2: //East

			//check within bounds and that we can move
			if ( ((posX+1) >= m_iMapWidth ) || (map[posY][posX+1] == 1) )
			{
				break;
			}
			
			else
			{
				posX += 1;
			}

			break;

		case 3: //West

			//check within bounds and that we can move
			if ( ((posX-1) < 0 ) || (map[posY][posX-1] == 1) )
			{
				break;
			}
			
			else
			{
				posX -= 1;
			}

			break;

		}//end switch

		//mark the route in the memory array
		Bobs.memory[posY][posX] = 1;

	}//next direction

	//now we know the finish point of Bobs journey, let's assign
	//a fitness score which is proportional to his distance from
	//the exit

	int	DiffX = abs(posX - m_iEndX);
	int DiffY = abs(posY - m_iEndY);

	//we add the one to ensure we never divide by zero. Therefore
	//a solution has been found when this return value = 1
	return 1/(double)(DiffX+DiffY+1);
}

//--------------------- ResetMemory --------------------------
//
//	resets the memory map to zeros
//------------------------------------------------------------
void CBobsMap::ResetMemory()
{
	for (int y=0; y<m_iMapHeight; ++y)
	{
		for (int x=0; x<m_iMapWidth; ++x)
		{
			memory[y][x] = 0;
		}
	}
}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美mv和日韩mv的网站| 欧美色爱综合网| 国产女同互慰高潮91漫画| 国产美女在线精品| 国产精品三级电影| 91免费观看国产| 婷婷久久综合九色国产成人| 日韩欧美二区三区| 成人亚洲精品久久久久软件| 亚洲视频一区二区免费在线观看| 在线视频一区二区免费| 日韩综合小视频| 久久久蜜桃精品| 一本大道久久精品懂色aⅴ| 亚洲成人av在线电影| 欧美成人一区二区三区| 成人在线一区二区三区| 亚洲在线中文字幕| 亚洲精品一线二线三线| 色综合久久综合网欧美综合网 | 国产网站一区二区| 91丨porny丨首页| 麻豆91精品视频| 亚洲欧洲99久久| 欧美一区二区三区日韩视频| 国产精品系列在线播放| 一区二区欧美精品| 久久久久国色av免费看影院| 欧亚一区二区三区| 国产成人综合在线播放| 午夜欧美电影在线观看| 国产精品情趣视频| 91精品欧美一区二区三区综合在| 成人v精品蜜桃久久一区| 亚洲高清三级视频| 国产精品久99| 精品成人免费观看| 欧美日韩国产不卡| 北岛玲一区二区三区四区| 免费在线观看视频一区| 亚洲精品视频自拍| 国产精品天美传媒| 精品久久久久久综合日本欧美| 91色.com| 成人免费高清在线观看| 麻豆视频观看网址久久| 亚洲一区在线看| 国产精品天天摸av网| 精品成人a区在线观看| 91 com成人网| 在线免费观看视频一区| 成人免费毛片高清视频| 国产精品亚洲综合一区在线观看| 日本视频一区二区| 午夜久久久影院| 亚洲精品美国一| 综合自拍亚洲综合图不卡区| 国产网红主播福利一区二区| 精品精品国产高清a毛片牛牛| 欧美日韩在线播| 在线观看成人小视频| 99热精品国产| av在线这里只有精品| 国产成人免费视频一区| 国产一区二区三区四 | 蜜桃视频第一区免费观看| 尤物视频一区二区| 亚洲品质自拍视频| 亚洲欧美激情小说另类| 国产精品免费久久| 中国色在线观看另类| 欧美激情综合网| 欧美激情一区二区| 国产精品污污网站在线观看| 国产欧美一区二区精品婷婷| 久久久蜜臀国产一区二区| 久久久一区二区三区| 久久亚洲精品国产精品紫薇| wwww国产精品欧美| 国产无遮挡一区二区三区毛片日本| 久久日韩粉嫩一区二区三区 | 91亚洲大成网污www| 91性感美女视频| 欧美在线观看一区二区| 欧美四级电影网| 91麻豆精品国产91久久久 | 国产伦精品一区二区三区免费| 美女mm1313爽爽久久久蜜臀| 久久爱www久久做| 国产麻豆91精品| 91视频免费观看| 欧美天天综合网| 精品成人佐山爱一区二区| 国产三级三级三级精品8ⅰ区| 国产精品嫩草影院com| 亚洲日本一区二区| 视频一区二区三区中文字幕| 精品一区二区三区免费播放| 欧美日韩国产一级片| 日韩久久免费av| 国产亲近乱来精品视频| 亚洲女爱视频在线| 日韩**一区毛片| 成人综合婷婷国产精品久久免费| 91日韩在线专区| 精品三级av在线| 亚洲日本乱码在线观看| 色悠悠久久综合| 欧美一区二区在线视频| 国产免费观看久久| 午夜精品福利一区二区蜜股av| 久久精品999| 91电影在线观看| 精品久久久久久久人人人人传媒| 中文字幕亚洲一区二区va在线| 亚洲成人免费av| 国产99久久久国产精品免费看| 日本丶国产丶欧美色综合| 精品少妇一区二区三区在线播放| 中文字幕日韩精品一区| 日本aⅴ精品一区二区三区| 99精品久久只有精品| 精品国产一区二区三区不卡 | 国产精品热久久久久夜色精品三区| 夜夜爽夜夜爽精品视频| 国产麻豆一精品一av一免费| 欧美日韩亚洲综合在线 | 国产一本一道久久香蕉| 欧美性色aⅴ视频一区日韩精品| 久久嫩草精品久久久久| 午夜视频在线观看一区| 99久久综合国产精品| 日韩欧美成人午夜| 亚洲成人资源网| av在线不卡免费看| 久久亚区不卡日本| 轻轻草成人在线| 精品视频色一区| 自拍偷拍国产亚洲| 国产99一区视频免费| 日韩视频免费观看高清完整版| 亚洲五码中文字幕| 91色porny| 亚洲日本在线看| 成人va在线观看| 中文字幕成人av| 国产麻豆欧美日韩一区| 精品国产三级电影在线观看| 亚洲6080在线| 欧美三区免费完整视频在线观看| 最新国产精品久久精品| 成人开心网精品视频| 国产情人综合久久777777| 国产精品一区二区三区99| 精品不卡在线视频| 久久99精品久久久久久动态图| 欧美一区午夜精品| 天天av天天翘天天综合网| 国产精品欧美一级免费| 极品销魂美女一区二区三区| 日韩视频国产视频| 麻豆国产欧美日韩综合精品二区| 欧美人与禽zozo性伦| 亚洲大片在线观看| 欧美精品tushy高清| 午夜视黄欧洲亚洲| 91精品国产综合久久久久久久久久| 亚洲成在人线在线播放| 欧美精品一卡二卡| 日韩av成人高清| 欧美mv和日韩mv的网站| 国产另类ts人妖一区二区| 亚洲国产电影在线观看| 成人免费视频caoporn| 亚洲欧美在线高清| 色av一区二区| 91伊人久久大香线蕉| 日韩福利电影在线| 亚洲一区二三区| 国产欧美一区二区三区在线老狼| 色综合久久综合| 国产精品白丝jk黑袜喷水| 一区二区三区加勒比av| 久久久综合激的五月天| 欧美日韩黄视频| 一本到三区不卡视频| 国产精品69毛片高清亚洲| 五月天中文字幕一区二区| 久久久久久久久一| 2023国产精品自拍| 欧美午夜精品免费| 卡一卡二国产精品| 婷婷综合久久一区二区三区| 欧美一区二区视频在线观看2022| 久久99九九99精品| 国产精品免费免费| 欧美二区乱c少妇| 国产99久久久国产精品免费看 | 欧美国产精品中文字幕| 欧洲av一区二区嗯嗯嗯啊|