In [1]:
from Base_Question import make_num_grid,near_me_num,Meathead_Movers,colorful
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
from IPython.display import Image
from IPython.display import HTML
from IPython.display import IFrame


[[1 1 1]
 [2 2 2]
 [1 1 1]]
[[2 2 1]
 [1 1 1]
 [2 1 1]]
:0: FutureWarning: IPython widgets are experimental and may change in the future.

In [2]:
grid1 = make_num_grid(100,100,50,50)
near1 = near_me_num(grid1,50)
i = 0

This box may need to be run multiple times. The loop is designed to stop when the lengths of the moving arrays is equal. So if you see they're equal at a high number, run it again. It goes really quick.


In [3]:
while len(near1[3]) > 0 and len(near1[2]) > 0:
    near1 = near_me_num(grid1,50)
    grid1 = Meathead_Movers(*near1)
    print (len(near1[2]), len(near1[3]))
    i+=1
    if len(near1[2]) == len(near1[3]):
        break


3050 3077
2729 2756
2380 2378
2057 2076
1759 1816
1491 1543
1270 1325
1102 1148
948 971
834 876
737 798
650 700
588 634
537 573
505 541
470 505
439 470
413 446
382 431
356 394
329 366
307 358
292 336
274 320
265 296
247 290
233 278
229 267
223 259
210 252
205 245
188 241
192 232
191 227
188 226
181 218
179 214
170 207
171 216
166 207
166 209
165 207
162 202
165 208
159 208
154 197
150 197
160 197
163 190
163 190
161 184
151 186
145 177
143 175
145 172
142 170
146 167
143 175
141 172
146 166
142 165
135 157
134 148
135 154
130 146
124 153
123 144
114 137
93 134
96 130
95 128
94 132
88 131
89 122
85 123
93 122
95 134
95 131
83 126
80 110
84 126
85 121
78 123
82 119
83 118
84 117
85 121
83 124
77 109
74 112
73 104
73 108
68 108
68 111
72 115
67 111
68 106
64 103
69 113
68 97
68 102
63 98
58 94
57 103
55 95
58 94
58 89
59 91
63 92
64 95
65 97
66 103
61 95
61 84
71 95
68 96
70 94
70 96
66 96
76 93
70 99
69 90
65 88
59 83
57 86
49 76
47 74
51 71
54 78
54 80
51 72
59 77
56 84
56 81
60 82
56 79
56 81
53 78
54 77
54 79
47 73
49 71
51 76
55 80
53 81
54 74
49 77
43 70
40 74
41 67
38 69
41 67
40 72
44 71
40 73
33 61
34 63
37 61
41 66
40 64
37 62
34 54
34 59
33 57
35 56
36 55
31 55
35 54
36 54
37 57
37 57
34 53
27 43
27 45
29 45
30 51
27 48
29 41
30 43
30 47
33 50
35 47
36 48
34 53
32 53
30 47
34 49
31 48
30 45
31 49
28 45
30 46
32 48
31 46
34 51
37 53
36 49
33 47
35 52
37 50
34 51
30 48
31 49
33 50
34 50
34 51
33 49
32 48
33 50
36 48
36 49
36 51
34 54
39 56
35 55
31 55
29 47
31 45
30 45
32 46
29 47
30 48
31 48
30 47
31 46
35 49
35 52
28 44
25 43
25 41
27 41
30 41
28 45
29 49
24 44
28 45
28 43
25 44
28 46
29 45
31 44
29 42
30 47
32 46
35 48
33 46
33 49
36 45
39 52
39 54
37 51
38 49
37 48
40 51
43 52
42 52
40 50
40 48
42 50
42 50
38 44
37 43
39 43
42 48
42 48
41 47
42 46
43 46
43 44
44 45
45 46
45 46
47 47

In [4]:
colorful(grid1)


Out[4]:

In [5]:
print (i)


273

In [6]:
Loops = [5.5,25.5,32,40,65.25,58,61.75,81,117,94.5,96.25,139.2,163,145.5,132.25,223,166.75,215.75,308.25,151.25]
Size = np.arange(5,105,5)

In [7]:
plt.figure(figsize=(15,5))
plt.grid(True)
plt.plot(Size,Loops)
ax = plt.gca()
plt.title("Loops vs Size")
plt.xlabel("Size")
plt.ylabel("Loops")
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.get_xaxis().tick_bottom()
ax.get_yaxis().tick_left()



In [8]:
Image(url = 'http://ej.iop.org/images/1742-5468/2008/07/L07002/Full/8568503.jpg', width = 500, height = 500)


Out[8]:

In [9]:
grid2 = make_num_grid(100,2,50,50)
near2 = near_me_num(grid2,50)
i = 0

In [11]:
while len(near2[3]) > 0 and len(near2[2]) > 0:
    near2 = near_me_num(grid2,50)
    grid2 = Meathead_Movers(*near2)
    print (len(near2[2]), len(near2[3]))
    i+=1
    if len(near2[2]) == len(near2[3]):
        break


17 21
5 9
0 1

In [12]:
colorful(grid2)


Out[12]:

In [13]:
Image(url='http://complexity.stanford.edu/wp-content/uploads/2014/06/chicagodots_race_lines.jpg', height = 500,width = 500)


Out[13]:

In [ ]: