Question

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 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;...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Beam Me Down (Using Alice)
Homework Solution
$5.00
Computer Science
Alice
Beam Me Down
Programming
Astronauts
Command Console
Transporter
Algorithms
Gameplay
Opacity
C++ Problems
Homework Solution
$25.00
Programming
C++
Computer Science
Console Applications
Codes
Classifications
Students
Adults
Seniors
Subway
Customers
Fee Categories
Integers
Statements
Variables
Loops
Indexes
Average Values
Minimum
Maximum
Arrays
Functions
Input
Ou
C-Programming Questions
Homework Solution
$18.00
Computer Science
Programming
C
Algorithms
Laser Beam
ASCII Symbols
Flowchart
Strings
Loops
Characters
Integer Variables
Coordinates
C Programming: ASCII Code Characters to Integers
Homework Solution
$30.00
C Programming
Computer Science
ASCII Codes
Characters
Bits
Integers
Operations
File Management
Statements
Variables
Functions
Input
Output
Encoding
Decoding
Right Triangle Problem in C++
Homework Solution
$15.00
Mathematics
Programming
C++
Right Triangle
Hypotenuse
Leg
Sum of Squares
Sides
Lengths
Users
Input
Output
Integers
Get help from a qualified tutor
Live Chats