Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Implement a child's selection game. In the standard version of this game a group of children gather in the circle and begin a rhyme. Each word of the rhyme is chanted in turn by 1 person in the circle. The last person is out of the game, and the rhyme is restarted from the next person. Eventually, 1 person is left and he or she is the lucky individual who gets selected.

Your application should read the total number (or names) of players and the words of the rhyme from the keyboard. The intermediate output are numbers (or names) of players called by each word of a rhyme, players that get removed from the circle after each round, and updated lists of players. The final output is the number (or name) of one remaining (selected) player.

Details of implementation.

Use an array of strings rhyme for storing list of words in the rhyme and circular doubly linked list (of integers or strings) for storing players.

Create files CircLinkedList.h and CircLinkedList.c with declarations and implementations of the following functions. Header file CircLinkedList.h should also contain definitions of types: Node (structure with fields data, next, and prev), NodePtr, LinkedList (structure with fields head and tail) and LinkedListPtr.

• LinkedListPtr initLinkedList() /*allocates dynamic memory for the linked list, initializes its head and tail to NULL */

• void insertTail(LinkedListPtr list, int data) /*inserts a new node containing data after the last node, but if the list is empty - as the head of a linked list */

• void display(LinkedListPtr list, NodePtr start) /*displays all the data in a circular doubly linked list, starting from a start node*/

• void removeNode(LinkedListPtr list, NodePtr nodeToDelete) /*removes a node from a circular doubly linked list

Create application file CountingGame.c containing the following functions

• NodePtr sayRhyme(char rhyme[MaxNumWords][MaxWordSize], int numWords, LinkedListPtr list, NodePtr startingPlayer) /*simulates one round of the game:

? output the player starting a rhyme

? for each word in the rhyme print out the player and the word that he says

? output the player which is to be removed (the one who says the last word) and the next one in a list - the new starting player (store the pointers to the nodes containing these players)

? remove the player from the list (calling removeNode)

? print out the updated list of players (calling display)

? return the pointer to the node storing the new starting player */

Sample output of sayRhyme:

Starting this round from Player 1

Player 1 says "eeny",

Player 2 says "meeny",

Player 3 says "miny",

Player 1 says "moe"

Player 1 is removed

Starting the next round from Player 2 (next after Player 1).

Remaining players: 2,3.

• int main(int argc, char argv[])

creates and displays an array of words in a rhyme (inputted by a user) and a list of players,

then simulates playing the game repeatedly calling sayRhyme in a loop until it has just 1 player (startingPlayer ->next== startingPlayer),

which is then announced a winner of the game */

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91418606
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question?


Related Questions in Programming Language

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As