For this lab work you are expected to consider Resources/Labs/8/rps_array.c as the base code and do the following modifications to the code. If you have improvements regarding the function internals you may also keep them. However, keep the function names, return types the same. Expectations: 1. Having the program divided in the multiple source files, namely; rps.c and its header rps.h and main.c. 2. Converting predefined macros for rps moves to enumerated variables and to have their own type using typedef and modification of the functions that use them as value and argument types. 3. Converting predefined macros for win conditions to enumerated variables and to have their own type using typedef and modification of the functions that use them as value and argument types. 4. Change the main in a way that the computer will generate moves for each player in random fashion and the game will continue until a player wins 3 times. include
#include #define ROCK @ adefine PAPER 1 #define SCISSOR 2 #define DRAN -1 #define PLAYERININ #define PLAYERZWIN1 * Ingenious implementation of winning conditions using Indexes as players move and stored values as pe (taken from random source on internet) / // ROCK PAPER SCISSOR int winConditions() - (SCISSOR, ROCK, PAPER): int chooseMove(int number) { int move: printf("Player Ad Move ", number); printf("0 Rock "); printf("1 - Paper "); printf("2 - Scissor "); scanf("d", Imove); return move; ) int gameRound(int firstPlayer love, int secondPlayer love) { if (firstPlayerflove = secondPlayer Move) { return DRAW: } else { if (winConditions (firstPlayer love) = secondPlayer love) { return PLAYERIWIN; } else { return PLAYER2WIN; > void announcellinner(int gameResult) { 11 (gameResult = DRAW) { printf("Draw ! "); } else if (gameResult PLAYERWIN) { printf("Player 1 win ! "); } else if (gameResult PLAYERZWIN) { printf("Player 2 win ! "); } else { printf("undefined ganeResult value id ", gameResult); } void main() { bool finished = false; Each player has 3 lives, when one of the players loses all life points, the gane is over. . Lose is -1 Life point and draw does not affect life points. *7 while (finished) { int first Player Move - choose love (1) int secondPlayer love - chooselove(2) int gameResult .gane Round (FirstPlayer love, secondPlayer love) announceWinner gameResult); finished = true