Implementing the transition the usual way, using transition.attr.
Click the circle to restart
Implementing the transition the usual way, using transition.attr.
Click the circle to restart
Clamp at each tick, rather than clamping the target value.
Click the circle to restart
| function* allPermutationsOf(array, level=0) { | |
| array = array.slice(0); | |
| const calling = (level === array.length-1); | |
| let index = level; | |
| do { | |
| if (calling) yield array; | |
| else yield *allPermutationsOf(array, level+1); | |
| if (index > 0) { | |
| const tmp = array[index]; |
50,000 circles in fixed positions, with their radius and color animated through 52 datapoints.
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>MSW algorithm demo</title> | |
| <script src="https://d3js.org/d3.v4.min.js"></script> | |
| <style> | |
| body { margin: 0; height: 500px; position: relative; } | |
| #info { position: absolute; width: 100%; height: 100px; bottom: 0; padding: 35px; box-sizing: border-box; } | |
| #info.step-0 span.step-0, |
| PARAMETER_FILE = lkh/par/5.par | |
| Reading PROBLEM_FILE: "atsp/5.atsp" ... done | |
| ASCENT_CANDIDATES = 50 | |
| BACKBONE_TRIALS = 0 | |
| BACKTRACKING = YES | |
| # CANDIDATE_FILE = | |
| CANDIDATE_SET_TYPE = ALPHA | |
| EXCESS = 0.00416667 | |
| EXTRA_CANDIDATES = 0 | |
| EXTRA_CANDIDATE_SET_TYPE = QUADRANT |
| npm ERR! Invalid version: "1.0.3-CHAPTER.1.Loomings.Call.me.Ishmael.Some.years.ago.never.mind.how.long.precisely.having.little.or.no.money.in.my.purse.and.nothing.particular.to.interest.me.on.shore.I.thought.I.would.sail.about.a.little.and.see.the.watery.part.of.the.world.It.is.a.way.I.have.of.driving.off.the.spleen.and.regulating.the.circulation.Whenever.I.find.myself.growing.grim.about.the.mouth.whenever.it.is.a.damp.drizzly.November.in.my.soul.whenever.I.find.myself.involuntarily.pausing.before.coffin.warehouses.and.bringing.up.the.rear.of.every.funeral.I.meet.and.especially.whenever.my.hypos.get.such.an.upper.hand.of.me.that.it.requires.a.strong.moral.principle.to.prevent.me.from.deliberately.stepping.into.the.street.and.methodically.knocking.peoples.hats.off.then.I.account.it.high.time.to.get.to.sea.as.soon.as.I.can.This.is.my.substitute.for.pistol.and.ball.With.a.philosophical.flourish.Cato.throws.himself.upon.his.sword.I.quietly.take.to.the.ship.There.is.nothing.surprising.in.this.If.they.but.knew.it.a |
| const http = require("http"); | |
| function sleep(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| const server = http.createServer(async (req, res) => { | |
| res.writeHead(200, { "Content-Type": "text/plain; charset=UTF-8" }); | |
| // Send enough padding to fill up the browser’s buffer |
| data T = Two (T, T) | One T deriving (Eq, Show) | |
| type X = Either (Either T T) () | |
| f :: Either X X -> Either (X, X) () | |
| f (Left (Left (Left (Two (t1, t2))))) = Left (Left (Left t1), Left (Left t2)) | |
| f (Right (Left (Left (Two (t1, t2))))) = Left (Left (Left t1), Left (Right t2)) | |
| f (Left (Left (Right (Two (t1, t2))))) = Left (Left (Right t1), Left (Left t2)) | |
| f (Right (Left (Right (Two (t1, t2))))) = Left (Left (Right t1), Left (Right t2)) |
| 3 | |
| 13 | |
| 113 | |
| 2113 | |
| 12113 | |
| 612113 | |
| 5113 | |
| 6113 | |
| 26113 | |
| 326113 |