Pebble basic.py
From Werner KRAUTH
(Difference between revisions)
| Revision as of 21:02, 22 September 2015 Werner (Talk | contribs) ← Previous diff |
Current revision Werner (Talk | contribs) |
||
| Line 1: | Line 1: | ||
| - | This page presents the program pebble_basic.py, a Mark... algorithm for four disks in a square box of sides 1. | + | This page presents the program pebble_basic.py, a Markov-chain algorithm for a particle on the 3x3 pebble game. |
| __FORCETOC__ | __FORCETOC__ | ||
| Line 6: | Line 6: | ||
| =Program= | =Program= | ||
| import random | import random | ||
| - | + | ||
| neighbor = [[1, 3, 0, 0], [2, 4, 0, 1], [2, 5, 1, 2], | neighbor = [[1, 3, 0, 0], [2, 4, 0, 1], [2, 5, 1, 2], | ||
| [4, 6, 3, 0], [5, 7, 3, 1], [5, 8, 4, 2], | [4, 6, 3, 0], [5, 7, 3, 1], [5, 8, 4, 2], | ||
| Line 18: | Line 18: | ||
| site = neighbor[site][random.randint(0, 3)] | site = neighbor[site][random.randint(0, 3)] | ||
| print site | print site | ||
| + | |||
| =Version= | =Version= | ||
| See history for version information. | See history for version information. | ||
| [[Category:Python]] | [[Category:Python]] | ||
Current revision
This page presents the program pebble_basic.py, a Markov-chain algorithm for a particle on the 3x3 pebble game.
Contents |
[edit]
Description
[edit]
Program
import random
neighbor = [[1, 3, 0, 0], [2, 4, 0, 1], [2, 5, 1, 2],
[4, 6, 3, 0], [5, 7, 3, 1], [5, 8, 4, 2],
[7, 6, 6, 3], [8, 7, 6, 4], [8, 8, 7, 5]]
t_max = 4
site = 8
t = 0
print site
while t < t_max:
t += 1
site = neighbor[site][random.randint(0, 3)]
print site
[edit]
Version
See history for version information.
