Day 22 Complete

Built an entire "game" to solve it
Added a few helper functions
This commit is contained in:
Brian Buller 2016-12-22 12:12:13 -06:00
parent f06d8a6c07
commit 00518970c5
3 changed files with 1519 additions and 0 deletions

990
2016/day22/input Normal file
View File

@ -0,0 +1,990 @@
root@ebhq-gridcenter# df -h
Filesystem Size Used Avail Use%
/dev/grid/node-x0-y0 85T 66T 19T 77%
/dev/grid/node-x0-y1 93T 66T 27T 70%
/dev/grid/node-x0-y2 93T 65T 28T 69%
/dev/grid/node-x0-y3 90T 67T 23T 74%
/dev/grid/node-x0-y4 94T 67T 27T 71%
/dev/grid/node-x0-y5 92T 69T 23T 75%
/dev/grid/node-x0-y6 88T 64T 24T 72%
/dev/grid/node-x0-y7 86T 71T 15T 82%
/dev/grid/node-x0-y8 94T 71T 23T 75%
/dev/grid/node-x0-y9 92T 64T 28T 69%
/dev/grid/node-x0-y10 91T 72T 19T 79%
/dev/grid/node-x0-y11 87T 72T 15T 82%
/dev/grid/node-x0-y12 85T 64T 21T 75%
/dev/grid/node-x0-y13 89T 73T 16T 82%
/dev/grid/node-x0-y14 93T 71T 22T 76%
/dev/grid/node-x0-y15 91T 68T 23T 74%
/dev/grid/node-x0-y16 94T 68T 26T 72%
/dev/grid/node-x0-y17 92T 66T 26T 71%
/dev/grid/node-x0-y18 88T 70T 18T 79%
/dev/grid/node-x0-y19 85T 70T 15T 82%
/dev/grid/node-x0-y20 85T 70T 15T 82%
/dev/grid/node-x0-y21 87T 70T 17T 80%
/dev/grid/node-x0-y22 90T 71T 19T 78%
/dev/grid/node-x0-y23 90T 66T 24T 73%
/dev/grid/node-x0-y24 89T 71T 18T 79%
/dev/grid/node-x0-y25 92T 72T 20T 78%
/dev/grid/node-x1-y0 88T 67T 21T 76%
/dev/grid/node-x1-y1 90T 65T 25T 72%
/dev/grid/node-x1-y2 90T 66T 24T 73%
/dev/grid/node-x1-y3 90T 72T 18T 80%
/dev/grid/node-x1-y4 89T 73T 16T 82%
/dev/grid/node-x1-y5 91T 66T 25T 72%
/dev/grid/node-x1-y6 85T 68T 17T 80%
/dev/grid/node-x1-y7 90T 66T 24T 73%
/dev/grid/node-x1-y8 93T 66T 27T 70%
/dev/grid/node-x1-y9 86T 66T 20T 76%
/dev/grid/node-x1-y10 85T 64T 21T 75%
/dev/grid/node-x1-y11 90T 69T 21T 76%
/dev/grid/node-x1-y12 92T 64T 28T 69%
/dev/grid/node-x1-y13 85T 71T 14T 83%
/dev/grid/node-x1-y14 91T 67T 24T 73%
/dev/grid/node-x1-y15 85T 65T 20T 76%
/dev/grid/node-x1-y16 93T 66T 27T 70%
/dev/grid/node-x1-y17 94T 64T 30T 68%
/dev/grid/node-x1-y18 88T 72T 16T 81%
/dev/grid/node-x1-y19 90T 72T 18T 80%
/dev/grid/node-x1-y20 86T 67T 19T 77%
/dev/grid/node-x1-y21 90T 66T 24T 73%
/dev/grid/node-x1-y22 86T 69T 17T 80%
/dev/grid/node-x1-y23 89T 65T 24T 73%
/dev/grid/node-x1-y24 89T 71T 18T 79%
/dev/grid/node-x1-y25 87T 68T 19T 78%
/dev/grid/node-x2-y0 93T 73T 20T 78%
/dev/grid/node-x2-y1 85T 68T 17T 80%
/dev/grid/node-x2-y2 93T 71T 22T 76%
/dev/grid/node-x2-y3 86T 66T 20T 76%
/dev/grid/node-x2-y4 94T 69T 25T 73%
/dev/grid/node-x2-y5 86T 66T 20T 76%
/dev/grid/node-x2-y6 94T 65T 29T 69%
/dev/grid/node-x2-y7 90T 65T 25T 72%
/dev/grid/node-x2-y8 85T 70T 15T 82%
/dev/grid/node-x2-y9 93T 64T 29T 68%
/dev/grid/node-x2-y10 93T 66T 27T 70%
/dev/grid/node-x2-y11 86T 73T 13T 84%
/dev/grid/node-x2-y12 85T 70T 15T 82%
/dev/grid/node-x2-y13 85T 67T 18T 78%
/dev/grid/node-x2-y14 94T 72T 22T 76%
/dev/grid/node-x2-y15 88T 67T 21T 76%
/dev/grid/node-x2-y16 90T 69T 21T 76%
/dev/grid/node-x2-y17 91T 71T 20T 78%
/dev/grid/node-x2-y18 91T 66T 25T 72%
/dev/grid/node-x2-y19 88T 70T 18T 79%
/dev/grid/node-x2-y20 88T 66T 22T 75%
/dev/grid/node-x2-y21 91T 73T 18T 80%
/dev/grid/node-x2-y22 91T 65T 26T 71%
/dev/grid/node-x2-y23 94T 70T 24T 74%
/dev/grid/node-x2-y24 93T 66T 27T 70%
/dev/grid/node-x2-y25 85T 64T 21T 75%
/dev/grid/node-x3-y0 91T 72T 19T 79%
/dev/grid/node-x3-y1 93T 69T 24T 74%
/dev/grid/node-x3-y2 90T 69T 21T 76%
/dev/grid/node-x3-y3 88T 68T 20T 77%
/dev/grid/node-x3-y4 89T 70T 19T 78%
/dev/grid/node-x3-y5 93T 70T 23T 75%
/dev/grid/node-x3-y6 92T 71T 21T 77%
/dev/grid/node-x3-y7 88T 73T 15T 82%
/dev/grid/node-x3-y8 94T 67T 27T 71%
/dev/grid/node-x3-y9 91T 69T 22T 75%
/dev/grid/node-x3-y10 85T 69T 16T 81%
/dev/grid/node-x3-y11 85T 65T 20T 76%
/dev/grid/node-x3-y12 88T 65T 23T 73%
/dev/grid/node-x3-y13 94T 73T 21T 77%
/dev/grid/node-x3-y14 88T 64T 24T 72%
/dev/grid/node-x3-y15 87T 65T 22T 74%
/dev/grid/node-x3-y16 94T 70T 24T 74%
/dev/grid/node-x3-y17 88T 64T 24T 72%
/dev/grid/node-x3-y18 87T 72T 15T 82%
/dev/grid/node-x3-y19 86T 64T 22T 74%
/dev/grid/node-x3-y20 94T 72T 22T 76%
/dev/grid/node-x3-y21 92T 65T 27T 70%
/dev/grid/node-x3-y22 91T 70T 21T 76%
/dev/grid/node-x3-y23 91T 72T 19T 79%
/dev/grid/node-x3-y24 89T 68T 21T 76%
/dev/grid/node-x3-y25 88T 64T 24T 72%
/dev/grid/node-x4-y0 93T 73T 20T 78%
/dev/grid/node-x4-y1 87T 71T 16T 81%
/dev/grid/node-x4-y2 93T 70T 23T 75%
/dev/grid/node-x4-y3 85T 71T 14T 83%
/dev/grid/node-x4-y4 93T 72T 21T 77%
/dev/grid/node-x4-y5 91T 68T 23T 74%
/dev/grid/node-x4-y6 87T 66T 21T 75%
/dev/grid/node-x4-y7 90T 68T 22T 75%
/dev/grid/node-x4-y8 89T 68T 21T 76%
/dev/grid/node-x4-y9 87T 71T 16T 81%
/dev/grid/node-x4-y10 85T 67T 18T 78%
/dev/grid/node-x4-y11 92T 66T 26T 71%
/dev/grid/node-x4-y12 85T 68T 17T 80%
/dev/grid/node-x4-y13 94T 69T 25T 73%
/dev/grid/node-x4-y14 88T 69T 19T 78%
/dev/grid/node-x4-y15 87T 72T 15T 82%
/dev/grid/node-x4-y16 93T 68T 25T 73%
/dev/grid/node-x4-y17 87T 69T 18T 79%
/dev/grid/node-x4-y18 87T 70T 17T 80%
/dev/grid/node-x4-y19 87T 64T 23T 73%
/dev/grid/node-x4-y20 93T 66T 27T 70%
/dev/grid/node-x4-y21 86T 64T 22T 74%
/dev/grid/node-x4-y22 90T 73T 17T 81%
/dev/grid/node-x4-y23 86T 73T 13T 84%
/dev/grid/node-x4-y24 93T 64T 29T 68%
/dev/grid/node-x4-y25 87T 67T 20T 77%
/dev/grid/node-x5-y0 92T 71T 21T 77%
/dev/grid/node-x5-y1 88T 67T 21T 76%
/dev/grid/node-x5-y2 89T 67T 22T 75%
/dev/grid/node-x5-y3 87T 70T 17T 80%
/dev/grid/node-x5-y4 88T 64T 24T 72%
/dev/grid/node-x5-y5 93T 65T 28T 69%
/dev/grid/node-x5-y6 86T 73T 13T 84%
/dev/grid/node-x5-y7 89T 69T 20T 77%
/dev/grid/node-x5-y8 92T 69T 23T 75%
/dev/grid/node-x5-y9 93T 64T 29T 68%
/dev/grid/node-x5-y10 87T 64T 23T 73%
/dev/grid/node-x5-y11 93T 68T 25T 73%
/dev/grid/node-x5-y12 85T 64T 21T 75%
/dev/grid/node-x5-y13 85T 73T 12T 85%
/dev/grid/node-x5-y14 85T 70T 15T 82%
/dev/grid/node-x5-y15 87T 73T 14T 83%
/dev/grid/node-x5-y16 93T 66T 27T 70%
/dev/grid/node-x5-y17 89T 66T 23T 74%
/dev/grid/node-x5-y18 86T 72T 14T 83%
/dev/grid/node-x5-y19 92T 71T 21T 77%
/dev/grid/node-x5-y20 94T 67T 27T 71%
/dev/grid/node-x5-y21 90T 64T 26T 71%
/dev/grid/node-x5-y22 91T 66T 25T 72%
/dev/grid/node-x5-y23 87T 68T 19T 78%
/dev/grid/node-x5-y24 90T 72T 18T 80%
/dev/grid/node-x5-y25 86T 64T 22T 74%
/dev/grid/node-x6-y0 89T 71T 18T 79%
/dev/grid/node-x6-y1 89T 65T 24T 73%
/dev/grid/node-x6-y2 93T 73T 20T 78%
/dev/grid/node-x6-y3 87T 70T 17T 80%
/dev/grid/node-x6-y4 91T 66T 25T 72%
/dev/grid/node-x6-y5 90T 66T 24T 73%
/dev/grid/node-x6-y6 86T 69T 17T 80%
/dev/grid/node-x6-y7 92T 64T 28T 69%
/dev/grid/node-x6-y8 94T 64T 30T 68%
/dev/grid/node-x6-y9 91T 66T 25T 72%
/dev/grid/node-x6-y10 94T 67T 27T 71%
/dev/grid/node-x6-y11 86T 72T 14T 83%
/dev/grid/node-x6-y12 503T 495T 8T 98%
/dev/grid/node-x6-y13 86T 70T 16T 81%
/dev/grid/node-x6-y14 90T 69T 21T 76%
/dev/grid/node-x6-y15 92T 66T 26T 71%
/dev/grid/node-x6-y16 91T 70T 21T 76%
/dev/grid/node-x6-y17 87T 70T 17T 80%
/dev/grid/node-x6-y18 93T 70T 23T 75%
/dev/grid/node-x6-y19 88T 64T 24T 72%
/dev/grid/node-x6-y20 88T 68T 20T 77%
/dev/grid/node-x6-y21 93T 72T 21T 77%
/dev/grid/node-x6-y22 92T 64T 28T 69%
/dev/grid/node-x6-y23 88T 65T 23T 73%
/dev/grid/node-x6-y24 92T 65T 27T 70%
/dev/grid/node-x6-y25 88T 70T 18T 79%
/dev/grid/node-x7-y0 89T 70T 19T 78%
/dev/grid/node-x7-y1 87T 67T 20T 77%
/dev/grid/node-x7-y2 91T 67T 24T 73%
/dev/grid/node-x7-y3 91T 69T 22T 75%
/dev/grid/node-x7-y4 91T 73T 18T 80%
/dev/grid/node-x7-y5 88T 73T 15T 82%
/dev/grid/node-x7-y6 91T 68T 23T 74%
/dev/grid/node-x7-y7 86T 67T 19T 77%
/dev/grid/node-x7-y8 89T 64T 25T 71%
/dev/grid/node-x7-y9 90T 66T 24T 73%
/dev/grid/node-x7-y10 94T 66T 28T 70%
/dev/grid/node-x7-y11 88T 70T 18T 79%
/dev/grid/node-x7-y12 510T 491T 19T 96%
/dev/grid/node-x7-y13 91T 67T 24T 73%
/dev/grid/node-x7-y14 91T 65T 26T 71%
/dev/grid/node-x7-y15 94T 69T 25T 73%
/dev/grid/node-x7-y16 89T 66T 23T 74%
/dev/grid/node-x7-y17 92T 69T 23T 75%
/dev/grid/node-x7-y18 92T 68T 24T 73%
/dev/grid/node-x7-y19 93T 66T 27T 70%
/dev/grid/node-x7-y20 93T 73T 20T 78%
/dev/grid/node-x7-y21 86T 72T 14T 83%
/dev/grid/node-x7-y22 93T 69T 24T 74%
/dev/grid/node-x7-y23 85T 69T 16T 81%
/dev/grid/node-x7-y24 87T 67T 20T 77%
/dev/grid/node-x7-y25 87T 73T 14T 83%
/dev/grid/node-x8-y0 87T 65T 22T 74%
/dev/grid/node-x8-y1 91T 68T 23T 74%
/dev/grid/node-x8-y2 85T 70T 15T 82%
/dev/grid/node-x8-y3 86T 67T 19T 77%
/dev/grid/node-x8-y4 86T 69T 17T 80%
/dev/grid/node-x8-y5 94T 67T 27T 71%
/dev/grid/node-x8-y6 87T 69T 18T 79%
/dev/grid/node-x8-y7 91T 64T 27T 70%
/dev/grid/node-x8-y8 94T 65T 29T 69%
/dev/grid/node-x8-y9 93T 66T 27T 70%
/dev/grid/node-x8-y10 94T 67T 27T 71%
/dev/grid/node-x8-y11 87T 73T 14T 83%
/dev/grid/node-x8-y12 508T 497T 11T 97%
/dev/grid/node-x8-y13 92T 69T 23T 75%
/dev/grid/node-x8-y14 88T 71T 17T 80%
/dev/grid/node-x8-y15 88T 69T 19T 78%
/dev/grid/node-x8-y16 91T 68T 23T 74%
/dev/grid/node-x8-y17 86T 70T 16T 81%
/dev/grid/node-x8-y18 94T 65T 29T 69%
/dev/grid/node-x8-y19 89T 71T 18T 79%
/dev/grid/node-x8-y20 94T 64T 30T 68%
/dev/grid/node-x8-y21 93T 73T 20T 78%
/dev/grid/node-x8-y22 85T 72T 13T 84%
/dev/grid/node-x8-y23 89T 64T 25T 71%
/dev/grid/node-x8-y24 90T 70T 20T 77%
/dev/grid/node-x8-y25 92T 65T 27T 70%
/dev/grid/node-x9-y0 85T 73T 12T 85%
/dev/grid/node-x9-y1 91T 68T 23T 74%
/dev/grid/node-x9-y2 87T 70T 17T 80%
/dev/grid/node-x9-y3 87T 66T 21T 75%
/dev/grid/node-x9-y4 94T 70T 24T 74%
/dev/grid/node-x9-y5 87T 71T 16T 81%
/dev/grid/node-x9-y6 90T 67T 23T 74%
/dev/grid/node-x9-y7 90T 69T 21T 76%
/dev/grid/node-x9-y8 85T 68T 17T 80%
/dev/grid/node-x9-y9 88T 67T 21T 76%
/dev/grid/node-x9-y10 93T 65T 28T 69%
/dev/grid/node-x9-y11 87T 70T 17T 80%
/dev/grid/node-x9-y12 503T 497T 6T 98%
/dev/grid/node-x9-y13 87T 64T 23T 73%
/dev/grid/node-x9-y14 87T 71T 16T 81%
/dev/grid/node-x9-y15 91T 73T 18T 80%
/dev/grid/node-x9-y16 92T 66T 26T 71%
/dev/grid/node-x9-y17 91T 68T 23T 74%
/dev/grid/node-x9-y18 93T 67T 26T 72%
/dev/grid/node-x9-y19 92T 65T 27T 70%
/dev/grid/node-x9-y20 89T 67T 22T 75%
/dev/grid/node-x9-y21 92T 71T 21T 77%
/dev/grid/node-x9-y22 86T 69T 17T 80%
/dev/grid/node-x9-y23 87T 69T 18T 79%
/dev/grid/node-x9-y24 94T 69T 25T 73%
/dev/grid/node-x9-y25 89T 71T 18T 79%
/dev/grid/node-x10-y0 85T 69T 16T 81%
/dev/grid/node-x10-y1 88T 69T 19T 78%
/dev/grid/node-x10-y2 90T 64T 26T 71%
/dev/grid/node-x10-y3 86T 72T 14T 83%
/dev/grid/node-x10-y4 92T 64T 28T 69%
/dev/grid/node-x10-y5 92T 72T 20T 78%
/dev/grid/node-x10-y6 86T 72T 14T 83%
/dev/grid/node-x10-y7 93T 67T 26T 72%
/dev/grid/node-x10-y8 94T 65T 29T 69%
/dev/grid/node-x10-y9 87T 67T 20T 77%
/dev/grid/node-x10-y10 92T 69T 23T 75%
/dev/grid/node-x10-y11 91T 69T 22T 75%
/dev/grid/node-x10-y12 504T 494T 10T 98%
/dev/grid/node-x10-y13 93T 73T 20T 78%
/dev/grid/node-x10-y14 86T 70T 16T 81%
/dev/grid/node-x10-y15 91T 64T 27T 70%
/dev/grid/node-x10-y16 88T 67T 21T 76%
/dev/grid/node-x10-y17 87T 67T 20T 77%
/dev/grid/node-x10-y18 91T 71T 20T 78%
/dev/grid/node-x10-y19 85T 70T 15T 82%
/dev/grid/node-x10-y20 94T 73T 21T 77%
/dev/grid/node-x10-y21 87T 68T 19T 78%
/dev/grid/node-x10-y22 92T 73T 19T 79%
/dev/grid/node-x10-y23 88T 73T 15T 82%
/dev/grid/node-x10-y24 92T 69T 23T 75%
/dev/grid/node-x10-y25 88T 73T 15T 82%
/dev/grid/node-x11-y0 94T 72T 22T 76%
/dev/grid/node-x11-y1 87T 64T 23T 73%
/dev/grid/node-x11-y2 94T 66T 28T 70%
/dev/grid/node-x11-y3 92T 69T 23T 75%
/dev/grid/node-x11-y4 87T 72T 15T 82%
/dev/grid/node-x11-y5 93T 67T 26T 72%
/dev/grid/node-x11-y6 87T 67T 20T 77%
/dev/grid/node-x11-y7 88T 70T 18T 79%
/dev/grid/node-x11-y8 88T 71T 17T 80%
/dev/grid/node-x11-y9 91T 66T 25T 72%
/dev/grid/node-x11-y10 86T 70T 16T 81%
/dev/grid/node-x11-y11 91T 65T 26T 71%
/dev/grid/node-x11-y12 505T 490T 15T 97%
/dev/grid/node-x11-y13 86T 66T 20T 76%
/dev/grid/node-x11-y14 90T 64T 26T 71%
/dev/grid/node-x11-y15 90T 64T 26T 71%
/dev/grid/node-x11-y16 94T 69T 25T 73%
/dev/grid/node-x11-y17 88T 69T 19T 78%
/dev/grid/node-x11-y18 93T 64T 29T 68%
/dev/grid/node-x11-y19 89T 65T 24T 73%
/dev/grid/node-x11-y20 93T 69T 24T 74%
/dev/grid/node-x11-y21 91T 66T 25T 72%
/dev/grid/node-x11-y22 90T 68T 22T 75%
/dev/grid/node-x11-y23 92T 72T 20T 78%
/dev/grid/node-x11-y24 90T 66T 24T 73%
/dev/grid/node-x11-y25 86T 65T 21T 75%
/dev/grid/node-x12-y0 90T 73T 17T 81%
/dev/grid/node-x12-y1 85T 73T 12T 85%
/dev/grid/node-x12-y2 93T 69T 24T 74%
/dev/grid/node-x12-y3 92T 73T 19T 79%
/dev/grid/node-x12-y4 88T 73T 15T 82%
/dev/grid/node-x12-y5 85T 69T 16T 81%
/dev/grid/node-x12-y6 86T 68T 18T 79%
/dev/grid/node-x12-y7 89T 73T 16T 82%
/dev/grid/node-x12-y8 94T 70T 24T 74%
/dev/grid/node-x12-y9 93T 71T 22T 76%
/dev/grid/node-x12-y10 90T 68T 22T 75%
/dev/grid/node-x12-y11 88T 66T 22T 75%
/dev/grid/node-x12-y12 504T 490T 14T 97%
/dev/grid/node-x12-y13 90T 66T 24T 73%
/dev/grid/node-x12-y14 87T 65T 22T 74%
/dev/grid/node-x12-y15 91T 65T 26T 71%
/dev/grid/node-x12-y16 86T 64T 22T 74%
/dev/grid/node-x12-y17 86T 73T 13T 84%
/dev/grid/node-x12-y18 86T 71T 15T 82%
/dev/grid/node-x12-y19 94T 65T 29T 69%
/dev/grid/node-x12-y20 93T 70T 23T 75%
/dev/grid/node-x12-y21 86T 69T 17T 80%
/dev/grid/node-x12-y22 89T 64T 25T 71%
/dev/grid/node-x12-y23 91T 64T 27T 70%
/dev/grid/node-x12-y24 88T 68T 20T 77%
/dev/grid/node-x12-y25 89T 72T 17T 80%
/dev/grid/node-x13-y0 92T 72T 20T 78%
/dev/grid/node-x13-y1 88T 67T 21T 76%
/dev/grid/node-x13-y2 88T 66T 22T 75%
/dev/grid/node-x13-y3 92T 67T 25T 72%
/dev/grid/node-x13-y4 91T 64T 27T 70%
/dev/grid/node-x13-y5 91T 65T 26T 71%
/dev/grid/node-x13-y6 85T 68T 17T 80%
/dev/grid/node-x13-y7 91T 64T 27T 70%
/dev/grid/node-x13-y8 91T 68T 23T 74%
/dev/grid/node-x13-y9 92T 71T 21T 77%
/dev/grid/node-x13-y10 93T 67T 26T 72%
/dev/grid/node-x13-y11 88T 65T 23T 73%
/dev/grid/node-x13-y12 508T 498T 10T 98%
/dev/grid/node-x13-y13 85T 64T 21T 75%
/dev/grid/node-x13-y14 92T 72T 20T 78%
/dev/grid/node-x13-y15 89T 73T 16T 82%
/dev/grid/node-x13-y16 94T 69T 25T 73%
/dev/grid/node-x13-y17 86T 70T 16T 81%
/dev/grid/node-x13-y18 85T 70T 15T 82%
/dev/grid/node-x13-y19 94T 69T 25T 73%
/dev/grid/node-x13-y20 87T 70T 17T 80%
/dev/grid/node-x13-y21 88T 70T 18T 79%
/dev/grid/node-x13-y22 93T 67T 26T 72%
/dev/grid/node-x13-y23 86T 72T 14T 83%
/dev/grid/node-x13-y24 87T 66T 21T 75%
/dev/grid/node-x13-y25 91T 65T 26T 71%
/dev/grid/node-x14-y0 87T 69T 18T 79%
/dev/grid/node-x14-y1 88T 65T 23T 73%
/dev/grid/node-x14-y2 93T 71T 22T 76%
/dev/grid/node-x14-y3 92T 72T 20T 78%
/dev/grid/node-x14-y4 85T 67T 18T 78%
/dev/grid/node-x14-y5 86T 66T 20T 76%
/dev/grid/node-x14-y6 91T 67T 24T 73%
/dev/grid/node-x14-y7 86T 68T 18T 79%
/dev/grid/node-x14-y8 86T 64T 22T 74%
/dev/grid/node-x14-y9 91T 73T 18T 80%
/dev/grid/node-x14-y10 89T 64T 25T 71%
/dev/grid/node-x14-y11 87T 73T 14T 83%
/dev/grid/node-x14-y12 501T 496T 5T 99%
/dev/grid/node-x14-y13 92T 71T 21T 77%
/dev/grid/node-x14-y14 90T 67T 23T 74%
/dev/grid/node-x14-y15 86T 69T 17T 80%
/dev/grid/node-x14-y16 90T 70T 20T 77%
/dev/grid/node-x14-y17 87T 64T 23T 73%
/dev/grid/node-x14-y18 92T 64T 28T 69%
/dev/grid/node-x14-y19 88T 67T 21T 76%
/dev/grid/node-x14-y20 90T 71T 19T 78%
/dev/grid/node-x14-y21 92T 66T 26T 71%
/dev/grid/node-x14-y22 93T 70T 23T 75%
/dev/grid/node-x14-y23 86T 67T 19T 77%
/dev/grid/node-x14-y24 85T 70T 15T 82%
/dev/grid/node-x14-y25 92T 67T 25T 72%
/dev/grid/node-x15-y0 94T 71T 23T 75%
/dev/grid/node-x15-y1 86T 73T 13T 84%
/dev/grid/node-x15-y2 87T 70T 17T 80%
/dev/grid/node-x15-y3 87T 66T 21T 75%
/dev/grid/node-x15-y4 92T 68T 24T 73%
/dev/grid/node-x15-y5 85T 68T 17T 80%
/dev/grid/node-x15-y6 92T 65T 27T 70%
/dev/grid/node-x15-y7 94T 67T 27T 71%
/dev/grid/node-x15-y8 85T 65T 20T 76%
/dev/grid/node-x15-y9 94T 68T 26T 72%
/dev/grid/node-x15-y10 88T 73T 15T 82%
/dev/grid/node-x15-y11 93T 66T 27T 70%
/dev/grid/node-x15-y12 502T 493T 9T 98%
/dev/grid/node-x15-y13 93T 71T 22T 76%
/dev/grid/node-x15-y14 86T 65T 21T 75%
/dev/grid/node-x15-y15 90T 68T 22T 75%
/dev/grid/node-x15-y16 86T 70T 16T 81%
/dev/grid/node-x15-y17 93T 66T 27T 70%
/dev/grid/node-x15-y18 90T 64T 26T 71%
/dev/grid/node-x15-y19 89T 66T 23T 74%
/dev/grid/node-x15-y20 88T 69T 19T 78%
/dev/grid/node-x15-y21 91T 69T 22T 75%
/dev/grid/node-x15-y22 87T 66T 21T 75%
/dev/grid/node-x15-y23 87T 70T 17T 80%
/dev/grid/node-x15-y24 89T 69T 20T 77%
/dev/grid/node-x15-y25 94T 71T 23T 75%
/dev/grid/node-x16-y0 92T 67T 25T 72%
/dev/grid/node-x16-y1 92T 69T 23T 75%
/dev/grid/node-x16-y2 92T 72T 20T 78%
/dev/grid/node-x16-y3 85T 73T 12T 85%
/dev/grid/node-x16-y4 87T 65T 22T 74%
/dev/grid/node-x16-y5 88T 65T 23T 73%
/dev/grid/node-x16-y6 89T 68T 21T 76%
/dev/grid/node-x16-y7 87T 69T 18T 79%
/dev/grid/node-x16-y8 92T 68T 24T 73%
/dev/grid/node-x16-y9 93T 70T 23T 75%
/dev/grid/node-x16-y10 90T 68T 22T 75%
/dev/grid/node-x16-y11 89T 67T 22T 75%
/dev/grid/node-x16-y12 510T 495T 15T 97%
/dev/grid/node-x16-y13 92T 73T 19T 79%
/dev/grid/node-x16-y14 89T 72T 17T 80%
/dev/grid/node-x16-y15 90T 69T 21T 76%
/dev/grid/node-x16-y16 87T 64T 23T 73%
/dev/grid/node-x16-y17 94T 64T 30T 68%
/dev/grid/node-x16-y18 92T 67T 25T 72%
/dev/grid/node-x16-y19 85T 68T 17T 80%
/dev/grid/node-x16-y20 90T 65T 25T 72%
/dev/grid/node-x16-y21 88T 69T 19T 78%
/dev/grid/node-x16-y22 92T 64T 28T 69%
/dev/grid/node-x16-y23 94T 0T 94T 0%
/dev/grid/node-x16-y24 92T 68T 24T 73%
/dev/grid/node-x16-y25 88T 67T 21T 76%
/dev/grid/node-x17-y0 90T 69T 21T 76%
/dev/grid/node-x17-y1 91T 73T 18T 80%
/dev/grid/node-x17-y2 93T 73T 20T 78%
/dev/grid/node-x17-y3 93T 72T 21T 77%
/dev/grid/node-x17-y4 86T 64T 22T 74%
/dev/grid/node-x17-y5 89T 64T 25T 71%
/dev/grid/node-x17-y6 85T 66T 19T 77%
/dev/grid/node-x17-y7 86T 69T 17T 80%
/dev/grid/node-x17-y8 87T 71T 16T 81%
/dev/grid/node-x17-y9 87T 68T 19T 78%
/dev/grid/node-x17-y10 86T 69T 17T 80%
/dev/grid/node-x17-y11 88T 68T 20T 77%
/dev/grid/node-x17-y12 508T 493T 15T 97%
/dev/grid/node-x17-y13 88T 65T 23T 73%
/dev/grid/node-x17-y14 89T 65T 24T 73%
/dev/grid/node-x17-y15 85T 64T 21T 75%
/dev/grid/node-x17-y16 89T 66T 23T 74%
/dev/grid/node-x17-y17 89T 65T 24T 73%
/dev/grid/node-x17-y18 89T 67T 22T 75%
/dev/grid/node-x17-y19 94T 68T 26T 72%
/dev/grid/node-x17-y20 93T 72T 21T 77%
/dev/grid/node-x17-y21 91T 67T 24T 73%
/dev/grid/node-x17-y22 89T 67T 22T 75%
/dev/grid/node-x17-y23 89T 69T 20T 77%
/dev/grid/node-x17-y24 91T 67T 24T 73%
/dev/grid/node-x17-y25 86T 69T 17T 80%
/dev/grid/node-x18-y0 91T 71T 20T 78%
/dev/grid/node-x18-y1 91T 73T 18T 80%
/dev/grid/node-x18-y2 89T 72T 17T 80%
/dev/grid/node-x18-y3 87T 69T 18T 79%
/dev/grid/node-x18-y4 90T 66T 24T 73%
/dev/grid/node-x18-y5 87T 73T 14T 83%
/dev/grid/node-x18-y6 92T 64T 28T 69%
/dev/grid/node-x18-y7 91T 66T 25T 72%
/dev/grid/node-x18-y8 85T 69T 16T 81%
/dev/grid/node-x18-y9 92T 65T 27T 70%
/dev/grid/node-x18-y10 92T 70T 22T 76%
/dev/grid/node-x18-y11 92T 67T 25T 72%
/dev/grid/node-x18-y12 507T 496T 11T 97%
/dev/grid/node-x18-y13 87T 65T 22T 74%
/dev/grid/node-x18-y14 91T 72T 19T 79%
/dev/grid/node-x18-y15 88T 68T 20T 77%
/dev/grid/node-x18-y16 93T 67T 26T 72%
/dev/grid/node-x18-y17 89T 72T 17T 80%
/dev/grid/node-x18-y18 92T 69T 23T 75%
/dev/grid/node-x18-y19 94T 69T 25T 73%
/dev/grid/node-x18-y20 92T 67T 25T 72%
/dev/grid/node-x18-y21 88T 73T 15T 82%
/dev/grid/node-x18-y22 86T 72T 14T 83%
/dev/grid/node-x18-y23 94T 72T 22T 76%
/dev/grid/node-x18-y24 90T 67T 23T 74%
/dev/grid/node-x18-y25 93T 66T 27T 70%
/dev/grid/node-x19-y0 94T 69T 25T 73%
/dev/grid/node-x19-y1 94T 69T 25T 73%
/dev/grid/node-x19-y2 92T 73T 19T 79%
/dev/grid/node-x19-y3 86T 64T 22T 74%
/dev/grid/node-x19-y4 91T 68T 23T 74%
/dev/grid/node-x19-y5 94T 71T 23T 75%
/dev/grid/node-x19-y6 86T 67T 19T 77%
/dev/grid/node-x19-y7 91T 64T 27T 70%
/dev/grid/node-x19-y8 90T 71T 19T 78%
/dev/grid/node-x19-y9 93T 73T 20T 78%
/dev/grid/node-x19-y10 89T 68T 21T 76%
/dev/grid/node-x19-y11 93T 73T 20T 78%
/dev/grid/node-x19-y12 510T 491T 19T 96%
/dev/grid/node-x19-y13 90T 64T 26T 71%
/dev/grid/node-x19-y14 89T 71T 18T 79%
/dev/grid/node-x19-y15 90T 65T 25T 72%
/dev/grid/node-x19-y16 91T 72T 19T 79%
/dev/grid/node-x19-y17 91T 66T 25T 72%
/dev/grid/node-x19-y18 85T 66T 19T 77%
/dev/grid/node-x19-y19 93T 64T 29T 68%
/dev/grid/node-x19-y20 93T 69T 24T 74%
/dev/grid/node-x19-y21 87T 72T 15T 82%
/dev/grid/node-x19-y22 90T 64T 26T 71%
/dev/grid/node-x19-y23 86T 65T 21T 75%
/dev/grid/node-x19-y24 86T 68T 18T 79%
/dev/grid/node-x19-y25 87T 69T 18T 79%
/dev/grid/node-x20-y0 91T 72T 19T 79%
/dev/grid/node-x20-y1 89T 68T 21T 76%
/dev/grid/node-x20-y2 89T 73T 16T 82%
/dev/grid/node-x20-y3 87T 65T 22T 74%
/dev/grid/node-x20-y4 91T 68T 23T 74%
/dev/grid/node-x20-y5 85T 70T 15T 82%
/dev/grid/node-x20-y6 86T 68T 18T 79%
/dev/grid/node-x20-y7 89T 69T 20T 77%
/dev/grid/node-x20-y8 93T 72T 21T 77%
/dev/grid/node-x20-y9 90T 71T 19T 78%
/dev/grid/node-x20-y10 88T 70T 18T 79%
/dev/grid/node-x20-y11 93T 72T 21T 77%
/dev/grid/node-x20-y12 505T 497T 8T 98%
/dev/grid/node-x20-y13 88T 66T 22T 75%
/dev/grid/node-x20-y14 88T 64T 24T 72%
/dev/grid/node-x20-y15 90T 64T 26T 71%
/dev/grid/node-x20-y16 90T 66T 24T 73%
/dev/grid/node-x20-y17 87T 72T 15T 82%
/dev/grid/node-x20-y18 85T 68T 17T 80%
/dev/grid/node-x20-y19 89T 71T 18T 79%
/dev/grid/node-x20-y20 89T 69T 20T 77%
/dev/grid/node-x20-y21 93T 69T 24T 74%
/dev/grid/node-x20-y22 93T 64T 29T 68%
/dev/grid/node-x20-y23 86T 72T 14T 83%
/dev/grid/node-x20-y24 87T 71T 16T 81%
/dev/grid/node-x20-y25 85T 67T 18T 78%
/dev/grid/node-x21-y0 92T 65T 27T 70%
/dev/grid/node-x21-y1 93T 67T 26T 72%
/dev/grid/node-x21-y2 88T 70T 18T 79%
/dev/grid/node-x21-y3 92T 66T 26T 71%
/dev/grid/node-x21-y4 87T 64T 23T 73%
/dev/grid/node-x21-y5 93T 73T 20T 78%
/dev/grid/node-x21-y6 87T 70T 17T 80%
/dev/grid/node-x21-y7 86T 72T 14T 83%
/dev/grid/node-x21-y8 87T 72T 15T 82%
/dev/grid/node-x21-y9 86T 67T 19T 77%
/dev/grid/node-x21-y10 88T 65T 23T 73%
/dev/grid/node-x21-y11 87T 69T 18T 79%
/dev/grid/node-x21-y12 505T 495T 10T 98%
/dev/grid/node-x21-y13 87T 65T 22T 74%
/dev/grid/node-x21-y14 92T 66T 26T 71%
/dev/grid/node-x21-y15 90T 70T 20T 77%
/dev/grid/node-x21-y16 91T 64T 27T 70%
/dev/grid/node-x21-y17 85T 67T 18T 78%
/dev/grid/node-x21-y18 87T 71T 16T 81%
/dev/grid/node-x21-y19 85T 67T 18T 78%
/dev/grid/node-x21-y20 94T 65T 29T 69%
/dev/grid/node-x21-y21 92T 64T 28T 69%
/dev/grid/node-x21-y22 88T 66T 22T 75%
/dev/grid/node-x21-y23 86T 66T 20T 76%
/dev/grid/node-x21-y24 89T 67T 22T 75%
/dev/grid/node-x21-y25 93T 72T 21T 77%
/dev/grid/node-x22-y0 94T 66T 28T 70%
/dev/grid/node-x22-y1 91T 66T 25T 72%
/dev/grid/node-x22-y2 92T 66T 26T 71%
/dev/grid/node-x22-y3 86T 66T 20T 76%
/dev/grid/node-x22-y4 93T 66T 27T 70%
/dev/grid/node-x22-y5 87T 73T 14T 83%
/dev/grid/node-x22-y6 92T 71T 21T 77%
/dev/grid/node-x22-y7 89T 73T 16T 82%
/dev/grid/node-x22-y8 89T 65T 24T 73%
/dev/grid/node-x22-y9 91T 69T 22T 75%
/dev/grid/node-x22-y10 94T 71T 23T 75%
/dev/grid/node-x22-y11 85T 64T 21T 75%
/dev/grid/node-x22-y12 503T 491T 12T 97%
/dev/grid/node-x22-y13 86T 65T 21T 75%
/dev/grid/node-x22-y14 88T 73T 15T 82%
/dev/grid/node-x22-y15 93T 73T 20T 78%
/dev/grid/node-x22-y16 86T 69T 17T 80%
/dev/grid/node-x22-y17 89T 65T 24T 73%
/dev/grid/node-x22-y18 87T 66T 21T 75%
/dev/grid/node-x22-y19 85T 64T 21T 75%
/dev/grid/node-x22-y20 85T 69T 16T 81%
/dev/grid/node-x22-y21 88T 72T 16T 81%
/dev/grid/node-x22-y22 93T 65T 28T 69%
/dev/grid/node-x22-y23 86T 69T 17T 80%
/dev/grid/node-x22-y24 93T 65T 28T 69%
/dev/grid/node-x22-y25 90T 73T 17T 81%
/dev/grid/node-x23-y0 86T 66T 20T 76%
/dev/grid/node-x23-y1 93T 65T 28T 69%
/dev/grid/node-x23-y2 87T 69T 18T 79%
/dev/grid/node-x23-y3 87T 71T 16T 81%
/dev/grid/node-x23-y4 93T 73T 20T 78%
/dev/grid/node-x23-y5 85T 71T 14T 83%
/dev/grid/node-x23-y6 86T 67T 19T 77%
/dev/grid/node-x23-y7 86T 68T 18T 79%
/dev/grid/node-x23-y8 92T 67T 25T 72%
/dev/grid/node-x23-y9 91T 72T 19T 79%
/dev/grid/node-x23-y10 89T 71T 18T 79%
/dev/grid/node-x23-y11 91T 64T 27T 70%
/dev/grid/node-x23-y12 506T 496T 10T 98%
/dev/grid/node-x23-y13 90T 71T 19T 78%
/dev/grid/node-x23-y14 93T 70T 23T 75%
/dev/grid/node-x23-y15 90T 72T 18T 80%
/dev/grid/node-x23-y16 88T 68T 20T 77%
/dev/grid/node-x23-y17 87T 68T 19T 78%
/dev/grid/node-x23-y18 88T 72T 16T 81%
/dev/grid/node-x23-y19 94T 66T 28T 70%
/dev/grid/node-x23-y20 94T 72T 22T 76%
/dev/grid/node-x23-y21 87T 69T 18T 79%
/dev/grid/node-x23-y22 90T 70T 20T 77%
/dev/grid/node-x23-y23 92T 73T 19T 79%
/dev/grid/node-x23-y24 88T 70T 18T 79%
/dev/grid/node-x23-y25 89T 69T 20T 77%
/dev/grid/node-x24-y0 88T 65T 23T 73%
/dev/grid/node-x24-y1 90T 67T 23T 74%
/dev/grid/node-x24-y2 93T 64T 29T 68%
/dev/grid/node-x24-y3 92T 65T 27T 70%
/dev/grid/node-x24-y4 88T 64T 24T 72%
/dev/grid/node-x24-y5 91T 65T 26T 71%
/dev/grid/node-x24-y6 92T 68T 24T 73%
/dev/grid/node-x24-y7 85T 65T 20T 76%
/dev/grid/node-x24-y8 94T 64T 30T 68%
/dev/grid/node-x24-y9 87T 68T 19T 78%
/dev/grid/node-x24-y10 85T 70T 15T 82%
/dev/grid/node-x24-y11 89T 65T 24T 73%
/dev/grid/node-x24-y12 510T 492T 18T 96%
/dev/grid/node-x24-y13 91T 66T 25T 72%
/dev/grid/node-x24-y14 90T 66T 24T 73%
/dev/grid/node-x24-y15 93T 73T 20T 78%
/dev/grid/node-x24-y16 90T 64T 26T 71%
/dev/grid/node-x24-y17 88T 64T 24T 72%
/dev/grid/node-x24-y18 94T 69T 25T 73%
/dev/grid/node-x24-y19 91T 73T 18T 80%
/dev/grid/node-x24-y20 92T 72T 20T 78%
/dev/grid/node-x24-y21 89T 72T 17T 80%
/dev/grid/node-x24-y22 93T 67T 26T 72%
/dev/grid/node-x24-y23 88T 73T 15T 82%
/dev/grid/node-x24-y24 94T 72T 22T 76%
/dev/grid/node-x24-y25 89T 69T 20T 77%
/dev/grid/node-x25-y0 85T 68T 17T 80%
/dev/grid/node-x25-y1 94T 72T 22T 76%
/dev/grid/node-x25-y2 93T 70T 23T 75%
/dev/grid/node-x25-y3 86T 72T 14T 83%
/dev/grid/node-x25-y4 90T 64T 26T 71%
/dev/grid/node-x25-y5 93T 67T 26T 72%
/dev/grid/node-x25-y6 94T 72T 22T 76%
/dev/grid/node-x25-y7 86T 64T 22T 74%
/dev/grid/node-x25-y8 93T 70T 23T 75%
/dev/grid/node-x25-y9 85T 65T 20T 76%
/dev/grid/node-x25-y10 87T 66T 21T 75%
/dev/grid/node-x25-y11 91T 73T 18T 80%
/dev/grid/node-x25-y12 509T 493T 16T 96%
/dev/grid/node-x25-y13 91T 68T 23T 74%
/dev/grid/node-x25-y14 85T 68T 17T 80%
/dev/grid/node-x25-y15 89T 64T 25T 71%
/dev/grid/node-x25-y16 85T 69T 16T 81%
/dev/grid/node-x25-y17 85T 72T 13T 84%
/dev/grid/node-x25-y18 85T 71T 14T 83%
/dev/grid/node-x25-y19 91T 70T 21T 76%
/dev/grid/node-x25-y20 93T 70T 23T 75%
/dev/grid/node-x25-y21 87T 73T 14T 83%
/dev/grid/node-x25-y22 94T 67T 27T 71%
/dev/grid/node-x25-y23 87T 70T 17T 80%
/dev/grid/node-x25-y24 88T 69T 19T 78%
/dev/grid/node-x25-y25 85T 72T 13T 84%
/dev/grid/node-x26-y0 85T 72T 13T 84%
/dev/grid/node-x26-y1 86T 65T 21T 75%
/dev/grid/node-x26-y2 92T 68T 24T 73%
/dev/grid/node-x26-y3 85T 69T 16T 81%
/dev/grid/node-x26-y4 88T 70T 18T 79%
/dev/grid/node-x26-y5 90T 72T 18T 80%
/dev/grid/node-x26-y6 93T 70T 23T 75%
/dev/grid/node-x26-y7 91T 66T 25T 72%
/dev/grid/node-x26-y8 89T 69T 20T 77%
/dev/grid/node-x26-y9 91T 71T 20T 78%
/dev/grid/node-x26-y10 94T 73T 21T 77%
/dev/grid/node-x26-y11 89T 65T 24T 73%
/dev/grid/node-x26-y12 503T 493T 10T 98%
/dev/grid/node-x26-y13 88T 69T 19T 78%
/dev/grid/node-x26-y14 94T 68T 26T 72%
/dev/grid/node-x26-y15 91T 64T 27T 70%
/dev/grid/node-x26-y16 88T 69T 19T 78%
/dev/grid/node-x26-y17 94T 64T 30T 68%
/dev/grid/node-x26-y18 93T 67T 26T 72%
/dev/grid/node-x26-y19 92T 73T 19T 79%
/dev/grid/node-x26-y20 92T 66T 26T 71%
/dev/grid/node-x26-y21 90T 65T 25T 72%
/dev/grid/node-x26-y22 91T 71T 20T 78%
/dev/grid/node-x26-y23 85T 64T 21T 75%
/dev/grid/node-x26-y24 88T 72T 16T 81%
/dev/grid/node-x26-y25 88T 71T 17T 80%
/dev/grid/node-x27-y0 87T 68T 19T 78%
/dev/grid/node-x27-y1 90T 65T 25T 72%
/dev/grid/node-x27-y2 86T 67T 19T 77%
/dev/grid/node-x27-y3 89T 71T 18T 79%
/dev/grid/node-x27-y4 85T 70T 15T 82%
/dev/grid/node-x27-y5 94T 71T 23T 75%
/dev/grid/node-x27-y6 88T 69T 19T 78%
/dev/grid/node-x27-y7 90T 69T 21T 76%
/dev/grid/node-x27-y8 91T 65T 26T 71%
/dev/grid/node-x27-y9 94T 66T 28T 70%
/dev/grid/node-x27-y10 90T 67T 23T 74%
/dev/grid/node-x27-y11 94T 68T 26T 72%
/dev/grid/node-x27-y12 505T 495T 10T 98%
/dev/grid/node-x27-y13 89T 67T 22T 75%
/dev/grid/node-x27-y14 91T 73T 18T 80%
/dev/grid/node-x27-y15 87T 69T 18T 79%
/dev/grid/node-x27-y16 90T 66T 24T 73%
/dev/grid/node-x27-y17 86T 68T 18T 79%
/dev/grid/node-x27-y18 89T 72T 17T 80%
/dev/grid/node-x27-y19 93T 64T 29T 68%
/dev/grid/node-x27-y20 94T 65T 29T 69%
/dev/grid/node-x27-y21 85T 70T 15T 82%
/dev/grid/node-x27-y22 92T 70T 22T 76%
/dev/grid/node-x27-y23 92T 70T 22T 76%
/dev/grid/node-x27-y24 94T 65T 29T 69%
/dev/grid/node-x27-y25 94T 66T 28T 70%
/dev/grid/node-x28-y0 88T 70T 18T 79%
/dev/grid/node-x28-y1 94T 73T 21T 77%
/dev/grid/node-x28-y2 86T 72T 14T 83%
/dev/grid/node-x28-y3 89T 73T 16T 82%
/dev/grid/node-x28-y4 87T 67T 20T 77%
/dev/grid/node-x28-y5 87T 71T 16T 81%
/dev/grid/node-x28-y6 94T 69T 25T 73%
/dev/grid/node-x28-y7 86T 64T 22T 74%
/dev/grid/node-x28-y8 91T 72T 19T 79%
/dev/grid/node-x28-y9 85T 68T 17T 80%
/dev/grid/node-x28-y10 86T 64T 22T 74%
/dev/grid/node-x28-y11 86T 67T 19T 77%
/dev/grid/node-x28-y12 505T 493T 12T 97%
/dev/grid/node-x28-y13 85T 73T 12T 85%
/dev/grid/node-x28-y14 90T 67T 23T 74%
/dev/grid/node-x28-y15 90T 71T 19T 78%
/dev/grid/node-x28-y16 93T 65T 28T 69%
/dev/grid/node-x28-y17 91T 68T 23T 74%
/dev/grid/node-x28-y18 87T 73T 14T 83%
/dev/grid/node-x28-y19 88T 72T 16T 81%
/dev/grid/node-x28-y20 85T 66T 19T 77%
/dev/grid/node-x28-y21 89T 68T 21T 76%
/dev/grid/node-x28-y22 91T 66T 25T 72%
/dev/grid/node-x28-y23 91T 64T 27T 70%
/dev/grid/node-x28-y24 87T 70T 17T 80%
/dev/grid/node-x28-y25 91T 67T 24T 73%
/dev/grid/node-x29-y0 91T 72T 19T 79%
/dev/grid/node-x29-y1 90T 72T 18T 80%
/dev/grid/node-x29-y2 90T 72T 18T 80%
/dev/grid/node-x29-y3 92T 68T 24T 73%
/dev/grid/node-x29-y4 88T 67T 21T 76%
/dev/grid/node-x29-y5 94T 64T 30T 68%
/dev/grid/node-x29-y6 85T 68T 17T 80%
/dev/grid/node-x29-y7 91T 72T 19T 79%
/dev/grid/node-x29-y8 85T 65T 20T 76%
/dev/grid/node-x29-y9 90T 64T 26T 71%
/dev/grid/node-x29-y10 87T 71T 16T 81%
/dev/grid/node-x29-y11 94T 64T 30T 68%
/dev/grid/node-x29-y12 504T 491T 13T 97%
/dev/grid/node-x29-y13 90T 72T 18T 80%
/dev/grid/node-x29-y14 92T 67T 25T 72%
/dev/grid/node-x29-y15 93T 69T 24T 74%
/dev/grid/node-x29-y16 88T 71T 17T 80%
/dev/grid/node-x29-y17 85T 71T 14T 83%
/dev/grid/node-x29-y18 91T 67T 24T 73%
/dev/grid/node-x29-y19 88T 66T 22T 75%
/dev/grid/node-x29-y20 87T 64T 23T 73%
/dev/grid/node-x29-y21 90T 64T 26T 71%
/dev/grid/node-x29-y22 92T 67T 25T 72%
/dev/grid/node-x29-y23 85T 67T 18T 78%
/dev/grid/node-x29-y24 89T 66T 23T 74%
/dev/grid/node-x29-y25 92T 67T 25T 72%
/dev/grid/node-x30-y0 93T 65T 28T 69%
/dev/grid/node-x30-y1 88T 66T 22T 75%
/dev/grid/node-x30-y2 94T 69T 25T 73%
/dev/grid/node-x30-y3 88T 65T 23T 73%
/dev/grid/node-x30-y4 92T 68T 24T 73%
/dev/grid/node-x30-y5 92T 67T 25T 72%
/dev/grid/node-x30-y6 90T 68T 22T 75%
/dev/grid/node-x30-y7 85T 70T 15T 82%
/dev/grid/node-x30-y8 93T 69T 24T 74%
/dev/grid/node-x30-y9 94T 67T 27T 71%
/dev/grid/node-x30-y10 89T 65T 24T 73%
/dev/grid/node-x30-y11 94T 66T 28T 70%
/dev/grid/node-x30-y12 506T 497T 9T 98%
/dev/grid/node-x30-y13 94T 70T 24T 74%
/dev/grid/node-x30-y14 92T 72T 20T 78%
/dev/grid/node-x30-y15 92T 69T 23T 75%
/dev/grid/node-x30-y16 92T 71T 21T 77%
/dev/grid/node-x30-y17 89T 70T 19T 78%
/dev/grid/node-x30-y18 90T 65T 25T 72%
/dev/grid/node-x30-y19 89T 68T 21T 76%
/dev/grid/node-x30-y20 91T 72T 19T 79%
/dev/grid/node-x30-y21 86T 69T 17T 80%
/dev/grid/node-x30-y22 90T 72T 18T 80%
/dev/grid/node-x30-y23 87T 73T 14T 83%
/dev/grid/node-x30-y24 88T 68T 20T 77%
/dev/grid/node-x30-y25 92T 67T 25T 72%
/dev/grid/node-x31-y0 88T 68T 20T 77%
/dev/grid/node-x31-y1 85T 65T 20T 76%
/dev/grid/node-x31-y2 89T 68T 21T 76%
/dev/grid/node-x31-y3 93T 72T 21T 77%
/dev/grid/node-x31-y4 94T 65T 29T 69%
/dev/grid/node-x31-y5 93T 71T 22T 76%
/dev/grid/node-x31-y6 88T 73T 15T 82%
/dev/grid/node-x31-y7 93T 70T 23T 75%
/dev/grid/node-x31-y8 93T 65T 28T 69%
/dev/grid/node-x31-y9 94T 67T 27T 71%
/dev/grid/node-x31-y10 88T 64T 24T 72%
/dev/grid/node-x31-y11 94T 72T 22T 76%
/dev/grid/node-x31-y12 502T 493T 9T 98%
/dev/grid/node-x31-y13 92T 70T 22T 76%
/dev/grid/node-x31-y14 86T 64T 22T 74%
/dev/grid/node-x31-y15 94T 64T 30T 68%
/dev/grid/node-x31-y16 93T 73T 20T 78%
/dev/grid/node-x31-y17 91T 71T 20T 78%
/dev/grid/node-x31-y18 91T 71T 20T 78%
/dev/grid/node-x31-y19 89T 71T 18T 79%
/dev/grid/node-x31-y20 89T 72T 17T 80%
/dev/grid/node-x31-y21 92T 71T 21T 77%
/dev/grid/node-x31-y22 87T 67T 20T 77%
/dev/grid/node-x31-y23 93T 72T 21T 77%
/dev/grid/node-x31-y24 86T 73T 13T 84%
/dev/grid/node-x31-y25 93T 70T 23T 75%
/dev/grid/node-x32-y0 94T 65T 29T 69%
/dev/grid/node-x32-y1 94T 65T 29T 69%
/dev/grid/node-x32-y2 94T 69T 25T 73%
/dev/grid/node-x32-y3 93T 73T 20T 78%
/dev/grid/node-x32-y4 88T 65T 23T 73%
/dev/grid/node-x32-y5 87T 72T 15T 82%
/dev/grid/node-x32-y6 89T 73T 16T 82%
/dev/grid/node-x32-y7 89T 66T 23T 74%
/dev/grid/node-x32-y8 85T 73T 12T 85%
/dev/grid/node-x32-y9 92T 73T 19T 79%
/dev/grid/node-x32-y10 91T 70T 21T 76%
/dev/grid/node-x32-y11 94T 66T 28T 70%
/dev/grid/node-x32-y12 507T 497T 10T 98%
/dev/grid/node-x32-y13 92T 64T 28T 69%
/dev/grid/node-x32-y14 89T 70T 19T 78%
/dev/grid/node-x32-y15 88T 69T 19T 78%
/dev/grid/node-x32-y16 90T 72T 18T 80%
/dev/grid/node-x32-y17 91T 66T 25T 72%
/dev/grid/node-x32-y18 88T 73T 15T 82%
/dev/grid/node-x32-y19 85T 70T 15T 82%
/dev/grid/node-x32-y20 87T 73T 14T 83%
/dev/grid/node-x32-y21 89T 69T 20T 77%
/dev/grid/node-x32-y22 89T 69T 20T 77%
/dev/grid/node-x32-y23 90T 70T 20T 77%
/dev/grid/node-x32-y24 91T 71T 20T 78%
/dev/grid/node-x32-y25 93T 69T 24T 74%
/dev/grid/node-x33-y0 92T 68T 24T 73%
/dev/grid/node-x33-y1 86T 68T 18T 79%
/dev/grid/node-x33-y2 87T 68T 19T 78%
/dev/grid/node-x33-y3 86T 73T 13T 84%
/dev/grid/node-x33-y4 85T 70T 15T 82%
/dev/grid/node-x33-y5 94T 67T 27T 71%
/dev/grid/node-x33-y6 90T 73T 17T 81%
/dev/grid/node-x33-y7 90T 69T 21T 76%
/dev/grid/node-x33-y8 85T 69T 16T 81%
/dev/grid/node-x33-y9 85T 72T 13T 84%
/dev/grid/node-x33-y10 92T 67T 25T 72%
/dev/grid/node-x33-y11 94T 68T 26T 72%
/dev/grid/node-x33-y12 507T 494T 13T 97%
/dev/grid/node-x33-y13 87T 65T 22T 74%
/dev/grid/node-x33-y14 90T 68T 22T 75%
/dev/grid/node-x33-y15 92T 69T 23T 75%
/dev/grid/node-x33-y16 93T 66T 27T 70%
/dev/grid/node-x33-y17 88T 73T 15T 82%
/dev/grid/node-x33-y18 91T 64T 27T 70%
/dev/grid/node-x33-y19 87T 71T 16T 81%
/dev/grid/node-x33-y20 92T 70T 22T 76%
/dev/grid/node-x33-y21 90T 72T 18T 80%
/dev/grid/node-x33-y22 90T 64T 26T 71%
/dev/grid/node-x33-y23 88T 71T 17T 80%
/dev/grid/node-x33-y24 86T 65T 21T 75%
/dev/grid/node-x33-y25 92T 68T 24T 73%
/dev/grid/node-x34-y0 90T 70T 20T 77%
/dev/grid/node-x34-y1 92T 70T 22T 76%
/dev/grid/node-x34-y2 86T 72T 14T 83%
/dev/grid/node-x34-y3 92T 73T 19T 79%
/dev/grid/node-x34-y4 92T 71T 21T 77%
/dev/grid/node-x34-y5 86T 70T 16T 81%
/dev/grid/node-x34-y6 90T 64T 26T 71%
/dev/grid/node-x34-y7 91T 72T 19T 79%
/dev/grid/node-x34-y8 89T 64T 25T 71%
/dev/grid/node-x34-y9 87T 68T 19T 78%
/dev/grid/node-x34-y10 89T 70T 19T 78%
/dev/grid/node-x34-y11 86T 69T 17T 80%
/dev/grid/node-x34-y12 502T 490T 12T 97%
/dev/grid/node-x34-y13 87T 66T 21T 75%
/dev/grid/node-x34-y14 92T 71T 21T 77%
/dev/grid/node-x34-y15 93T 69T 24T 74%
/dev/grid/node-x34-y16 90T 73T 17T 81%
/dev/grid/node-x34-y17 90T 65T 25T 72%
/dev/grid/node-x34-y18 86T 65T 21T 75%
/dev/grid/node-x34-y19 93T 67T 26T 72%
/dev/grid/node-x34-y20 93T 67T 26T 72%
/dev/grid/node-x34-y21 92T 68T 24T 73%
/dev/grid/node-x34-y22 88T 71T 17T 80%
/dev/grid/node-x34-y23 92T 72T 20T 78%
/dev/grid/node-x34-y24 94T 72T 22T 76%
/dev/grid/node-x34-y25 89T 72T 17T 80%
/dev/grid/node-x35-y0 86T 64T 22T 74%
/dev/grid/node-x35-y1 90T 67T 23T 74%
/dev/grid/node-x35-y2 89T 65T 24T 73%
/dev/grid/node-x35-y3 93T 72T 21T 77%
/dev/grid/node-x35-y4 90T 67T 23T 74%
/dev/grid/node-x35-y5 94T 73T 21T 77%
/dev/grid/node-x35-y6 91T 69T 22T 75%
/dev/grid/node-x35-y7 90T 71T 19T 78%
/dev/grid/node-x35-y8 85T 67T 18T 78%
/dev/grid/node-x35-y9 85T 65T 20T 76%
/dev/grid/node-x35-y10 88T 70T 18T 79%
/dev/grid/node-x35-y11 92T 71T 21T 77%
/dev/grid/node-x35-y12 501T 495T 6T 98%
/dev/grid/node-x35-y13 89T 71T 18T 79%
/dev/grid/node-x35-y14 87T 65T 22T 74%
/dev/grid/node-x35-y15 88T 67T 21T 76%
/dev/grid/node-x35-y16 89T 73T 16T 82%
/dev/grid/node-x35-y17 86T 73T 13T 84%
/dev/grid/node-x35-y18 94T 67T 27T 71%
/dev/grid/node-x35-y19 92T 68T 24T 73%
/dev/grid/node-x35-y20 86T 73T 13T 84%
/dev/grid/node-x35-y21 92T 65T 27T 70%
/dev/grid/node-x35-y22 90T 72T 18T 80%
/dev/grid/node-x35-y23 89T 65T 24T 73%
/dev/grid/node-x35-y24 87T 66T 21T 75%
/dev/grid/node-x35-y25 92T 73T 19T 79%
/dev/grid/node-x36-y0 94T 65T 29T 69%
/dev/grid/node-x36-y1 92T 73T 19T 79%
/dev/grid/node-x36-y2 90T 72T 18T 80%
/dev/grid/node-x36-y3 88T 67T 21T 76%
/dev/grid/node-x36-y4 85T 70T 15T 82%
/dev/grid/node-x36-y5 92T 64T 28T 69%
/dev/grid/node-x36-y6 94T 66T 28T 70%
/dev/grid/node-x36-y7 87T 72T 15T 82%
/dev/grid/node-x36-y8 90T 70T 20T 77%
/dev/grid/node-x36-y9 85T 73T 12T 85%
/dev/grid/node-x36-y10 86T 67T 19T 77%
/dev/grid/node-x36-y11 86T 68T 18T 79%
/dev/grid/node-x36-y12 505T 498T 7T 98%
/dev/grid/node-x36-y13 92T 64T 28T 69%
/dev/grid/node-x36-y14 91T 68T 23T 74%
/dev/grid/node-x36-y15 85T 67T 18T 78%
/dev/grid/node-x36-y16 89T 70T 19T 78%
/dev/grid/node-x36-y17 89T 69T 20T 77%
/dev/grid/node-x36-y18 94T 70T 24T 74%
/dev/grid/node-x36-y19 85T 72T 13T 84%
/dev/grid/node-x36-y20 92T 65T 27T 70%
/dev/grid/node-x36-y21 89T 64T 25T 71%
/dev/grid/node-x36-y22 93T 73T 20T 78%
/dev/grid/node-x36-y23 86T 67T 19T 77%
/dev/grid/node-x36-y24 91T 66T 25T 72%
/dev/grid/node-x36-y25 89T 70T 19T 78%
/dev/grid/node-x37-y0 91T 70T 21T 76%
/dev/grid/node-x37-y1 85T 66T 19T 77%
/dev/grid/node-x37-y2 85T 71T 14T 83%
/dev/grid/node-x37-y3 90T 72T 18T 80%
/dev/grid/node-x37-y4 93T 66T 27T 70%
/dev/grid/node-x37-y5 89T 70T 19T 78%
/dev/grid/node-x37-y6 88T 65T 23T 73%
/dev/grid/node-x37-y7 89T 64T 25T 71%
/dev/grid/node-x37-y8 94T 65T 29T 69%
/dev/grid/node-x37-y9 88T 67T 21T 76%
/dev/grid/node-x37-y10 94T 69T 25T 73%
/dev/grid/node-x37-y11 91T 66T 25T 72%
/dev/grid/node-x37-y12 506T 491T 15T 97%
/dev/grid/node-x37-y13 85T 68T 17T 80%
/dev/grid/node-x37-y14 94T 73T 21T 77%
/dev/grid/node-x37-y15 87T 65T 22T 74%
/dev/grid/node-x37-y16 85T 73T 12T 85%
/dev/grid/node-x37-y17 92T 67T 25T 72%
/dev/grid/node-x37-y18 91T 69T 22T 75%
/dev/grid/node-x37-y19 87T 67T 20T 77%
/dev/grid/node-x37-y20 86T 67T 19T 77%
/dev/grid/node-x37-y21 87T 67T 20T 77%
/dev/grid/node-x37-y22 88T 70T 18T 79%
/dev/grid/node-x37-y23 87T 73T 14T 83%
/dev/grid/node-x37-y24 94T 66T 28T 70%
/dev/grid/node-x37-y25 92T 73T 19T 79%

519
2016/day22/main.go Normal file
View File

@ -0,0 +1,519 @@
package main
import (
"errors"
"fmt"
"math/rand"
"os"
"strings"
"time"
"../../"
"github.com/fatih/color"
termbox "github.com/nsf/termbox-go"
)
func main() {
var inpFn string
var done bool
if inpFn = aoc.GetArgNumber(1); inpFn != "" {
done = true
}
err := termbox.Init()
tWidth, tHeight := termbox.Size()
if err != nil {
fmt.Println("Error initializing termbox")
os.Exit(1)
}
defer termbox.Close()
var menuPos int
cursor := color.New(color.FgBlack).Add(color.BgWhite)
for !done {
fmt.Println(aoc.ClearScreen)
title := color.New(color.FgBlack).Add(color.BgYellow)
title.Println(CenterText("day 22", tWidth))
if menuPos == 0 {
cursor.Println(CenterText("Start Small Game", tWidth))
} else {
fmt.Println(CenterText("Start Small Game", tWidth))
}
if menuPos == 1 {
cursor.Println(CenterText("Start Medium Game", tWidth))
} else {
fmt.Println(CenterText("Start Medium Game", tWidth))
}
if menuPos == 2 {
cursor.Println(CenterText("Start Large Game", tWidth))
} else {
fmt.Println(CenterText("Start Large Game", tWidth))
}
if menuPos == 3 {
cursor.Println(CenterText("Exit", tWidth))
} else {
fmt.Println(CenterText("Exit", tWidth))
}
ev := termbox.PollEvent()
if ev.Type == termbox.EventKey {
switch {
case ev.Key == termbox.KeyArrowUp || ev.Ch == 'k':
menuPos--
case ev.Key == termbox.KeyArrowDown || ev.Ch == 'j':
menuPos++
case ev.Key == termbox.KeyEnter:
done = true
}
}
}
// Default to small game
sizeX, sizeY := 6, 6
switch menuPos {
case 1:
// Generate a medium game
sizeX, sizeY = 10, 10
case 2:
// Generate a large game
sizeX, sizeY = 15, 15
case 3:
return
}
// Create the display
d := CreateDisplay(tWidth, tHeight)
if inpFn != "" {
input := aoc.FileToStringSlice(inpFn)
d.reset(CreateNodesFromInput(input))
} else {
d.reset(GenerateNodesForGrid(sizeX, sizeY))
// Grid is generated, designate one node as start (set used = 0)
stX, stY := rand.Intn(sizeX), rand.Intn(sizeY)
d.nodes[iToLoc(stX, stY)].Used = 0
d.cursX, d.cursY = stX, stY
d.goalX, d.goalY = rand.Intn(sizeX), rand.Intn(sizeY)
d.nodes[iToLoc(d.goalX, d.goalY)].Used = rand.Intn(75)
}
if aoc.ArgIsSet("-1") {
var viablePairs []string
for _, v1 := range d.nodes {
for _, v2 := range d.nodes {
if ok, _ := IsViablePair(v1, v2); ok {
viablePairs = AddViablePair(v1, v2, viablePairs)
}
}
}
fmt.Println("Viable Pairs:", len(viablePairs))
return
}
done = false
for !done {
fmt.Println(aoc.ClearScreen)
d.PrintGrid()
ev := termbox.PollEvent()
if d.goalX == 0 && d.goalY == 0 {
if ev.Type == termbox.EventKey {
done = true
}
} else {
if ev.Type == termbox.EventResize {
d.screenWidth, d.screenHeight = termbox.Size()
} else if ev.Type == termbox.EventKey {
switch {
case ev.Key == termbox.KeyArrowUp || ev.Ch == 'k':
d.resetError()
if d.cursorMode {
d.moveCursorUp()
} else {
d.moveDataDown()
}
case ev.Key == termbox.KeyArrowRight || ev.Ch == 'l':
d.resetError()
if d.cursorMode {
d.moveCursorRight()
} else {
d.moveDataLeft()
}
case ev.Key == termbox.KeyArrowDown || ev.Ch == 'j':
d.resetError()
if d.cursorMode {
d.moveCursorDown()
} else {
d.moveDataUp()
}
case ev.Key == termbox.KeyArrowLeft || ev.Ch == 'h':
d.resetError()
if d.cursorMode {
d.moveCursorLeft()
} else {
d.moveDataRight()
}
case ev.Ch == 'q':
done = true
case ev.Key == termbox.KeySpace:
d.switchMode()
}
}
}
}
}
func GenerateNodesForGrid(w, h int) (map[string]*Node, int, int) {
nodes := make(map[string]*Node)
rand.Seed(time.Now().UTC().UnixNano())
// It doesn't play well if we have totals that are less than half(?) the highest
for y := 0; y <= h; y++ {
for x := 0; x <= w; x++ {
ttl := 20 + rand.Intn(100-20)
used := rand.Intn(ttl)
n := CreateNode(x, y, ttl, used)
nodes[iToLoc(x, y)] = n
}
}
return nodes, w, h
}
// Returns the node map and the max X and max Y values
func CreateNodesFromInput(input []string) (map[string]*Node, int, int) {
nodes := make(map[string]*Node)
var maxX, maxY int
for i := range input {
if input[i] == "" {
continue
}
if input[i][:9] == "/dev/grid" {
var n *Node
var err error
if n, err = CreateNodeFromDfListing(input[i]); err != nil {
fmt.Println(err)
continue
}
nodes[aoc.Itoa(n.X)+";"+aoc.Itoa(n.Y)] = n
if n.X > maxX {
maxX = n.X
}
if n.Y > maxY {
maxY = n.Y
}
}
}
return nodes, maxX, maxY
}
type Display struct {
screenHeight, screenWidth int
cursX, cursY int
goalX, goalY int
maxX, maxY int
errorX, errorY int
nodes map[string]*Node
// Cursor Mode means the user can move the cursor around
// Otherwise the screen locks on the node with 0 used
cursorMode bool
// moveCount tracks how many times we've moved data
moveCount int
message string
}
func CreateDisplay(h, w int) *Display {
d := new(Display)
d.screenHeight = h
d.screenWidth = w
d.errorX, d.errorY = -1, -1
return d
}
func (d *Display) resetError() {
d.errorX, d.errorY = -1, -1
}
func (d *Display) reset(n map[string]*Node, mX, mY int) {
d.nodes = n
d.maxX, d.maxY = mX, mY
d.cursX, d.cursY = 0, 0
d.goalX, d.goalY = d.maxX, 0
d.errorX, d.errorY = -1, -1
d.message = ""
d.cursorMode = true
d.switchMode()
}
func (d *Display) switchMode() {
d.cursorMode = !d.cursorMode
if !d.cursorMode {
// Find the empty node and set the cursor to it
for _, v := range d.nodes {
if v.Used == 0 {
d.cursX, d.cursY = v.X, v.Y
break
}
}
}
}
func (d *Display) moveCursorUp() {
if d.cursY > 0 {
d.cursY--
}
}
func (d *Display) moveCursorRight() {
if d.cursX < d.maxX {
d.cursX++
}
}
func (d *Display) moveCursorDown() {
if d.cursY < d.maxY {
d.cursY++
}
}
func (d *Display) moveCursorLeft() {
if d.cursX > 0 {
d.cursX--
}
}
func (d *Display) moveDataUp() {
if d.cursY >= d.maxY {
d.message = "Invalid Request"
return
}
src := iToLoc(d.cursX, d.cursY+1)
dest := iToLoc(d.cursX, d.cursY)
if ok, err := IsViablePair(d.nodes[src], d.nodes[dest]); ok {
d.nodes[dest].Used = d.nodes[src].Used
d.nodes[src].Used = 0
d.cursY++
d.message = "Data Moved"
d.moveCount++
if src == iToLoc(d.goalX, d.goalY) {
d.goalY--
}
} else {
d.errorX, d.errorY = d.cursX, d.cursY+1
d.message = fmt.Sprintf(
"(%d;%d)[%3d/%3d] (%d;%d)[%3d/%3d] %s",
d.nodes[src].X, d.nodes[src].Y, d.nodes[src].Used, d.nodes[src].Size,
d.nodes[dest].X, d.nodes[dest].Y, d.nodes[dest].Used, d.nodes[dest].Size,
err.Error(),
)
}
}
func (d *Display) moveDataRight() {
if d.cursX <= 0 {
d.message = "Invalid Request"
return
}
src := iToLoc(d.cursX-1, d.cursY)
dest := iToLoc(d.cursX, d.cursY)
if ok, err := IsViablePair(d.nodes[src], d.nodes[dest]); ok {
d.nodes[dest].Used = d.nodes[src].Used
d.nodes[src].Used = 0
d.cursX--
d.message = "Data Moved"
d.moveCount++
if src == iToLoc(d.goalX, d.goalY) {
d.goalX++
}
} else {
d.errorX, d.errorY = d.cursX-1, d.cursY
d.message = fmt.Sprintf(
"(%d;%d)[%3d/%3d] (%d;%d)[%3d/%3d] %s",
d.nodes[src].X, d.nodes[src].Y, d.nodes[src].Used, d.nodes[src].Size,
d.nodes[dest].X, d.nodes[dest].Y, d.nodes[dest].Used, d.nodes[dest].Size,
err.Error(),
)
}
}
func (d *Display) moveDataDown() {
if d.cursY <= 0 {
d.message = "Invalid Request"
return
}
src := iToLoc(d.cursX, d.cursY-1)
dest := iToLoc(d.cursX, d.cursY)
if ok, err := IsViablePair(d.nodes[src], d.nodes[dest]); ok {
d.nodes[dest].Used = d.nodes[src].Used
d.nodes[src].Used = 0
d.cursY--
d.message = "Data Moved"
d.moveCount++
if src == iToLoc(d.goalX, d.goalY) {
d.goalY++
}
} else {
d.errorX, d.errorY = d.cursX, d.cursY-1
d.message = fmt.Sprintf(
"(%d;%d)[%3d/%3d] (%d;%d)[%3d/%3d] %s",
d.nodes[src].X, d.nodes[src].Y, d.nodes[src].Used, d.nodes[src].Size,
d.nodes[dest].X, d.nodes[dest].Y, d.nodes[dest].Used, d.nodes[dest].Size,
err.Error(),
)
}
}
func (d *Display) moveDataLeft() {
if d.cursX >= d.maxX {
d.message = "Invalid Request"
return
}
src := iToLoc(d.cursX+1, d.cursY)
dest := iToLoc(d.cursX, d.cursY)
if ok, err := IsViablePair(d.nodes[src], d.nodes[dest]); ok {
d.nodes[dest].Used = d.nodes[src].Used
d.nodes[src].Used = 0
d.cursX++
d.message = "Data Moved"
d.moveCount++
if src == iToLoc(d.goalX, d.goalY) {
d.goalX--
}
} else {
d.errorX, d.errorY = d.cursX+1, d.cursY
d.message = fmt.Sprintf(
"(%d;%d)[%3d/%3d] (%d;%d)[%3d/%3d] %s",
d.nodes[src].X, d.nodes[src].Y, d.nodes[src].Used, d.nodes[src].Size,
d.nodes[dest].X, d.nodes[dest].Y, d.nodes[dest].Used, d.nodes[dest].Size,
err.Error(),
)
}
}
func (d *Display) PrintGrid() {
cursor := color.New(color.FgBlack).Add(color.BgWhite)
if !d.cursorMode {
cursor = color.New(color.FgBlack).Add(color.BgYellow)
}
goal := color.New(color.FgGreen)
error := color.New(color.FgRed)
df := color.New(color.FgWhite)
if d.goalX == 0 && d.goalY == 0 {
df = color.New(color.FgYellow)
}
// Each cell takes up 9 width
// We can only fit about (d.screenWidth / 9) cells wide
// and d.screenHeight tall
//dispWidth := d.screenWidth / 9
numCellsW := d.screenWidth / 3
leftMost, rightMost := d.cursX-(numCellsW/2), d.cursX+(numCellsW/2)
for leftMost < 0 {
leftMost++
rightMost++
}
if rightMost > d.maxX {
rightMost = d.maxX
}
df.Print(" ")
for j := leftMost; j <= rightMost; j++ {
df.Printf("|%7d|", j)
}
df.Println()
for i := 0; i <= d.maxY; i++ {
df.Printf("|%2d|", i)
for j := leftMost; j <= rightMost; j++ {
n := d.nodes[iToLoc(j, i)]
if j == d.cursX && i == d.cursY {
cursor.Printf("[%3d/%3d]", n.Used, n.Size)
} else if j == d.errorX && i == d.errorY {
error.Printf("[%3d/%3d]", n.Used, n.Size)
} else if j == d.goalX && i == d.goalY {
goal.Printf("[%3d/%3d]", n.Used, n.Size)
} else {
if n != nil {
df.Printf("[%3d/%3d]", n.Used, n.Size)
} else {
df.Print("[ / ]")
}
}
}
df.Println()
}
df.Println(d.message)
df.Println("Moves:", d.moveCount, "Goal Data at:", iToLoc(d.goalX, d.goalY))
if d.cursorMode {
cursor.Println("Cursor Mode")
} else {
cursor.Println("Data Move Mode")
}
df.Println("(q): quit, (space): switch mode")
}
func iToLoc(x, y int) string {
return aoc.Itoa(x) + ";" + aoc.Itoa(y)
}
func AddViablePair(a, b *Node, list []string) []string {
// Make sure this pair isn't already in the list
for i := range list {
if list[i] == a.GetLocString()+"=>"+b.GetLocString() || list[i] == b.GetLocString()+"=>"+a.GetLocString() {
return list
}
}
return append(list, a.GetLocString()+"=>"+b.GetLocString())
}
func IsViablePair(a, b *Node) (bool, error) {
fmt.Println(" Initiating Viable Pair Check:", a.GetLocString(), b.GetLocString())
if a == b {
return false, errors.New("They're the same node")
}
//if a.Used == 0 {
// return false, errors.New(a.GetLocString() + " has no data")
//}
if a.Used > b.Size-b.Used {
return false, errors.New(b.GetLocString() + " doesn't have enough space")
}
return true, nil
}
type Node struct {
X, Y int
Size, Used int
}
func CreateNode(x, y, size, used int) *Node {
n := new(Node)
n.X, n.Y = x, y
n.Size, n.Used = size, used
return n
}
func CreateNodeFromDfListing(inp string) (*Node, error) {
pts := strings.Fields(inp)
if len(pts) != 5 {
return nil, errors.New("Error Creating Node: Invalid DF Listing")
}
n := new(Node)
parseLoc := strings.Split(pts[0], "-")
if parseLoc[1][0] == 'x' {
n.X = aoc.Atoi(parseLoc[1][1:])
}
if parseLoc[2][0] == 'y' {
n.Y = aoc.Atoi(parseLoc[2][1:])
}
n.Size = aoc.Atoi(strings.TrimSuffix(pts[1], "T"))
n.Used = aoc.Atoi(strings.TrimSuffix(pts[2], "T"))
return n, nil
}
func (n *Node) GetLocString() string {
return aoc.Itoa(n.X) + ";" + aoc.Itoa(n.Y)
}
func (n *Node) ToString() string {
return fmt.Sprint("[", n.GetLocString(), "](S:", aoc.Itoa(n.Size), ";A:", aoc.Itoa(n.Size-n.Used), ";U:", aoc.Itoa(n.Used), ")")
}
func CenterText(txt string, width int) string {
width -= len(txt)
return strings.Repeat(" ", width/2) + txt + strings.Repeat(" ", width/2)
}

View File

@ -26,7 +26,13 @@ func GetArgValue(a string) string {
} }
} }
return "" return ""
}
func GetArgNumber(i int) string {
if len(os.Args) > i {
return os.Args[i]
}
return ""
} }
func StdinToStringSlice() []string { func StdinToStringSlice() []string {
@ -60,6 +66,10 @@ func StdinToString() string {
return input return input
} }
func FileToStringSlice(fn string) []string {
return strings.Split(string(FileToBytes(fn)), "\n")
}
func FileToString(fn string) string { func FileToString(fn string) string {
return string(FileToBytes(fn)) return string(FileToBytes(fn))
} }