Description
Description: In this homework, you will implement Turkish Draughts board game. The rules of the game are listed below. 1) There is a 8×8 board.
2) Each player starts with 16 men (white and black) placed on all the squares of the second and third rows (see Figure 1). All the squares are used.
3) Men´s moves: They move one square horizontally or vertically forwards, never backwards (see Figure 2).
4) Kings moves: They move and jump vertically and horizontally any number of squares (see Figure 2).
5) A man captures by jumping to a vacant square in the moveable direction (rule 3) beyond a piece of the opponent.
6) A king captures by jumping to a vacant square beyond an adverse piece, any distance away.
7) Maximum capture compulsory: If there are two or more different chances to make capture, it is compulsory to make the move that captures the maximum amount of the opponent´s pieces. You must use recursion algorithm to find Max. capture. Any other solutions are not accepted.
typedef enum {white_man, black_man, white_king, black_king, empty} piece; You must use this enumeration to define the pieces on the board.
typedef enum {white = 10, black = 20} player; You must use this enumeration to define the players.
void init_board(piece board[][8]);
This function initializes the board as mentioned in the second rule. int move(piece board[][8], int from_x, int from_y, int to_x, int to_y, player p); This function checks if the given player p can move a piece belonging to it from location
(from_x, from_y) to location (to_x,to_y). If the players move is not allowed the function returns:
• -1: The player p is trying to move a piece that does not belong to him.
• -2: The move is not allowed.
• n>=0: The move is allowed and it is executed with n of opponents pieces captured.
int check_end_of_game(piece board[][8]);
This function checks if the game has been completed after the move. It returns:
• -1: Game continues.
• white: White wins the game.
• black: Black wins the game.
• void display_board(piece board[][8]);
• This function displays the board in current state. The following symbols should be used for
• printing:
• ‘-‘: Empty squares.
• ‘b’: The regular black pieces.
• ‘B’: The black kings.
• ‘w’: The regular white pieces.
• ‘W’: The white kings.
Sample outputs are shown below:
void sample_game_1();
void sample_game_2();
This function should use the above functions to play the game given in the following gif animation.
http://damaakademisi.com/wp-content/uploads/2009/02/10puan_1.gif
Part 2 (60 points):
In this part
For any questions: Mrs Altan Akin, tualtan@gtu.edu.tr
Good Luck!
I
Your submission (studentnumber_hw07.zip) should include the following files and
NOTHING MORE :
input_date.txt, new_date.txt, screenshots of your running programs step by step with explanations as a HW7.pdf file and
HW07_<student_name>_<studentSirname>_<student number>_part1.c HW07_<student_name>_<studentSirname>_<student number>_part2.c




Reviews
There are no reviews yet.