Describe an algorithm to play the game of nim

Assignment Help Data Structure & Algorithms
Reference no: EM1379681

Describe an algorithm to play the Game of Nim using all of the three tools discussed in class (pseudocode, flowchart, hierarchy chart). The rules for the game are as follows:

- Two players take turns removing sticks from a pile of sticks.

- At the start of the game, there are 21 sticks on the pile.

- At each turn, a player can remove one, two, or three sticks from the pile.

- The game is over when the last stick is removed from the pile.

- The player who removes the last stick loses the game.

Include all necessary input, output, repetitions, sequences and decisions in your charts as appropriate.

The solution includes Rules of game and Pseudocode

 

Reference no: EM1379681

Questions Cloud

Prepare analyses to help in making their decisions : Using the data provided by the controller, prepare analyses to help Robert and Jane in making their decisions. (Hint: Prepare cost calculations for both product lines using ABC to see whether there is any significant difference in their unit costs). ..
Question about atm networks : ATM networks use a token bucket program to regulate traffic. A new token is put into the bucket every one usec so ATM cells can be sent during this period.
Question about processing packets : A CPU in a router can procedure two million packets/sec. The load offered to it is 1.5 million packets per sec. If the route from source to destination contains ten routers
Network crashes are hypothesized : Assume we are using Lamport's hash, and Bob's system crashes before receiving Alice's reply to a message.
Describe an algorithm to play the game of nim : Describe an algorithm to play the Game of Nim using all of the three tools discussed in class (pseudocode, flowchart, hierarchy chart).
Differences between the internet, intranets, extranets : Discuss similarities and differences between the Internet, intranets, extranets. Define e-Commerce and discussow can e-Commerce businesses be categorized?
Dealing with internet security and privacy : A procedure is said to be I/O bound if it needs a lot of I/O operations, whereas a procedure that consists of mostly computations within the CPU/memory system is said to be compute bound.
Supporting multiple incoming requests via threads : The email database server is created to accept multiple incoming requests via a socket in order to locate a specific message and return it to the customer email browser
How the specific volume of each liquid varies with temp : Using the information in the above table to show how the specific volume of each liquid varies with temperature.   You should plot a graph for each liquid and use this graph to estimate the exact value of a at 50°C for each liquid.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  What do you meant by an rfp

Select a specific category of vertical applications to investigate. Use the Internet and any other sources of information you might have to study some of the different products that are available in that category.

  Describe why algorithm runs in on time

Assume you have the array A of n items, and you want to find k items in A closest to the median of A. Describe why your algorithm runs in O(n) time.

  What is minimum number of nodes expanded for bfs and dfs

Consider the following graph representing the state space and operators of a navigation problem: What is the minimum number of nodes expanded and the storage needed for BFS and DFS?

  Converting arithmetic expression in reverse polish notation

Convert the following numerical arithmetic expression into reverse Polish notation and show the stack operations for evaluating the numerical result.

  Effective address-addressing mode of instruction is direct

Evaluate the effective address if the addressing mode of the instruction is (a) direct; (b) immediate; (c) relative; (d) register indirect.

  Algorithm to concatenate string in single binary search tree

Create algorithm which concatenates T1 and T2 into single binary search tree. Worst case running time must be O(h).

  Queue and content of countdown timer-using priority queue

At time 230 five processes (P1 - P5) are waiting for timeout signal. They are scheduled to wake up at times: 260, 320, 360, 430, 450. Using priority queue with time differences illustrate queue and content of countdown timer at time 230.

  Write recursive version of array-based linear search

Write an algorithm but not code. Write a recursive version of the array-based linear search algorithm. Write a recursive version of the linked-list-based linear search algorithm."""

  Write algorithm to calculate the volume of water

Write an algorithm to calculate the volume of water in cubic feet, flowing through pipe of diameter d in feet, with a velocity of v feet per second.

  Write schedule produced by earliest deadline first algorithm

Given below are two sets of real-time, periodic tasks. For (a), will the schedule produced by Earliest Deadline First algorithm meet all the deadlines?

  Determining entropy of encrypted message

If this message is encrypted with DES by using a random 56-bit key, determine encrypted message's entropy?

  Design a divide-and-conquer algorithm

Design a divide-and-conquer algorithm for the Motif Finding problem and estimate its running time. Have you improved the running time of the exhaustive search algorithm?

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