#include<iostream>

#include<stdio.h>

#include<stdlib.h>

#include<string>

#include<conio.h>


using namespace std;

int map_size;

int board_size;


#define STONE_ON_CROSS 1


enum COLORG : int

{

    c_none,

    c_wall,

    c_black = 2 + STONE_ON_CROSS,

    c_white = 4 + STONE_ON_CROSS,

};


int map[40][40];


void build_map(int size)

{

    board_size = size;

    map_size = size * 2 + 1;

    for(int y = 0; y < map_size; ++y)

        for(int x = 0; x < map_size; ++x)

            map[y + 1][x + 1] = x & 1 & y? c_none: c_wall;

}


const char* patterns[] =

{

    "  ", "  ", "  ", "┏", "  ", "┓", "━", "┳", "  ", "┃", "┗", "┣", "┛", "┫", "┻", "╋",

};


typedef struct POINTG

{

    int x, y;

    POINTG(int a_x, int a_y) { x = a_x, y = a_y; }

    POINTG to_map_xy() { return POINTG(x * 2 + 2 - STONE_ON_CROSS, y * 2 + 2 - STONE_ON_CROSS); }

    POINTG to_board_xy() { return POINTG((x - 2 + STONE_ON_CROSS) / 2, (y - 2 + STONE_ON_CROSS) / 2); }

}POINTG;


void draw_map()

{

    system("cls");

    int y_set = 1;

    int y_end = map_size + y_set;

    int x_set = 1;

    int x_end = map_size + x_set;

    for(int y = y_set; y < y_end; ++y)

    {

        for(int x = x_set; x < x_end; ++x)

        {

            if(map[y][x] == c_black) cout << "○";

            else if(map[y][x] == c_white) cout << "●";

            else if(map[y][x] == c_wall) cout << patterns[((map[y - 1][x] & 1) << 3) | ((map[y][x - 1] & 1) << 2) |

                                                          ((map[y][x + 1] & 1) << 1) | (map[y + 1][x] & 1)];

            else cout << "  ";

        }

        cout << endl;

    }

}


void put_stone(int board_x, int board_y, COLORG color)

{

    POINTG p = POINTG(board_x, board_y).to_map_xy();

    map[p.y][p.x] = color;

}


int main()

{

    int select = 0;

    while(select != 3)

    {

        cout << "-Map size-" << endl;

        cout << "1. Easy(8*8)" << endl;

        cout << "2. Nomal(13*13)" << endl;

        cout << "3. Hard(19*19)" << endl;

        cout << "4. Exit" << endl;

        cout << ":  " << endl;

        select = _getch() - '1';

        

        if(select >= 0 && select <= 2)

        {

            const int board_size[] = {8, 13, 19};

            build_map(board_size[select]);

            put_stone(3, 3, c_black);

            put_stone(4, 4, c_black);

            put_stone(4, 3, c_white);

            put_stone(3, 4, c_white);

            draw_map();

        }

    }

    return 0;

}