Skip to content

Instantly share code, notes, and snippets.

@jczaplew
Last active October 20, 2015 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jczaplew/45dd58741d39adfd9dc2 to your computer and use it in GitHub Desktop.
Save jczaplew/45dd58741d39adfd9dc2 to your computer and use it in GitHub Desktop.
Brute Force
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width" charset="utf-8">
<title>Brute force</title>
<style>
body {
padding: 0;
margin: 0;
}
.iterations {
stroke-width: 2;
stroke: red;
opacity:0;
}
.xaxis text {
font: 10px sans-serif;
}
.xaxis path,
.xaxis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.title {
font-size: 50px;
fill: #ddd;
}
.currentLng {
fill: #aaa;
}
</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/async/1.4.2/async.js"></script>
<script>
var width = 900;
var height = 800;
var padding = 40;
var x = d3.scale.linear()
.domain([0, 360])
.range([0, width - padding]);
var svg = d3.select('body')
.append('svg')
.attr('height', height)
.attr('width', width);
var title = svg.append('g')
.append('text')
.attr('class', 'title')
.attr('x', width/2 - padding * 2)
.attr('y', 200);
var currentLng = svg.append('g')
.append('text')
.attr('class', 'currentLng')
.attr('x', width/2 - 20)
.attr('y', 250);
var xAxis = d3.svg.axis()
.scale(x)
.tickValues([0, 45, 90, 180, 360])
.orient('bottom');
svg.append('g')
.attr('class', 'xaxis')
.attr('transform', 'translate(' + padding/2 + ', ' + height/2 + ')')
.call(xAxis)
d3.json('iterations.json', function(error, data) {
async.eachLimit(Object.keys(data), 1, function(key, callback) {
title.text(key.split('_').join(' \u2014 '));
var iterations = svg.selectAll('.iterations')
.data(data[key])
.enter().append('line')
.attr('class', 'iterations')
.attr('x1', function(d) { return x(d) + padding/2 })
.attr('y1', 0)
.attr('x2', function(d) { return x(d) + padding/2 })
.attr('y2', 20)
var n = 0;
iterations.transition()
.duration(4000)
.delay(function(d, i) { return (i * 1000)})
.style('opacity', 1)
.attr('stroke-width', 10)
.attr('y1', (height/2 - 20))
.attr('x2', function(d) { return x(d) + padding/2 })
.attr('y2', (height/2))
.each(function(d) { ++n; })
.each('end', function(d) { currentLng.text(d); if (!--n) remove() });
function remove() {
iterations.remove();
callback()
}
}, function(error) {
console.log('done');
});
});
</script>
</body>
<html>
{"-90_-85":[180,null],"-85_-80":[180,90,45,67.5,78.75,73.125,70.3125,71.71875,72.421875,72.0703125,71.89453125,71.982421875,72.0263671875,72.00439453125,71.993408203125,71.9989013671875,72.00164794921875,72.00027465820312,71.99958801269531,71.99993133544922,72.00010299682617,72.0000171661377,71.99997425079346,71.99999570846558,72.00000643730164,72.0000010728836,71.99999839067459,71.9999997317791,72.00000040233135,72.00000006705523,71.99999989941716,71.9999999832362,72.00000002514571,72.00000000419095,71.99999999371357,71.99999999895226],"-80_-75":[180,90,45,22.5,33.75,39.375,42.1875,40.78125,40.078125,39.7265625,39.90234375,39.990234375,40.0341796875,40.01220703125,40.001220703125,39.9957275390625,39.99847412109375,39.999847412109375,40.00053405761719,40.00019073486328,40.00001907348633,39.99993324279785,39.99997615814209,39.99999761581421,40.00000834465027,40.00000298023224,40.000000298023224,39.999998956918716,39.99999962747097,39.9999999627471,40.00000013038516,40.00000004656613,40.00000000465661,39.999999983701855,39.999999994179234,39.99999999941792],"-75_-70":[180,90,45,22.5,33.75,28.125,25.3125,26.71875,27.421875,27.7734375,27.59765625,27.685546875,27.7294921875,27.70751953125,27.696533203125,27.6910400390625,27.69378662109375,27.692413330078125,27.691726684570312,27.69207000732422,27.692241668701172,27.69232749938965,27.69228458404541,27.69230604171753,27.69231677055359,27.69231140613556,27.692308723926544,27.692307382822037,27.69230805337429,27.692307718098164,27.6923075504601,27.692307634279132,27.692307676188648,27.692307697143406,27.692307686666027,27.692307691904716],"-70_-65":[180,90,45,22.5,11.25,16.875,19.6875,21.09375,21.796875,21.4453125,21.26953125,21.181640625,21.1376953125,21.15966796875,21.170654296875,21.1761474609375,21.17889404296875,21.177520751953125,21.176834106445312,21.176490783691406,21.176319122314453,21.17640495300293,21.176447868347168,21.176469326019287,21.176480054855347,21.176474690437317,21.176472008228302,21.176470667123795,21.17646999657154,21.176470331847668,21.17647049948573,21.176470583304763,21.17647062521428,21.17647060425952,21.176470593782142,21.176470588543452],"-65_-60":[180,90,45,22.5,11.25,16.875,19.6875,18.28125,17.578125,17.9296875,18.10546875,18.017578125,17.9736328125,17.99560546875,18.006591796875,18.0010986328125,17.99835205078125,17.999725341796875,18.000411987304688,18.00006866455078,17.999897003173828,17.999982833862305,18.000025749206543,18.000004291534424,17.999993562698364,17.999998927116394,18.00000160932541,18.0000002682209,17.999999597668648,17.999999932944775,18.000000100582838,18.000000016763806,17.99999997485429,17.99999999580905,18.000000006286427,18.000000001047738,17.999999998428393,17.999999999738066],"-60_-55":[180,90,45,22.5,11.25,16.875,14.0625,15.46875,16.171875,15.8203125,15.64453125,15.732421875,15.6884765625,15.66650390625,15.655517578125,15.6500244140625,15.65277099609375,15.651397705078125,15.652084350585938,15.652427673339844,15.65225601196289,15.652170181274414,15.652213096618652,15.652191638946533,15.652180910110474,15.652175545692444,15.652172863483429,15.652174204587936,15.652173534035683,15.65217386931181,15.652174036949873,15.652173953130841,15.652173911221325,15.652173932176083,15.652173921698704,15.652173916460015,15.65217391384067,15.652173912530998,15.652173913185834],"-55_-50":[180,90,45,22.5,11.25,16.875,14.0625,12.65625,13.359375,13.0078125,13.18359375,13.271484375,13.3154296875,13.33740234375,13.326416015625,13.3319091796875,13.33465576171875,13.333282470703125,13.333969116210938,13.333625793457031,13.333454132080078,13.333368301391602,13.333325386047363,13.333346843719482,13.333336114883423,13.333330750465393,13.333333432674408,13.3333320915699,13.333332762122154,13.333333097398281,13.333333265036345,13.333333348855376,13.33333330694586,13.333333327900618,13.333333338377997,13.333333333139308],"-50_-45":[180,90,45,22.5,11.25,16.875,14.0625,12.65625,11.953125,12.3046875,12.12890625,12.041015625,11.9970703125,12.01904296875,12.008056640625,12.0025634765625,11.99981689453125,12.001190185546875,12.000503540039062,12.000160217285156,11.999988555908203,12.00007438659668,12.000031471252441,12.000010013580322,11.999999284744263,12.000004649162292,12.000001966953278,12.00000062584877,11.999999955296516,12.000000290572643,12.00000012293458,12.000000039115548,11.999999997206032,12.00000001816079,12.000000007683411,12.000000002444722,11.999999999825377],"-45_-40":[180,90,45,22.5,11.25],"-40_-35":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,10.546875,10.1953125,10.37109375,10.283203125,10.3271484375,10.30517578125,10.294189453125,10.2886962890625,10.28594970703125,10.284576416015625,10.285263061523438,10.285606384277344,10.285778045654297,10.28569221496582,10.285735130310059,10.28571367263794,10.285724401473999,10.28571903705597,10.285716354846954,10.285715013742447,10.285714343190193,10.285714007914066,10.28571417555213,10.285714259371161,10.285714301280677,10.28571428032592,10.285714290803298,10.285714285564609],"-35_-30":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,9.140625,9.4921875,9.66796875,9.755859375,9.7119140625,9.73388671875,9.722900390625,9.7283935546875,9.73114013671875,9.729766845703125,9.729080200195312,9.729423522949219,9.729595184326172,9.729681015014648,9.729723930358887,9.729745388031006,9.729734659194946,9.729729294776917,9.729731976985931,9.729730635881424,9.72972996532917,9.729729630053043,9.729729797691107,9.729729713872075,9.729729755781591,9.729729734826833,9.729729724349454,9.729729729588144],"-30_-25":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,9.140625,9.4921875,9.31640625,9.228515625,9.2724609375,9.25048828125,9.239501953125,9.2340087890625,9.23126220703125,9.229888916015625,9.230575561523438,9.230918884277344,9.23074722290039,9.230833053588867,9.230790138244629,9.23076868057251,9.23077940940857,9.23077404499054,9.230771362781525,9.230770021677017,9.230769351124763,9.230769015848637,9.2307691834867,9.230769267305732,9.230769225396216,9.230769246350974,9.230769235873595,9.230769230634905],"-25_-20":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,9.140625,8.7890625,8.61328125,8.701171875,8.7451171875,8.76708984375,8.778076171875,8.7835693359375,8.78082275390625,8.779449462890625,8.780136108398438,8.780479431152344,8.780651092529297,8.78056526184082,8.780522346496582,8.780500888824463,8.780490159988403,8.780484795570374,8.780487477779388,8.780488818883896,8.780488148331642,8.780487813055515,8.780487645417452,8.780487729236484,8.780487771146,8.780487792100757,8.780487802578136,8.780487807816826,8.780487805197481,8.780487803887809,8.780487804542645,8.780487804870063],"-20_-15":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,9.140625,8.7890625,8.61328125,8.525390625,8.5693359375,8.59130859375,8.580322265625,8.5748291015625,8.57208251953125,8.570709228515625,8.571395874023438,8.571739196777344,8.57156753540039,8.571481704711914,8.571438789367676,8.571417331695557,8.571428060531616,8.571433424949646,8.571430742740631,8.571429401636124,8.57142873108387,8.571428395807743,8.571428563445807,8.571428647264838,8.571428605355322,8.571428584400564,8.571428573923185,8.571428568684496,8.57142857130384],"-15_-10":[180,90,45,22.5,11.25,5.625,8.4375,7.03125,7.734375,8.0859375,8.26171875,8.349609375,8.3935546875,8.37158203125,8.382568359375,8.3770751953125,8.37432861328125,8.372955322265625,8.372268676757812,8.371925354003906,8.37209701538086,8.372011184692383,8.372054100036621,8.37207555770874,8.3720862865448,8.37209165096283,8.372094333171844,8.372092992067337,8.37209366261959,8.372093327343464,8.3720931597054,8.372093075886369,8.372093033976853,8.372093013022095,8.372093023499474,8.372093018260784,8.37209302088013,8.372093022189802,8.372093022844638,8.372093023172056],"-10_-5":[180,90,45,22.5,11.25,5.625,8.4375,7.03125,7.734375,8.0859375,8.26171875,8.173828125,8.2177734375,8.19580078125,8.184814453125,8.1793212890625,8.18206787109375,8.180694580078125,8.181381225585938,8.181724548339844,8.181896209716797,8.18181037902832,8.181853294372559,8.18183183670044,8.18182110786438,8.18181574344635,8.181818425655365,8.181817084550858,8.181817755103111,8.181818090379238,8.181818258017302,8.18181817419827,8.181818216107786,8.181818195153028,8.181818184675649,8.18181817943696,8.181818182056304,8.181818180746632,8.181818181401468,8.181818181728886],"-5_0":[180,90,45,22.5,11.25,5.625,8.4375,7.03125,7.734375,8.0859375,8.26171875,8.173828125,8.2177734375,8.19580078125,8.184814453125,8.1793212890625,8.18206787109375,8.180694580078125,8.181381225585938,8.181724548339844,8.181896209716797,8.18181037902832,8.181853294372559,8.18183183670044,8.18182110786438,8.18181574344635,8.181818425655365,8.181817084550858,8.181817755103111,8.181818090379238,8.181818258017302,8.18181817419827,8.181818216107786,8.181818195153028,8.181818184675649,8.18181817943696,8.181818182056304,8.181818180746632,8.181818181401468,8.181818181728886],"0_5":[180,90,45,22.5,11.25,5.625,8.4375,7.03125,7.734375,8.0859375,8.26171875,8.173828125,8.2177734375,8.19580078125,8.184814453125,8.1793212890625,8.18206787109375,8.180694580078125,8.181381225585938,8.181724548339844,8.181896209716797,8.18181037902832,8.181853294372559,8.18183183670044,8.18182110786438,8.18181574344635,8.181818425655365,8.181817084550858,8.181817755103111,8.181818090379238,8.181818258017302,8.18181817419827,8.181818216107786,8.181818195153028,8.181818184675649,8.18181817943696,8.181818182056304,8.181818180746632,8.181818181401468,8.181818181728886],"5_10":[180,90,45,22.5,11.25,5.625,8.4375,7.03125,7.734375,8.0859375,8.26171875,8.173828125,8.2177734375,8.19580078125,8.184814453125,8.1793212890625,8.18206787109375,8.180694580078125,8.181381225585938,8.181724548339844,8.181896209716797,8.18181037902832,8.181853294372559,8.18183183670044,8.18182110786438,8.18181574344635,8.181818425655365,8.181817084550858,8.181817755103111,8.181818090379238,8.181818258017302,8.18181817419827,8.181818216107786,8.181818195153028,8.181818184675649,8.18181817943696,8.181818182056304,8.181818180746632,8.181818181401468,8.181818181728886],"10_15":[180,90,45,22.5,11.25,5.625,8.4375,7.03125,7.734375,8.0859375,8.26171875,8.349609375,8.3935546875,8.37158203125,8.382568359375,8.3770751953125,8.37432861328125,8.372955322265625,8.372268676757812,8.371925354003906,8.37209701538086,8.372011184692383,8.372054100036621,8.37207555770874,8.3720862865448,8.37209165096283,8.372094333171844,8.372092992067337,8.37209366261959,8.372093327343464,8.3720931597054,8.372093075886369,8.372093033976853,8.372093013022095,8.372093023499474,8.372093018260784,8.37209302088013,8.372093022189802,8.372093022844638,8.372093023172056],"15_20":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,9.140625,8.7890625,8.61328125,8.525390625,8.5693359375,8.59130859375,8.580322265625,8.5748291015625,8.57208251953125,8.570709228515625,8.571395874023438,8.571739196777344,8.57156753540039,8.571481704711914,8.571438789367676,8.571417331695557,8.571428060531616,8.571433424949646,8.571430742740631,8.571429401636124,8.57142873108387,8.571428395807743,8.571428563445807,8.571428647264838,8.571428605355322,8.571428584400564,8.571428573923185,8.571428568684496,8.57142857130384],"20_25":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,9.140625,8.7890625,8.61328125,8.701171875,8.7451171875,8.76708984375,8.778076171875,8.7835693359375,8.78082275390625,8.779449462890625,8.780136108398438,8.780479431152344,8.780651092529297,8.78056526184082,8.780522346496582,8.780500888824463,8.780490159988403,8.780484795570374,8.780487477779388,8.780488818883896,8.780488148331642,8.780487813055515,8.780487645417452,8.780487729236484,8.780487771146,8.780487792100757,8.780487802578136,8.780487807816826,8.780487805197481,8.780487803887809,8.780487804542645,8.780487804870063],"25_30":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,9.140625,9.4921875,9.31640625,9.228515625,9.2724609375,9.25048828125,9.239501953125,9.2340087890625,9.23126220703125,9.229888916015625,9.230575561523438,9.230918884277344,9.23074722290039,9.230833053588867,9.230790138244629,9.23076868057251,9.23077940940857,9.23077404499054,9.230771362781525,9.230770021677017,9.230769351124763,9.230769015848637,9.2307691834867,9.230769267305732,9.230769225396216,9.230769246350974,9.230769235873595,9.230769230634905],"30_35":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,9.140625,9.4921875,9.66796875,9.755859375,9.7119140625,9.73388671875,9.722900390625,9.7283935546875,9.73114013671875,9.729766845703125,9.729080200195312,9.729423522949219,9.729595184326172,9.729681015014648,9.729723930358887,9.729745388031006,9.729734659194946,9.729729294776917,9.729731976985931,9.729730635881424,9.72972996532917,9.729729630053043,9.729729797691107,9.729729713872075,9.729729755781591,9.729729734826833,9.729729724349454,9.729729729588144],"35_40":[180,90,45,22.5,11.25,5.625,8.4375,9.84375,10.546875,10.1953125,10.37109375,10.283203125,10.3271484375,10.30517578125,10.294189453125,10.2886962890625,10.28594970703125,10.284576416015625,10.285263061523438,10.285606384277344,10.285778045654297,10.28569221496582,10.285735130310059,10.28571367263794,10.285724401473999,10.28571903705597,10.285716354846954,10.285715013742447,10.285714343190193,10.285714007914066,10.28571417555213,10.285714259371161,10.285714301280677,10.28571428032592,10.285714290803298,10.285714285564609],"40_45":[180,90,45,22.5,11.25],"45_50":[180,90,45,22.5,11.25,16.875,14.0625,12.65625,11.953125,12.3046875,12.12890625,12.041015625,11.9970703125,12.01904296875,12.008056640625,12.0025634765625,11.99981689453125,12.001190185546875,12.000503540039062,12.000160217285156,11.999988555908203,12.00007438659668,12.000031471252441,12.000010013580322,11.999999284744263,12.000004649162292,12.000001966953278,12.00000062584877,11.999999955296516,12.000000290572643,12.00000012293458,12.000000039115548,11.999999997206032,12.00000001816079,12.000000007683411,12.000000002444722,11.999999999825377],"50_55":[180,90,45,22.5,11.25,16.875,14.0625,12.65625,13.359375,13.0078125,13.18359375,13.271484375,13.3154296875,13.33740234375,13.326416015625,13.3319091796875,13.33465576171875,13.333282470703125,13.333969116210938,13.333625793457031,13.333454132080078,13.333368301391602,13.333325386047363,13.333346843719482,13.333336114883423,13.333330750465393,13.333333432674408,13.3333320915699,13.333332762122154,13.333333097398281,13.333333265036345,13.333333348855376,13.33333330694586,13.333333327900618,13.333333338377997,13.333333333139308],"55_60":[180,90,45,22.5,11.25,16.875,14.0625,15.46875,16.171875,15.8203125,15.64453125,15.732421875,15.6884765625,15.66650390625,15.655517578125,15.6500244140625,15.65277099609375,15.651397705078125,15.652084350585938,15.652427673339844,15.65225601196289,15.652170181274414,15.652213096618652,15.652191638946533,15.652180910110474,15.652175545692444,15.652172863483429,15.652174204587936,15.652173534035683,15.65217386931181,15.652174036949873,15.652173953130841,15.652173911221325,15.652173932176083,15.652173921698704,15.652173916460015,15.65217391384067,15.652173912530998,15.652173913185834],"60_65":[180,90,45,22.5,11.25,16.875,19.6875,18.28125,17.578125,17.9296875,18.10546875,18.017578125,17.9736328125,17.99560546875,18.006591796875,18.0010986328125,17.99835205078125,17.999725341796875,18.000411987304688,18.00006866455078,17.999897003173828,17.999982833862305,18.000025749206543,18.000004291534424,17.999993562698364,17.999998927116394,18.00000160932541,18.0000002682209,17.999999597668648,17.999999932944775,18.000000100582838,18.000000016763806,17.99999997485429,17.99999999580905,18.000000006286427,18.000000001047738,17.999999998428393,17.999999999738066],"65_70":[180,90,45,22.5,11.25,16.875,19.6875,21.09375,21.796875,21.4453125,21.26953125,21.181640625,21.1376953125,21.15966796875,21.170654296875,21.1761474609375,21.17889404296875,21.177520751953125,21.176834106445312,21.176490783691406,21.176319122314453,21.17640495300293,21.176447868347168,21.176469326019287,21.176480054855347,21.176474690437317,21.176472008228302,21.176470667123795,21.17646999657154,21.176470331847668,21.17647049948573,21.176470583304763,21.17647062521428,21.17647060425952,21.176470593782142,21.176470588543452],"70_75":[180,90,45,22.5,33.75,28.125,25.3125,26.71875,27.421875,27.7734375,27.59765625,27.685546875,27.7294921875,27.70751953125,27.696533203125,27.6910400390625,27.69378662109375,27.692413330078125,27.691726684570312,27.69207000732422,27.692241668701172,27.69232749938965,27.69228458404541,27.69230604171753,27.69231677055359,27.69231140613556,27.692308723926544,27.692307382822037,27.69230805337429,27.692307718098164,27.6923075504601,27.692307634279132,27.692307676188648,27.692307697143406,27.692307686666027,27.692307691904716],"75_80":[180,90,45,22.5,33.75,39.375,42.1875,40.78125,40.078125,39.7265625,39.90234375,39.990234375,40.0341796875,40.01220703125,40.001220703125,39.9957275390625,39.99847412109375,39.999847412109375,40.00053405761719,40.00019073486328,40.00001907348633,39.99993324279785,39.99997615814209,39.99999761581421,40.00000834465027,40.00000298023224,40.000000298023224,39.999998956918716,39.99999962747097,39.9999999627471,40.00000013038516,40.00000004656613,40.00000000465661,39.999999983701855,39.999999994179234,39.99999999941792],"80_85":[180,90,45,67.5,78.75,73.125,70.3125,71.71875,72.421875,72.0703125,71.89453125,71.982421875,72.0263671875,72.00439453125,71.993408203125,71.9989013671875,72.00164794921875,72.00027465820312,71.99958801269531,71.99993133544922,72.00010299682617,72.0000171661377,71.99997425079346,71.99999570846558,72.00000643730164,72.0000010728836,71.99999839067459,71.9999997317791,72.00000040233135,72.00000006705523,71.99999989941716,71.9999999832362,72.00000002514571,72.00000000419095,71.99999999371357,71.99999999895226]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment