[Solved]Language C Winning Goal Either Capture Opponent S Pieces Completely Immobilize Duke Piece Q37105090
Language: C++
Winning:
The goal is to either capture all the opponent’s piecesor to completely immobilize the Duke.
Piece Movement:
All pieces (including the Duke) have the same movementcapabilities, move either horizontally or vertically for any numberof squares as long as no other piece (friendly or not) is blockingthe way. The movement is identical to that of the rook inchess.
Capturing:
In order to capture a piece, it must be flanked vertically orhorizontally. This is illustrated in Figure 2, where we can seethree different ways black can capture white. A special case iswhen a piece is placed in a corner, and it must be flanked in theonly two viable directions.
The flanking must have been completed by the piece that justmoved, for the capture to take place. This means that suicide isnot possible. In Figure 3, black can move between the two whitepieces and it is safe because neither of the two white pieces wasthe last to move. Similarly, In Figure 5, black has voluntarilymoved to a flanked position and is safe. White moving on his rightflank does not trigger a capture, since the last moved piece doesnot complete any flanking. On the other hand, Figure 4 does lead toa capture because black’s piece is immobilized.
Immobilization
A piece is immobilized if it has nowhere to move. In Figure 4,white has moved to immobilize without flanking. This still leads toa capture.
In order to immobilize the Duke, it must be flanked from allfour directions (or all viable directions). If it is placed in acorner, the capturing mechanics are identical for both duke andpiece (Figure 6). The Duke’s flanking doesn’t have to be based onthe opponent’s pieces entirely, since a Duke’s movement can beblocked by its own pieces as well. But as long as one enemy pieceis involved in the Duke’s encirclement then the Duke isimmobilized, and the game is lost. Therefore, Duke suicide ispossible. In Figure 7, if white moves on the Duke’s left flank, heblocks the last open direction and since black is involved in theencirclement by being on the top flank, the Duke is immobilized. IfA duke is surrounded by his own pieces, he is not immobilized andthus the game is not lost.
Problem Description:
You are to implement the variant of Latrunculi described in thesection above, for two human players in the C++ language. The gameshould not permit illegal moves. You must implement threeADTs, one for a player, one for the board, and one for thereferee.
At each turn, your program should prompt the appropriate player,to select a piece (grid position) and its destination. If anincorrect move is inputted (selected immobilized piece, selectedopponent’s, piece) the program should recognize the error andcontinue to request correct input until the user provides it.
When a player wins, the game should stop and a messageindicating which player is victorious must be printed on thescreen.
Expert Answer
Answer to Language: C++ Winning: The goal is to either capture all the opponent’s pieces or to completely immobilize the Duke. P… . . .
OR

