This week you will be modifying your playMove function to only accept certain mo
ID: 3862928 • Letter: T
Question
This week you will be modifying your playMove function to only accept certain moves. The game you are making is Othello (if you have not guessed already). The objective of this game is to have the most pieces of your color on the board when the game finishes. You gain points by placing pieces of your color on the board and flanking (capturing) your opponent’s pieces. The rules are as follows: 1. A piece (either a 'B' or 'W' in the case of our game) cannot be placed on top of a previously placed piece. The space must be empty. 2. If on your turn you cannot outflank and flip at least one opposing piece, your turn is forfeited and your opponent moves again. If a move is available to you, you may not forfeit your turn. 3. A piece may outflank any number of pieces in one or more rows in any number of directions at the same time - horizontally, vertically or diagonally. (A row is defined as one or more pieces in a continuous straight line). See Figures 1 and 2.
THE TEMPLATE OF THE PROJECT IS GIVEN BELOW
These DIse discs placed tipped Figure 1 Figure 2 4. You may not skip over your own color piece to outflank an opposing piece. (See Figure (Continued on next page) ECE114 Intro to C/C++ Programming Spring 2017 This dike only outlankt and flp Whlte dise 1 Figure 3 5. Pieces may only be outflanked as a direct resultof a move and must fall in the direct line of the piece placed down. (See Figure 4 and 5) Disc These dltat flipped Thoso dises re not fipped even though hey appear to Figure 4 be outlankod) Figure 5 6. All pieces outflanked in any one move must be flipped, even if it is to the player's advantage not to flip them at all. 7. If player tries to play an invalid move, their turn is skipped and no points are added or deducted. 8. When it is no longer possible for either player to move, the game is over. The player with the most pieces ('B' or 'W' on the board) is the winner. Your job is to implement these rules inside the playMove function. You playMove function should return the number of pieces gained by that move (including the one placed by that player).These are the points that should be added to the user's score. Next you need to declare a new function called game0ver. This function takes the board as a parameter and returns either 1 (true) or 0 (false) ifthe game is over. Your playMove function and gameover function will look very similar. The playMove function checks if a certain move is valid by a player, whereas the gameover function will look at all remaining moves (empty spaces) and see if any are valid by any player. The game0ver function will replace the condition currently in your game loop. (Instead of asking the user to enter an integer, the computer will check if the game is over, and choose to continue or not). You should be able to impl ement this function with the game rules described above. You may refer to the ate at ECE114 Blackboard. you would like to play rogram tema this game online to get a better feel for it, you may play it here http://www.othelloonline.org/