9827

Winning or Losing in the Game of Nim on Graphs

This Demonstration presents a random oriented graph that has at least one terminal vertex. Such graphs can represent the terminal game Nim. To play Nim, players alternate in choosing a sequence of connected vertices until a terminal vertex is reached by one of the players; then the other player wins.
It can be shown that in such games all the positions can be divided into two subsets representing winning and losing positions. An algorithm is applied to partition an arbitrary directed graph.
The graph on the left is a random graph with numbered vertices and edges. The graph on the right shows the losing positions in black and the winning positions in white.

THINGS TO TRY

SNAPSHOTS

  • [Snapshot]
  • [Snapshot]
  • [Snapshot]

DETAILS

A terminal game with players is defined by:
• a partition of the nonempty set into nonempty sets ;
• a function (i.e. for every , there is a subset of ) such that ;
• a function (i.e. for every element , there is a vector ); is called the payoff function and each player tries to maximize it.
An arbitrary oriented graph with at least one terminal vertex can represent a Nim-like game that is a particular case of a terminal game on graphs with , , and equal to the set of terminal vertices. It can be verified that can be partitioned into subsets and (i.e. and ) with the properties:
,
.
The vertices in the set are called the "gain" vertices, and those in are called the "loss" vertices, because the player who chooses a vertex from offers only losing vertices to the opponent (from ), and the player who chooses a vertex from offers only winning vertices (from ). Obviously is the graph's kernel. Define to be the set of terminal vertices.
The algorithm is:
1. Set .
2. For every vertex from , we know if belongs to or to
Let , and
Then, and .
3. Let .
only when .
Reference
[1] B. Kummer, Spiele auf Graphen, Berlin 1979.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.









 
RELATED RESOURCES
Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2014 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+