In: Computer Science
I have a project due and am having problems compiling a program: The only program I have written is check.c everything else is given and correct. Can you modify check.c to simply print out the chessboard, in other words, to get it to compile by any means thank you. The only thing you have to modify again is check.c nothing else. Just get it to print something thanks.
program chess.c
#include
#include
#include "chess.h"
void get_valid_move(int mover)
{
int x_from, y_from, x_to, y_to;
int move_valid;
move_valid = INVALID_MOVE;
while (move_valid == INVALID_MOVE) {
if (mover == WHITE) {
printf("\nWHITE: ");
} else {
printf("\nBLACK: ");
}
printf("Please enter a move: ");
scanf("%d %d %d %d", &x_from, &y_from, &x_to,
&y_to);
printf("\n");
/* check for termination */
if ((x_from == -1) && (y_from == -1) && (x_to ==
-1) && (y_to == -1))
exit(0);
/* check for validity of move */
move_valid = check_move(mover, x_from, y_from, x_to, y_to);
if (move_valid == VALID_MOVE) {
/* o.k., move is valid; make move */
the_board_piece[y_to][x_to] =
the_board_piece[y_from][x_from];
the_board_color[y_to][x_to] =
the_board_color[y_from][x_from];
the_board_piece[y_from][x_from] = EMPTY;
the_board_color[y_from][x_from] = EMPTY;
} else {
printf("INVALID MOVE. TRY AGAIN!!\n");
}
}
}
void move_loop()
{
int mover;
mover = WHITE;
while (TRUE) {
print_board();
get_valid_move(mover);
if (mover == WHITE)
mover = BLACK;
else
mover = WHITE;
}
}
int main()
{
move_loop();
}
chess.h
/* definitions for pieces */
#define NUM_PIECES 7
#define EMPTY 0
#define PAWN 1
#define KNIGHT 2
#define BISHOP 3
#define ROOK 4
#define QUEEN 5
#define KING 6
#define WHITE 1
#define BLACK 2
#define VALID_MOVE 1
#define INVALID_MOVE 2
#define TRUE 1
#define FALSE 0
/* board definition */
#define BOARD_SIZE 8
extern int the_board_piece[BOARD_SIZE][BOARD_SIZE];
extern int the_board_color[BOARD_SIZE][BOARD_SIZE];
/* main move processing */
void get_valid_move(int mover);
void move_loop();
/* board print routines */
void print_row_box();
void print_row_end();
void print_side_box();
void print_side_box_piece(int type, int color);
void print_row(int j);
void print_board();
/* required functions for move validity checking */
int check_move(int color, int x_from, int y_from, int x_to, int
y_to);
int check_pawn_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_knight_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_bishop_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_rook_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_queen_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_king_move(int color, int x_from, int y_from, int x_to,
int y_to);
check.c
#include "chess.h"
int check_move(int color, int x_from, int y_from, int x_to, int
y_to) {
// color: color of the player making the move
// board_piece_color[x][y] represents the color of the piece at board[x][y]
if (x_from < 0 || x_from > 7) {
// x_from not in range 0-7
return INVALID_MOVE;
}
else if (x_to < 0 || x_to > 7) {
// x_to not in range 0-7
return INVALID_MOVE;
}
else if (y_from < 0 || y_from > 7) {
// y_from not in range 0-7
return INVALID_MOVE;
}
else if (y_to < 0 || y_to > 7) {
// y_to not in range 0-7
return INVALID_MOVE;
}
else if (x_from == x_to && y_from == y_to) {
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_move_knight(int color, int x_from, int y_from, int
x_to, int y_to)
{
/* not neceessary
if(y_from != 0 && x_from != 1 || x_from != 6 &&
y_from != 0)
{
return INVALID_MOVE;
}
*/
if(x_to == )
{
}
else if (x_from == x_to && y_from == y_to) {
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_move_king(int color, int x_from, int y_from, int x_to,
int y_to)
{
if((x_from==0) && ((x_to==1)||(x_to==0)))
{
//starting from 0th position of column
if ((y_from==0) && ((y_to==1) || (y_to==0)))
{
return VALID_MOVE;
}
else return INVALID_MOVE;
return VALID_MOVE;
}
else if((y_from==0) && ((y_to==1)||(y_to==0)))
{
//starting from 0th position of row
if ((x_from==0) && ((x_to==1) || (x_to==0)))
{
return VALID_MOVE;
}
else return INVALID_MOVE;
return VALID_MOVE;
}
else if ((x_from==7) && (x_to==x_from+1))
{
//check condition for last column
return INVALID_MOVE;
}
else if ((y_from==7) && (y_to==y_from+1))
{
//check condition for last row
return INVALID_MOVE;
}
else if (((x_to==x_from + 1)&&(y_to==y_from)) || ((x_to==x_from)&&(y_to==y_from+1))||((x_to==x_from - 1)&&(y_to==y_from)) || ((x_to==x_from)&&(y_to==y_from-1)) || ((x_to==x_from + 1)&&(y_to==y_from+1))||((x_to==x_from + 1)&&(y_to==y_from-1))||((x_to==x_from - 1)&&(y_to==y_from-1))||((x_to==x_from 1 1)&&(y_to==y_from-1)))
{
//checking the king move in any eight directions by +1
return VALID_MOVE;
}
else if (x_from == x_to && y_from == y_to) {
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
return VALID_MOVE;
}
int check_move_rook(int color, int x_from, int y_from, int x_to,
int y_to)
{
/* not neceessary
if(y_from != 0 && x_from != 0 || x_from != 7 &&
y_from != 0)
{
return INVALID_MOVE;
}
*/
//Movement along columns and rows
if(y_to == 0 && x_to <= 0 || x_to == 0 && y_to
<= 0 || y_to == 0 && x_to >= 7 || x_to == 7
&& y_to <= 0)
{
return INVALID_MOVE;
}
else if (x_from == x_to && y_from == y_to)
{
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color)
{
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_move_bishop(int color, int x_from, int y_from, int
x_to, int y_to)
{
//Movement
if(x_from != 2 && y_from != 0 || x_from != 5 &&
y_from != 0)
{
return INVALID_MOVE;
}
else if()
{
//Movement diagnoal
return INVALID_MOVE;
}
else if (x_from == x_to && y_from == y_to) {
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_queen_move(int color, int x_from, int y_from, int
x_to, int y_to)
{
if()
{
}
else if (x_from == x_to && y_from == y_to) {
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_pawn_move(int color, int x_from, int y_from, int x_to, int y_to)
{
if(y_from > 6 || x_from > 7 || x_to > 7 || y_to > 7 || y_from < 1 || x_from < 0 || x_to < 0 || y_to < 2)
{
return INVALID_MOVE;
}
else if((x_from-x_to) > 1 || (x_from-x_to) < -1)
{
return INVALID_MOVE;
}
else if((y_to-y_from) < 0 ||(y_to-y_from) > 2)
{
return INVALID_MOVE;
}
else if((y_to-y_from) == 2 && y_from != 1)
{
return INVALID_MOVE;
}
else if ((x_from-x_to) != 0 && the_board_color(x_to, y_to) != color)
{
return INVALID_MOVE;
}
else if ((x_from-x_to) == 0 && the_board_color(x_to, y_to) == color)
{
return INVALID_MOVE;
}
return VALID_MOVE;
}
board.c
#include
#include "chess.h"
int the_board_piece[BOARD_SIZE][BOARD_SIZE] =
{{ROOK, KNIGHT, BISHOP, QUEEN, KING, BISHOP, KNIGHT, ROOK},
{PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN},
{ROOK, KNIGHT, BISHOP, QUEEN, KING, BISHOP, KNIGHT, ROOK}};
int the_board_color[BOARD_SIZE][BOARD_SIZE] =
{{WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE},
{WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK},
{BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK}};
char pieces[NUM_PIECES] = {' ', 'P', 'N', 'B', 'R', 'Q', 'K'};
/******************** board print routines
********************/
void print_row_box()
{
printf("|----");
}
void print_row_end()
{
printf("|\n");
}
void print_side_box()
{
printf("| ");
}
void print_side_box_piece(int type, int color)
{
if (type == EMPTY) {
print_side_box();
} else {
printf("| %c%c ", ((color == WHITE) ? 'W' : 'B'),
pieces[type]);
}
}
void print_row(int j)
{
int i;
for (i = 0; i < BOARD_SIZE; i++) {
print_row_box();
}
print_row_end();
for (i = 0; i < BOARD_SIZE; i++) {
print_side_box();
}
print_row_end();
for (i = 0; i < BOARD_SIZE; i++) {
print_side_box_piece(the_board_piece[j][i],
the_board_color[j][i]);
}
print_row_end();
for (i = 0; i < BOARD_SIZE; i++) {
print_side_box();
}
print_row_end();
}
void print_board()
{
int j, i;
for (j = 0; j < BOARD_SIZE; j++) {
/* print one row of boxes */
print_row(j);
}
for (i = 0; i < BOARD_SIZE; i++) {
print_row_box();
}
print_row_end();
}
The code is corrected and made to print the Chess Board.
Use the following files names and you won't get the error.
main.c
#include <stdio.h>
#include <stdlib.h>
#include "chess.h"
void get_valid_move(int mover)
{
int x_from, y_from, x_to, y_to;
int move_valid;
move_valid = INVALID_MOVE;
while (move_valid == INVALID_MOVE) {
if (mover == WHITE) {
printf("\nWHITE:
");
} else {
printf("\nBLACK:
");
}
printf("Please enter a move:
");
scanf("%d %d %d %d", &x_from,
&y_from, &x_to, &y_to);
printf("\n");
/* check for termination */
if ((x_from == -1) &&
(y_from == -1) && (x_to == -1) && (y_to ==
-1))
exit(0);
/* check for validity of move */
move_valid = check_move(mover,
x_from, y_from, x_to, y_to);
if (move_valid == VALID_MOVE)
{
/* o.k., move is valid; make move */
the_board_piece[y_to][x_to] =
the_board_piece[y_from][x_from];
the_board_color[y_to][x_to] =
the_board_color[y_from][x_from];
the_board_piece[y_from][x_from] = EMPTY;
the_board_color[y_from][x_from] = EMPTY;
} else {
printf("INVALID
MOVE. TRY AGAIN!!\n");
}
}
}
void move_loop()
{
int mover;
mover = WHITE;
while (TRUE) {
print_board();
get_valid_move(mover);
if (mover == WHITE)
mover =
BLACK;
else
mover =
WHITE;
}
}
int main()
{
move_loop();
}
chess.h
#ifndef CHESS_H
#define CHESS_H
#define NUM_PIECES 7
#define EMPTY 0
#define PAWN 1
#define KNIGHT 2
#define BISHOP 3
#define ROOK 4
#define QUEEN 5
#define KING 6
#define WHITE 1
#define BLACK 2
#define VALID_MOVE 1
#define INVALID_MOVE 2
#define TRUE 1
#define FALSE 0
/* board definition */
#define BOARD_SIZE 8
extern int the_board_piece[BOARD_SIZE][BOARD_SIZE];
extern int the_board_color[BOARD_SIZE][BOARD_SIZE];
/* main move processing */
void get_valid_move(int mover);
void move_loop();
/* board print routines */
void print_row_box();
void print_row_end();
void print_side_box();
void print_side_box_piece(int type, int color);
void print_row(int j);
void print_board();
/* required functions for move validity checking */
int check_move(int color, int x_from, int y_from, int x_to, int
y_to);
int check_pawn_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_knight_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_bishop_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_rook_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_queen_move(int color, int x_from, int y_from, int x_to,
int y_to);
int check_king_move(int color, int x_from, int y_from, int x_to,
int y_to);
#endif
chess.c
#include <stdio.h>
#include "chess.h"
int the_board_piece[BOARD_SIZE][BOARD_SIZE] =
{{ROOK, KNIGHT, BISHOP, QUEEN, KING, BISHOP, KNIGHT, ROOK},
{PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN},
{ROOK, KNIGHT, BISHOP, QUEEN, KING, BISHOP, KNIGHT, ROOK}};
int the_board_color[BOARD_SIZE][BOARD_SIZE] =
{{WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE},
{WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE, WHITE},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY},
{BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK},
{BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK, BLACK}};
char pieces[NUM_PIECES] = {' ', 'P', 'N', 'B', 'R', 'Q', 'K'};
/******************** board print routines
********************/
void print_row_box()
{
printf("|----");
}
void print_row_end()
{
printf("|\n");
}
void print_side_box()
{
printf("| ");
}
void print_side_box_piece(int type, int color)
{
if (type == EMPTY) {
print_side_box();
} else {
printf("| %c%c ", ((color == WHITE)
? 'W' : 'B'), pieces[type]);
}
}
void print_row(int j)
{
int i;
for (i = 0; i < BOARD_SIZE; i++) {
print_row_box();
}
print_row_end();
for (i = 0; i < BOARD_SIZE; i++) {
print_side_box();
}
print_row_end();
for (i = 0; i < BOARD_SIZE; i++) {
print_side_box_piece(the_board_piece[j][i],
the_board_color[j][i]);
}
print_row_end();
for (i = 0; i < BOARD_SIZE; i++) {
print_side_box();
}
print_row_end();
}
void print_board()
{
int j, i;
for (j = 0; j < BOARD_SIZE; j++) {
/* print one row of boxes */
print_row(j);
}
for (i = 0; i < BOARD_SIZE; i++) {
print_row_box();
}
print_row_end();
}
int check_move(int color, int x_from, int y_from, int x_to, int
y_to) {
// color: color of the player making the move
// board_piece_color[x][y] represents the color of the piece at board[x][y]
if (x_from < 0 || x_from > 7) {
// x_from not in range 0-7
return INVALID_MOVE;
}
else if (x_to < 0 || x_to > 7) {
// x_to not in range 0-7
return INVALID_MOVE;
}
else if (y_from < 0 || y_from > 7) {
// y_from not in range 0-7
return INVALID_MOVE;
}
else if (y_to < 0 || y_to > 7) {
// y_to not in range 0-7
return INVALID_MOVE;
}
else if (x_from == x_to && y_from == y_to) {
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_move_knight(int color, int x_from, int y_from, int
x_to, int y_to)
{
/* not neceessary
if(y_from != 0 && x_from != 1 || x_from != 6 &&
y_from != 0)
{
return INVALID_MOVE;
}
*/
if(x_to == 1)
{
}
else if (x_from == x_to && y_from == y_to)
{
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_move_king(int color, int x_from, int y_from, int x_to,
int y_to)
{
if((x_from==0) && ((x_to==1)||(x_to==0)))
{
//starting from 0th position of column
if ((y_from==0) && ((y_to==1) || (y_to==0)))
{
return VALID_MOVE;
}
else return INVALID_MOVE;
return VALID_MOVE;
}
else if((y_from==0) && ((y_to==1)||(y_to==0)))
{
//starting from 0th position of row
if ((x_from==0) && ((x_to==1) || (x_to==0)))
{
return VALID_MOVE;
}
else return INVALID_MOVE;
return VALID_MOVE;
}
else if ((x_from==7) && (x_to==x_from+1))
{
//check condition for last column
return INVALID_MOVE;
}
else if ((y_from==7) && (y_to==y_from+1))
{
//check condition for last row
return INVALID_MOVE;
}
else if (((x_to==x_from +
1)&&(y_to==y_from)) ||
((x_to==x_from)&&(y_to==y_from+1))||((x_to==x_from -
1)&&(y_to==y_from)) ||
((x_to==x_from)&&(y_to==y_from-1)) || ((x_to==x_from +
1)&&(y_to==y_from+1))||((x_to==x_from +
1)&&(y_to==y_from-1))
||((x_to==x_from -
1)&&(y_to==y_from-1))||((x_to==x_from-1)&&(y_to==y_from-1)))
{
//checking the king move in any eight directions by +1
return VALID_MOVE;
}
else if (x_from == x_to && y_from == y_to)
{
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_move_rook(int color, int x_from, int y_from, int x_to,
int y_to)
{
/* not neceessary
if(y_from != 0 && x_from != 0 || x_from != 7 &&
y_from != 0)
{
return INVALID_MOVE;
}
*/
//Movement along columns and rows
if(y_to == 0 && x_to <= 0 || x_to == 0
&& y_to <= 0 || y_to == 0 && x_to >= 7 ||
x_to == 7 && y_to <= 0)
{
return INVALID_MOVE;
}
else if (x_from == x_to && y_from ==
y_to)
{
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] !=
color)
{
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_move_bishop(int color, int x_from, int y_from, int
x_to, int y_to)
{
//Movement
if(x_from != 2 && y_from != 0 || x_from != 5
&& y_from != 0)
{
return INVALID_MOVE;
}
else if( 1 )
{
//Movement diagnoal
return INVALID_MOVE;
}
else if (x_from == x_to && y_from == y_to)
{
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_queen_move(int color, int x_from, int y_from, int
x_to, int y_to)
{
if( 1 )
{
}
else if (x_from == x_to && y_from == y_to)
{
// from and to are the same position
return INVALID_MOVE;
}
else if (the_board_color[x_from][y_from] != color) {
// piece at from position does not match player's color
return INVALID_MOVE;
}
else if(the_board_color[x_to][y_to] == color)
{
// to position by occupied by piece of same color as player
return INVALID_MOVE;
}
return VALID_MOVE;
}
int check_pawn_move(int color, int x_from, int y_from, int x_to, int y_to)
{
if(y_from > 6 || x_from > 7 || x_to > 7 || y_to > 7 || y_from < 1 || x_from < 0 || x_to < 0 || y_to < 2)
{
return INVALID_MOVE;
}
else if((x_from-x_to) > 1 || (x_from-x_to) < -1)
{
return INVALID_MOVE;
}
else if((y_to-y_from) < 0 ||(y_to-y_from) > 2)
{
return INVALID_MOVE;
}
else if((y_to-y_from) == 2 && y_from != 1)
{
return INVALID_MOVE;
}
else if ((x_from-x_to) != 0 && the_board_color[x_to, y_to] != color)
{
return INVALID_MOVE;
}
else if ((x_from-x_to) == 0 && the_board_color[x_to, y_to] == color)
{
return INVALID_MOVE;
}
return VALID_MOVE;
}
Output: