-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
44 lines (41 loc) · 1.2 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <ctime>
#include "Labyrinthe.h"
using namespace Laby;
void display(Labyrinthe& lab)
{
for(unsigned int y=0; y < lab.getSizeY() ; y++)
{
for(unsigned int x=0 ; x < lab.getSizeX() ; x++)
{
if ( x==0 )std::cout << " ";
if( lab.getCellAt(x,y)->isWall(N) ) std::cout << "_ ";
else std::cout << " ";
}
std::cout << std::endl;
bool eastBefore = false;
for(unsigned int x=0 ; x < lab.getSizeX() ; x++)
{
if( lab.getCellAt(x,y)->isWall(W) && !eastBefore )std::cout << "|";
else if( lab.getCellAt(x,y)->isWall(W) && eastBefore ) std::cout << "";
else std::cout << "";
eastBefore = false;
std::cout << " ";
if( lab.getCellAt(x,y)->isWall(E) ){std::cout << "|";eastBefore=true;}
else std::cout << " ";
}
std::cout << std::endl;
}
for( unsigned int x=0; x < lab.getSizeX() ; x++)
{
if ( x==0 )std::cout << " ";
if( lab.getCellAt(x,lab.getSizeY()-1)->isWall(S) ) std::cout << "_ ";
}
std::cout << std::endl;
}
int main(int argc, char const *argv[]) {
Labyrinthe lab(10,10);
lab.generate();
display(lab);
return 0;
}