Write program a childs selection game

Assignment Help Programming Languages
Reference no: EM13848824

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 */

Reference no: EM13848824

Questions Cloud

Distinguish between the reserves and provisions : Distinguish between the following: (a) Reserves and Provisions (b) Internal Control Questionnaire and Internal Control Evaluation.
Compute nominal gdp in canada for each year : What if both are negatively sloped? Provide the intuition behind your answer. Find the analytical and qualitative solution -
What are the tradeoffs in using multiples versus dcf analys : What are the tradeoffs in using multiples versus DCF analysis?
Explain relationship between materiality and audit risk : Explain the following in brief: (a) Relationship between materiality and audit risk (b) Relationship between Statutory Auditor and internal Auditor.
Write program a childs selection game : Programing C a child's selection game
Body mass index (bmi) is a number calculated : 1. Body Mass Index (BMI) is a number calculated from a person's weight and height and is calculated by the formula: weight (kg) / [height (m)]2. Though somewhat controversial and not meant to be used as a diagnostic criteria, it can be used to charac..
Essay for a humanity : 500 word essay for a Humanity, All essays need to be 500 words and be well supported with textual evidence. You will be graded on the following: your ability to come up with a thesis; your ability to prove that thesis by using textual evidence
Statistical inference for the population proportion : Statistical inference for the population proportion To find the effect of a recent policy change on employee morale, a large corporation decides to conduct an opinion survey, asking N randomly selected employees whether they are satisfied with the n..
Determine the length of the operating cycle : Determine the length of the operating cycle

Reviews

Write a Review

Programming Languages Questions & Answers

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Select a game that can be mapped by an automata

Select a game that can be mapped by an automata. This means the game will have a finite set of states (for whichcertain conditions are true) and an exit condition.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Write program to allot seats on each flight of airline-s

Program the new system you are to write program to allot seats on each flight of airline's only plane(capacity: 10 seats)

  Create a webpage that will accept students grades

Create a webpage that will accept students' grades and produce statistic results -

  What would be the output of the countdown routine

If the call CountDown(10)was issued, what would be the output of the CountDown routine? If the call CountDown(0)was issued, what would be the output of the CountDown routine

  Create a multi-threaded competition

Create a multi-threaded competition in which opposing Robin Hoods will attack one another and try to take each other's gold coins.

  Write a program that would allow a user to enter names

Write a program that would allow a user to enter student names and Final grades (e.g. A,B,C,D,F) from their courses. You do not know how many students need to be entered.

  Design a program that calculate the percentage

You have been asked to design a program that will allow a teacher to calculate the percentage and the final grade for students in a class

  Do the second half as a completely separate loop

Do the second half as a completely separate loop. Remember you'll print out "n" number of stars on a line the same way whether you are doing the top half or the bottom half

  Deisgn driver to test implementation elements to tree

Deisgn a driver to test your implementation. Add various elements to the tree, and then display elements in sorted order. Also, display minimum and maximum element.

  There is two part in this assignment1-discussion1-what does

there is two part in this assignment1-discussion1-what does ethics have to do with recruiting and please define ethics?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd