Skip to content

Instantly share code, notes, and snippets.

@butchi
Created December 23, 2015 13:08
Show Gist options
  • Save butchi/1d46a01f5e915ea5fb5c to your computer and use it in GitHub Desktop.
Save butchi/1d46a01f5e915ea5fb5c to your computer and use it in GitHub Desktop.
ツインドラゴンに関する発見と実装 ref: http://qiita.com/butchi_y/items/4f0bd72f4b322d4943b6
var i, j;
var x = [0];
var y = [0];
var nextX = [];
var nextY = [];
for(j=0; j<4; j++) {
l = x.length-1;
for(i=0; i<x.length; i++) {
nextX[i] = x[i] + 1 - y[l];
nextY[i] = y[i] + x[l];
}
x = x.concat(nextX);
y = y.concat(nextY);
}
console.log(x);
console.log(y);
Graphics[Point[
Transpose[{Re[#], Im[#]} &[
Nest[Join[#, # + 1 - Im[Last[#]] + Re[Last[#]] I] &, {0}, 10]
]]
]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment