#include <stdlib.h>

#include <time.h>

#include <conio.h>

#include <Windows.h>

//---------------------------------------------------------------------------------------------------


HANDLE consoleHandle;


enum eColor : int

{

    clBlack,

    clBlue,

    clGreen,

    clCyan,

    clRed,

    clPurple,

    clYellow,

    clWhite,

    clBright,

};


void initVideo()

{

    CONSOLE_CURSOR_INFO info;

    info.bVisible = false;

    info.dwSize = 1;

    consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);

    SetConsoleCursorInfo(consoleHandle, &info);

}


void gotoxy(int x, int y)

{

    COORD p;

    p.X = x;

    p.Y = y;

    SetConsoleCursorPosition(consoleHandle, p);

}


void putTile(int x, int y, int color)

{

    gotoxy(x * 2, y);

    SetConsoleTextAttribute(consoleHandle, (color != 0) * ((clBright | color) << 4));

    putchar(' ');

    putchar(' ');

}


void putString(int x, int y, int color, const char* s)

{

    gotoxy(x, y);

    SetConsoleTextAttribute(consoleHandle, clBright | color);

    puts(s);

}


void putStringValue(int x, int y, int colorS, int colorV, const char* s, int value)

{

    gotoxy(x, y);

    SetConsoleTextAttribute(consoleHandle, clBright | colorS);

    printf(s);

    SetConsoleTextAttribute(consoleHandle, clBright | colorV);

    printf("%d", value);

}