Ejemplo n.º 1
0
		void initialize(Maze & maze)
		{
			for ( int y = 0 ; y < (int)maze.GetSizeY() ; y ++ )
			{
				for ( int x = 0 ; x < (int)maze.GetSizeX() ; x ++ )
				{
					if ( x == 0 || x == maze.GetSizeX() - 1 ||
						y == 0 || y == maze.GetSizeY() - 1 )
						maze.SetWall(x, y);

					if ( (x%2) == 0 && (y%2) == 0 )
						maze.SetWall(x, y);
				}
			}
		}
Ejemplo n.º 2
0
		void SetWall(Maze & maze, int x, int y, int direction)
		{
			int rx, ry;
			switch ( direction )
			{
				case 0:
					rx = -1;
					ry = 0;
					break;

				case 1:
					rx = 1;
					ry = 0;
					break;

				case 2:
					rx = 0;
					ry = -1;
					break;

				case 3:
					rx = 0;
					ry = 1;
					break;
			}

			maze.SetWall(x + rx, y + ry);
		}