Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Suppose that in a variation of the game of nim we allow a player to either remove one or more stones from a pile or merge the stones from two piles into one pile as long as at least one stone remains. Draw the game tree for this variation of nim if the starting position consists of three piles containing two, two, and one stone, respectively. Find the values of each vertex in the game tree and determine the winner if both players follow an optimal strategy.

Short Answer

Expert verified

Player \({\bf{1}}\) can win the game if he moves to the position \(\left( {{\bf{2 2}}} \right)\).

Step by step solution

01

Define the values of all vertices in a game tree in a way that enables us to determine the outcome of this game when both players follow optimal strategies

By a strategy mean a set of rules that tells a player how to select moves to win the game. An optimal strategy for the first player is a strategy that maximizes the payoff to this player and for the second player is a strategy that minimizes this payoff. We now recursively define the value of a vertex.

02

One shall draw the game tree for the nim game.

If the beginning position contains three piles containing two, two, and one stone, respectively. Also have to find values of every vertex within the game tree and determine the winner if both players follow an optimal path.

One is only considering the paths only the player moves in which he has a chance to win. A player will never opt to make a move that produces the following cases:

1) Two piles with one pile have\({\bf{1}}\)stone and another greater than\({\bf{1}}\), because in the next move if the other player removes a greater pile, then the other player wins.

2) One pile with more than\({\bf{1}}\)stone. In this case also if the other player removes all the stones except the last one, he wins.

The paths to these two cases can be considered suicidal and we will not consider these paths in the tree.

Note that a vertex with no children except suicide moves is a win for whoever is not moving at that point.

For example, from the node \(\left( {{\bf{2 2}}} \right)\).

03

Final conclusion, calculate the values of each internal node using the rule as follows:

The possible moves are \(\left\{ {{\bf{4, (3}}\,{\bf{0,2, }}\left( {{\bf{1 1}}} \right){\bf{, }}\left( {{\bf{1 2}}} \right)} \right\}\) and all are suicidal for player \({\bf{1}}\) (So the node contains only suicidal children for player \({\bf{1}}\)) and assume that he will not choose anyone of these. In this case, we can consider it as a win for player \({\bf{1}}\). That is why we are putting \({\bf{ + 1}}\) as the value of this node.

Now calculate the values of each internal node using the rule as follows:

For an internal node an even level the value is the maximum of the values of its children. For an enclosed node within the odd level, the worth is the minimum of values of its children.

It follows that player \({\bf{1}}\) can win the game if he moves to the position \(\left( {{\bf{2 2}}} \right)\).

A player is allowed to combine stones from two piles also if the player combines stones from piles \({\bf{1}}\) and \({\bf{3}}\), the new arrangement becomes \(\left( {{\bf{3 2}}} \right)\).

Similarly, from\(\left( {{\bf{2 1 1}}} \right)\)we get\(\left( {{\bf{2 2}}} \right)\)if the player combines stones from piles\({\bf{2}}\)and\({\bf{3}}\).

Hence, Player 1 can win the game if he moves to the position\(\left( {{\bf{2 2}}} \right)\).

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Devise an algorithm based on breadth-first search that determines whether a graph has a simple circuit, and if so, finds one.

Suppose that \({{\bf{d}}_{\bf{1}}}{\bf{,}}{{\bf{d}}_{\bf{2}}}{\bf{,}}...{\bf{,}}{{\bf{d}}_{\bf{n}}}\) are n positive integers with sum \({\bf{2n - 2}}\). Show that there is a tree that has n vertices such that the degrees of these vertices are \({{\bf{d}}_{\bf{1}}}{\bf{,}}{{\bf{d}}_{\bf{2}}}{\bf{,}}...{\bf{,}}{{\bf{d}}_{\bf{n}}}\).

Prove that Sollinโ€™s algorithm produces a minimum spanning tree in a connected undirected weighted graph.

Sollin's algorithm produces a minimum spanning tree from a connected weighted simple graph \({\bf{G = (V,E)}}\) by successively adding groups of edges. Suppose that the vertices in \({\bf{V}}\) are ordered. This produces an ordering of the edges where \({\bf{\{ }}{{\bf{u}}_{\bf{0}}}{\bf{,}}{{\bf{v}}_{\bf{0}}}{\bf{\} }}\) precedes \({\bf{\{ }}{{\bf{u}}_{\bf{1}}}{\bf{,}}{{\bf{v}}_{\bf{1}}}{\bf{\} }}\) if \({{\bf{u}}_{\bf{0}}}\) precedes \({{\bf{u}}_{\bf{1}}}\) or if \({{\bf{u}}_{\bf{0}}}{\bf{ = }}{{\bf{u}}_{\bf{1}}}\) and \({{\bf{v}}_{\bf{0}}}\) precedes \({{\bf{v}}_{\bf{1}}}\). The algorithm begins by simultaneously choosing the edge of least weight incident to each vertex. The first edge in the ordering is taken in the case of ties. This produces a graph with no simple circuits, that is, a forest of trees (Exercise \({\bf{24}}\) asks for a proof of this fact). Next, simultaneously choose for each tree in the forest the shortest edge between a vertex in this tree and a vertex in a different tree. Again the first edge in the ordering is chosen in the case of ties. (This produces a graph with no simple circuits containing fewer trees than were present before this step; see Exercise \({\bf{24}}\).) Continue the process of simultaneously adding edges connecting trees until \({\bf{n - 1}}\) edges have been chosen. At this stage a minimum spanning tree has been constructed.

Show that the addition of edges at each stage of Sollinโ€™s algorithm produces a forest.

Show that if no two edges in a weighted graph have the same weight, then the edge with least weight incident to a vertex v is included in every minimum spanning tree.

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free