游戏编程中的人工智能技术-神经网络入门(三)

    前两节提到了神经网络部分和遗传算法部分,那么代码就到此结束了吗?当然没有,无论什么算法,总要针对一个特定的对象进行使用不是?因此,本节介绍另一个部分,CMinesweeper,即扫雷机代码。
class CMinesweeper
{

private:

  //the minesweeper's neural net
  CNeuralNet		m_ItsBrain;//扫雷机的大脑,在这里就是一个神经网络

	//its position in the world
	SVector2D		m_vPosition;//扫雷机的位置,用一个二维坐标表示

	//direction sweeper is facing
	SVector2D		m_vLookAt;//扫雷机的朝向,用一个二维向量表示,注意这个向量是物理中的向量

	//its rotation (surprise surprise)
	double			m_dRotation;//扫雷机的旋转速度??

	double			m_dSpeed;//扫雷机的速度

	//to store output from the ANN
	double			m_lTrack, m_rTrack;//扫雷机左、右轮速度,这里即是神经网络的输出

	//the sweeper's fitness score 
	double			m_dFitness;//扫雷机的适应度函数,算法好坏的关键在于适应度函数的设计!

	//the scale of the sweeper when drawn
	double			m_dScale;// 变比

  //index position of closest mine
  int         m_iClosestMine;//距离扫雷机最近的地雷
  

public:


	CMinesweeper();//构造函数
	
	//updates the 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值