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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Finding page faults for lru replacement algorithms

How many page faults would happen for the given replacement algorithms, assuming one, two, three, and four frames?

  Determine storage required for bfs and dfs

Determine the minimum number of nodes expanded and storage required for BFS and DFS? (Hint: this question asks about the best case performance of BFS and DFS).

  Threat model to describe risk of attack vector

Construct a simple threat model that describes the risk this represents: attacker(s), attack vector, vulnerability, assets, and likelihood of occurrence, likely impact, and plausible mitigations.

  Create algorithm to prepare daily hotel charge report

Create the algorithm to prepare the daily hotel charge report. Input consists of series of records which contain a room number, customer name, cost of the room, and cost of meals charged to the room.

  Build b tree for the part table

Build B+ tree for the PART table with n = 6 pointers; illustrate how B+ tree expand (show several intermediate trees) and what final tree will look like.

  Explain eager decision tree algorithm-lazy knn algorithm

Discuss the advantages and disadvantages of the new algorithm compared with the eager decision tree algorithm, and the advantages and disadvantages of the new algorithm compared with the lazy kNN algorithm.

  Describe implementation of algorithm on simd computer

Describe an implementation of that algorithm on an SIMD computer where the processors are connected to form a linear array

  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-decide whether language recognized by dfa is empty

Give an algorithm to decide whether the language recognized by a DFA is empty. Given two DFAs M1 and M2, give an algorithm to decide whether L(M1)subset or equal to L(M2).

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

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