Esempio n. 1
0
// -----------------------------------------------------------
void Environment::Change(const RandomNumberGenerator &rng)
{
	for (int row=0; row<MAZE_SIZE; row+=1)
	{
		for (int col=0; col<MAZE_SIZE; col+=1)
		{
			if (maze_[row][col] != OBSTACLE &&
			    static_cast<double>(rng.RandomValue())/RAND_MAX < Grow_prob_) // probability: 0.01
			{
			    if (maze2_[row][col]<4){
                    if (maze2_[row][col]==0){
                        if (maze_[row][col]<2)
                            maze_[row][col]+=1;
                        else
                            maze_[row][col]+=2;

                        if (maze_[row][col]>=20){
                            maze_[row][col]=20;
                            maze2_[row][col]=1;
                        }
                    }
                    else {
                        maze2_[row][col]++;
                    }
			    }else{
                    maze2_[row][col]++;
                    maze_[row][col]=0;
			    }

			}
		}// for - col
	}// for - row
}
// -----------------------------------------------------------
void Environment::Change(const RandomNumberGenerator &rng)
{
	for (int row=0; row<MAZE_SIZE; row+=1)
	{
		for (int col=0; col<MAZE_SIZE; col+=1)
		{
			if (maze_[row][col] != OBSTACLE && 
			    static_cast<double>(rng.RandomValue())/RAND_MAX < dirtyProb_) // probability: 0.01
			{
				maze_[row][col] += 1;
			}
		}// for - col
	}// for - row
}