Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <utility>
- #include <cstdlib>
- #define BIN__N(x) (x) | x>>3 | x>>6 | x>>9
- #define BIN__B(x) (x) & 0xf | (x)>>12 & 0xf0
- #define BIN8(v) (BIN__B(BIN__N(0x##v)))
- class labirint;
- class room{
- private:
- friend labirint;
- int m_x;
- int m_y;
- int m_n;
- int m_magicnumber;
- int __mnum;
- int __startfinish; //0 - nothing, 1 - start, 2 - finish
- bool _vis;
- bool m_way;
- room *__backroom;
- public:
- room(unsigned x, unsigned y);
- bool left(); //3
- bool right(); //1
- bool up(); //0
- bool down(); //2
- bool start();
- bool finish();
- bool way();
- std::pair<int, int> getcoords();
- };
- class labirint{
- private:
- friend room;
- int m_wayweight;
- room* m_rooms;
- room* m_start;
- room* m_finish;
- room* __getroom(int x, int y, unsigned k);
- room* __getroom(unsigned x, unsigned y);
- std::pair<int, int> m_size;
- void __restoreway(room *r);
- public:
- labirint(int width, int heigth);
- ~labirint();
- void generate(unsigned x, unsigned y);
- room getroom(unsigned x, unsigned y);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement