The global capacity to act purposefully, think rationally, a…

Questions

The glоbаl cаpаcity tо act purpоsefully, think rationally, and adapt to one’s surroundings is known as

Descriptiоn оf the prоgrаm to write: Uploаd а .c source file containing a main function that will implement the following program. Your program will implement a text-based 2-players game. The goal of the game is for each player to take turn entering a single word. The first letter of that word must be the last letter of the previous word entered by the other player. You will display an error message if this is not the case and prompt again the faulty player to re-enter a word starting with the right letter. The first player starts by entering a word starting with any letter of their choice. Players are not allowed to enter words that have been previously memorized. The program memorizes a word when it is an acceptable input from one of the player (i.e., never used before, starting with right letter). There is a limit to how many words the program can memorize, this limit is entered by the user at the beginning of the game. We will keep track of the score in the form of the length of the words-chain that is created by the two players.  As soon as one of the players has no idea, they may give up by entering the string "..." instead of a word. The game then ends and the score is displayed for the winning player. To make things easier, we will assume a few things that your program does not have to enforce: The players will always enter their word all in lower-case letters. The players' input will always consist of a single word (e.g., "disk-drive" or "diskdrive" instead of "disk drive") Both players will agree to a theme for the words to be chosen, before to start the game. See the example of program's execution section below for more details about the requirements. Example of Program's Execution (user input is in bold) Words-Chains game starting. Please agree on a theme.How many used words should I keep track of? 0How many used words should I keep track of? -5How many used words should I keep track of? 4Player 1: Enter a word (must start with any letter): oneMemorized word #1 is 'one'The words-chain is, so far, of length 1.Player 2: Enter a word (must start with 'e'): twoYour word starts with a 't' but it should start with a 'e'. Try again.Player 2: Enter a word (must start with 'e'): enactedMemorized word #2 is 'enacted'The words-chain is, so far, of length 2.Player 1: Enter a word (must start with 'd'): threeYour word starts with a 't' but it should start with a 'd'. Try again.Player 1: Enter a word (must start with 'd'): directoryMemorized word #3 is 'directory'The words-chain is, so far, of length 3.Player 2: Enter a word (must start with 'y'): yellow-stoneMemorized word #4 is 'yellow-stone'The words-chain is, so far, of length 4.Player 1: Enter a word (must start with 'e'): enactedThis word has already been used.Try again.Player 1: Enter a word (must start with 'e'): yellow-stoneThis word has already been used.Try again.Player 1: Enter a word (must start with 'e'): elaborateToo many words to rememberThe words-chain is, so far, of length 5.Player 2: Enter a word (must start with 'e'): enactedThis word has already been used.Try again.Player 2: Enter a word (must start with 'e'): elaborateToo many words to rememberThe words-chain is, so far, of length 6.Player 1: Enter a word (must start with 'e'): ...Player gave up. Game is over.Winner is player 2 with a words-chain of length 6.The words that were memorized during the game are:oneenacteddirectoryyellow-stone How to implement the program Decompose your program into the following functions:  int ask_user_how_many_used_words(); This function will prompt the user to enter an int value (see above) until the user entered a value that is greater than zero. It will then return that value.  char** allocate_used_words(int how_many); This function will take as parameter the number of words to remember. It will then allocate a dynamical array of pointers on characters of that size. Each of the elements of this array, which will be pointers on the words remembered, will be initialized to NULL. The address of the dynamically allocated array of pointers is then returned. bool already_used(char** used, char* w, int max); This function returns true if the string passed as parameter w is one of the words that were memorized in the dynamically allocated array of strings passed as parameter used. The parameter max tells us how many words were currently memorized in used. If the word has not been memorized, the function returns false. void remember_word(char** used, char* w, int max, int* current); This function will add the word passed as the string parameter w to the dynamically allocated array of strings passed as parameter used. To do so, it will make use of the parameter max, which is the maximum number of words that can be memorized, as well as the parameter current which is the index of next word to be memorized,HINT: use the strdup function (check its manpage) to make a copy of w in the used array of pointers. int main(void); The main function will implement most of the game, using the above-described functions, so that it executes as illustrated in the example of program's execution section. Grading Criteria: Rubric # Pts Additional Grading Notes The program compiles without compilation errors or warnings 3 Deduct 1 point per minor compilation error (e.g., typo, forgotten semi-colon, forgotten or extra curly braces or parentheses). If the program does not compile due to too many errors or due to an error that is non-trivial to fix (see above), then the whole assignment receives zero points. The program executes without crashing at runtime 3 Deduct one point for each use case that leads the program to crash (maximum 3) Function ask_user_how_many_used_words 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function allocate_used_words 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function already_used 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Function remember_word 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented main function 3 3 – Implemented according to requirements 2 – Mostly properly implemented 1 – Not properly implemented 0 – not implemented Total 21