Advertisement
s1ay3r44

Maze Generation Start

Aug 4th, 2011
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. #include <iostream>
  2. #include <SFML/Graphics.hpp>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. class Cell
  9. {
  10.     public:
  11.         bool RightWall, BottomWall;
  12.         int Value;
  13.  
  14.  
  15.         Cell();
  16.         //~Cell();
  17.     protected:
  18.  
  19.     private:
  20.  
  21. };
  22.  
  23. Cell::Cell()
  24. {
  25.     RightWall = 1;
  26.     BottomWall = 1;
  27.     Value = 0;
  28. }
  29.  
  30.  
  31. void step(vector<int>& New, vector<int>& Old)
  32. {
  33.  
  34.  
  35.  
  36. }
  37.  
  38.  
  39.  
  40. int main()
  41. {
  42.  
  43.     vector<Cell> MazeData;
  44.     vector<Cell> New;
  45.     vector<Cell> Old;
  46.     int SetNum = 2, MazeX, MazeY;
  47.  
  48.     cout << "MazeX, MazeY: ";
  49.     cin >> MazeX >> MazeY;
  50.     MazeData.resize(MazeX * MazeY);
  51.     New.resize(MazeX);
  52.     Old.resize(MazeX);
  53.  
  54.  
  55.     New[0].Value = 1;
  56.     for(int i = 1; i < MazeX; i++)
  57.         if(sf::Randomizer::Random(0,1))
  58.             {
  59.                 New[i].Value = New[i-1].Value;
  60.                 New[i-1].RightWall = 0;
  61.             }
  62.         else
  63.             New[i].Value = SetNum++;
  64.     for(int i = 0; i < MazeX; i++)
  65.         cout << New[i].Value;
  66.  
  67.  
  68.  
  69.     return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement