Код: Выделить всё
♕Код: Выделить всё
♛Код: Выделить всё
?Ниже мой код:
Код: Выделить всё
#include "ChessGame.h"
#include
#include
#include
#include
#include
using namespace std;
const wchar_t* pieces[7] = { L"♕", L"♙", L"♖", L"♘", L"♗", L"♕", L"♔" };
const wchar_t* blackPieces[7] = { L"♛", L"♟", L"♜", L"♞", L"♝", L"♛", L"♚" };
ChessGame::ChessGame() : whiteTurn(true) {
board = { {
{-5, -3, -4, -7, -6, -4, -3, -5},
{-1, -1, -1, -1, -1, -1, -1, -1},
{ 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0},
{ 1, 1, 1, 1, 1, 1, 1, 1},
{ 5, 3, 4, 7, 6, 4, 3, 5}
} };
}
void ChessGame::run() {
SetConsoleOutputCP(CP_UTF8);
wcout.imbue(locale("en_US.UTF-8"));
while (true) {
printBoard();
wcout > end;
int startX = start[0] - 'a';
int startY = 8 - (start[1] - '0');
int endX = end[0] - 'a';
int endY = 8 - (end[1] - '0');
if (isMoveValid(board[startY][startX], startX, startY, endX, endY)) {
processMove(startX, startY, endX, endY);
whiteTurn = !whiteTurn;
} else {
wcout
Подробнее здесь: [url]https://stackoverflow.com/questions/79371907/why-does-my-chess-program-display-question-marks-instead-of-unicode-chess-pi[/url]