Lecture 2 Chip Firing Game - Department of Computer Science

Chip-firing Game and Data
Structures
Prof. Sin-Min Lee
Department of Computer Science
San Jose State University
Chip firing games
• Chip firing games are mathematical
games in which a set of points each has
some number of chips on the point. If at
any point in time a point has more chips
on it than the degree of the point, the
chip is ''fired''. Firing a chip sends an
equal portion of the chips on a cell to
each of its neighbors. Any leftover chips
remain on the point. The game
continues until no vertex can be fired.
Parallel Chip Firing Games
• Originally, the ``game'' was played by
selecting a single point at each time step until
a stable configuration was reached (that is
until no point has more chips than its degree)
or until it can be determined that the game
can never terminate. Later research
concluded the termination of the game did not
relay on firing individual points sequentially,
but all points meeting the criteria for firing
could be fired simulatneously. These are
called parallel chip firing games.
When a vertex is fired, it
sends one chip to each
neighbour.
The total number of chips never changes.
1
1
2
1
1
A configuration is stable if no vertex in
V(G) can be fired.
• a famous discrete dynamical system
• the Chip Firing Game, used as a model in
physics, economics and computer science
• avanlache model in statistical mechanic.
Example 1.
Example 2
1
1
1st
2nd
4
1
2
1
3rd
2
3
1
1
3
3
2
2
2
4th
2
1
1
5th
1
2
2
6th
3
4
1
1
2
2
7th
1
1
6th
3
4
1
Example 3.
2
2
1st
2nd
4
1
3rd
2
2
1
2
2
4
1
1
1
4th
1
1
1
3
5th
3
6th
3
3
1
1
Example 4.
1 st
2 nd
2 nd
3 rd
Example 5.
3
3
1
2
2
1
1
2
4
3
3
3
1
2
2
A cycle
Arrays
Arrays are essentially a way to store
many values under the same name. You
can make an array out of any data-type
including structures and classes.
Think about arrays like this:
[][][][][][]
Each of the bracket pairs is a slot(element) in the array, and you can
put information into each one of them. It is almost like having a group
of variables side by side.
Lets look at the syntax for declaring an array.
int examplearray[100]; //This declares an array
This would make an integer
array with 100 slots, or places
to store values(also called
elements). To access a specific
part element of the array, you
merely put the array name and,
in brackets, an index number.
This corresponds to a specific
element of the array. The one
trick is that the first index
number, and thus the first
element, is zero, and the last is
the number of elements minus
one.
Firing of chips occurs when the number of chips inside a
vertex is either GREATER than or EQUAL to the number
of ADJACENT edges.
Each vertex represents an Array element. Another Array is
to keep track of adjacent edges of vertex.
Example
V2
V1
V3
2 chips in V2 initially.
To fire the chips: 2 chips in V2, and 2 adjacent
edges which satisfy the condition of chips firing.
Array representation:
0
2
0
V1
V2
V3
1 chip of V2 goes to V1 and 1 chip of V2 goes to V3 because
ONLY 1 chip can be fired onto an adjacent Vertex
Array Representation:
1
0
1
The chips can be fired again because there is 1 chip in V1 and
1 adjacent edge to V2 and 1 chip in V3 and 1 adjacent edge to
V2. But after firing, the process must stop because it has
Completed a cycle and returned to its original state.
Chip-firing game on paths were considered by Joel Spencer in 1983.
V1
V5
4
V2
V4
V3
V7
V6
The number 4
means four chips
In V4.
Firing the chips is
okay because
There are 4
adjacent vertices
V1
V2
V5
V4
V3
V7
V6
After the chips has been fired, it stops because the number of chips in each
Vertex is less than the number of adjacent edges.
Example 6.
2011123
V1
V2
2
1
V5
1
0
2
V4
V3
1
3
V7
V6
0113212
V1
V2
0
2
V5
3
1
1
V4
V3
1
2
V7
V6
0115030
V1
V2
0
0
V5
5
1
3
V4
V3
1
0
V7
V6
1121212
V1
V2
1
2
V5
1
1
1
V4
V3
2
2
V7
V6
1204030
V1
V2
1
0
V5
4
2
3
V4
V3
0
0
V7
V6
3020212
V1
V2
3
2
V5
0
0
1
V4
V3
2
2
V7
V6
V1
1204030
V2
1
0
V5
4
2
3
V4
V3
0
It repeats the step 5
0
V7
V6
1
Example 7.
1
4
1
1
1
2
2
2
1
Dan Garbini
cs146 3pm
1
2
3
2
2
1
3
1
1
1
1
4
1
1
The End: Loop is formed. Compare to initial structure
and sequence will continue.
"Be an explorer, not a problem
solver" ------G. C. Rota
J.W. von Goethe, Faust
Mephistopheles:
Use well your time, so
rapidly it flies;
Method will teach you time
to win;
Hence, my young friend, I
would advise,
With college logic to begin!