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 a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

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

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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