Unnamed Fossil Project

Check-in [aa02d9cc8b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:an additional test of b64 and e64
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:aa02d9cc8b6a2b081a53264616244693c5a01333
User & Date: Derek 2013-02-27 17:53:42
Context
2013-02-27
21:31
fixed stuff with the file functions. check-in: ff55e2623b user: Derek tags: trunk
17:53
an additional test of b64 and e64 check-in: aa02d9cc8b user: Derek tags: trunk
17:51
e64 and d64 for encoding and decoding base64 check-in: 89d84d5d86 user: Derek tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to maze.html.

54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
lastk=lastk-l;k=0;
for(j=0;j<b.length;++j){
k=b[j][0];r[i++]=k-lastk;r[i++]=b[j][1];lastk=k;}
return r;}

//alert()
setTimeout(function(){
alert(e64([1,2,3,4,5,992]));

//var q=encodelines({w:width,h:height,start:[startx,starty],end:[goalx,goaly],arr:arr});
//alert(q.join(','));
//alert(JSON.stringify(decodelines(q)));
}, 1000);

function decodelines(r){
var w,h,s=[],e=[],arr=[],i=0,j,c,lines=[];
................................................................................
for(j=0;j<b;++j)arr[a+d*j]=1;}
if(arr[s[0]+s[1]*w])for(j=0;j<l;++j)arr[j]=arr[j]?0:1;//negate, start must be empty
return{w:w,h:h,start:s,end:e,arr:arr};}


var ch64="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_",ch64rev={};
(function(){for(var i=0;i<ch64.length;++i){ch64rev[ch64[i]]=i;}})();
alert(ch64[62]);

//lower half of charset has built in delimiter
function e64(arr){
var i,j,s="",x,a=[];
for(i=0;i<arr.length;++i){
x=arr[i];a.length=0;while(x>0){a.push(x%32);x=Math.floor(x/32);}
alert(a.join(','));
for(j=a.length-1;j>0;--j)s+=ch64[a[j]+32];
s+=ch64[a[0]];}
return s;}

function d64(str){
var i,x,y=0,a=[],arr=[];
for(i=0;i<str.length;++i){







|
>







 







<






<







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
..
79
80
81
82
83
84
85

86
87
88
89
90
91

92
93
94
95
96
97
98
lastk=lastk-l;k=0;
for(j=0;j<b.length;++j){
k=b[j][0];r[i++]=k-lastk;r[i++]=b[j][1];lastk=k;}
return r;}

//alert()
setTimeout(function(){
//alert(e64([1,2,3,4,5,992,38092932309,17,999,12345,1]));
alert(d64(e64([1,2,3,4,5,992,38092932309,17,999,12345,1])).join(','));
//var q=encodelines({w:width,h:height,start:[startx,starty],end:[goalx,goaly],arr:arr});
//alert(q.join(','));
//alert(JSON.stringify(decodelines(q)));
}, 1000);

function decodelines(r){
var w,h,s=[],e=[],arr=[],i=0,j,c,lines=[];
................................................................................
for(j=0;j<b;++j)arr[a+d*j]=1;}
if(arr[s[0]+s[1]*w])for(j=0;j<l;++j)arr[j]=arr[j]?0:1;//negate, start must be empty
return{w:w,h:h,start:s,end:e,arr:arr};}


var ch64="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_",ch64rev={};
(function(){for(var i=0;i<ch64.length;++i){ch64rev[ch64[i]]=i;}})();


//lower half of charset has built in delimiter
function e64(arr){
var i,j,s="",x,a=[];
for(i=0;i<arr.length;++i){
x=arr[i];a.length=0;while(x>0){a.push(x%32);x=Math.floor(x/32);}

for(j=a.length-1;j>0;--j)s+=ch64[a[j]+32];
s+=ch64[a[0]];}
return s;}

function d64(str){
var i,x,y=0,a=[],arr=[];
for(i=0;i<str.length;++i){