QuestionQuestion

You are going to design and develop a simplified game of Checkers or any other games you preferred using your preferred programming languages and development environments.

The implementation of your game should consist of three processes/threads. The main process is the manager. It should start the other two (player) processes/threads, and tell one of the players to make a move. Once the move is made and communicated back to the manager, the manager will update its display, decide if there is a winner, and if not, it will then ask the other player to make a move. Use socket communication to coordinate among the manager and the player processes/threads.

If the manager detects a winner, it should display a message in its window about the winner and give the user an option to play again or terminate the game. If the user selects to terminate the game, the manager should end the game in an orderly way, i.e., the child processes/threads should be stop first and then the parent process (manger) can terminate. If the user chooses to play again, then the players will have to be able to restart and to realize that they are being told to do so.

Note

The key point of this lab is not the game rules. So, you can simplify the game and game rules by making some assumptions. For examples: you can make the following assumptions while designing the game:
• Players Play on the red squares.
• I am not crowning the kings, so if a coin reaches the other end it is ‘Stuck’
• If all coins of one player are lost or ‘Stuck’ then the other player wins the game. If Player 1’s coins are stuck after Player 2’s turn, only then does Player 2 win.
If both players are stuck, then it is a tie. If Player 1 gets stuck, and on the immediate next move, if player2 gets stuck then the game is a tie.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

procedure CPlayer.CheckJumps(position:TPosition); //Check if from position can make a jump
var pos:TPosition;
    opos:TPosition;
    figure, dummy:byte;
begin
    pos.x := position.x + ownFigures[1].forwardDirection * 2; //new position after jump
    pos.y := position.y + 2;
    opos.x := position.x + ownFigures[1].forwardDirection; //opponent figure between
    opos.y := position.y + 1;
    //checks
    if ((IsOnBoard(pos)) and (isOccupiedByOpponent(opos, figure)) and (not isOccupiedbyOwn(pos)) and (not isOccupiedByOpponent(pos, dummy))) then
    begin //if yes, add jump to jumps array
          inc(tmpNumberOfJumps);
          tmpJumps[tmpNumberOfJumps].newPosition := pos;
          tmpJumps[tmpNumberOfJumps].overJumped := figure;
          CheckJumps(pos); // cal function recursively, to check can more jumps be made
    end
    else //if cant in one direction, check another
    begin
          pos.y := position.y - 2;
          opos.y := position.y - 1;
          if (IsOnBoard(pos) and (isOccupiedByOpponent(opos, figure)) and (not isOccupiedbyOwn(pos)) and (not isOccupiedByOpponent(pos, dummy))) then
          begin
               inc(tmpNumberOfJumps);
               tmpJumps[tmpNumberOfJumps].newPosition := pos;
               tmpJumps[tmpNumberOfJumps].overJumped := figure;
               CheckJumps(pos);
          end;
    end;
end;...
$40.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats