I only entered 2 of the 5 proposed contests, because either I was away when it was posted, or I couldn't think of an acceptable solution . My solutions were far from optimal and consequently didn't earn me much points, but I thought I'd share them with you guys anyways.
Task 1
Code:
Basically, this just figures out how many 1s there are in the initial list, then adds that many to the final list, then works it's way through all 256 integers... very slow, but also very small
Task 4
Code:
This is more of a brute force kind of approach in the sense that it's compression ratio is directly proportional to the number of one byte tokens I could cram in. I know there are more one byte tokens, however, some simple power juggling indicates that I needed 157 tokens to cover all combinations. Basically, it considers a string of 6 characters, which can be any combination of the 29 available characters, then created a decimal number representing which combination the characters are (for example, AAAAAA would be 1, AAAAAB would be 2 and so on), then it just creates a string from the 157 tokens availalbe to it that is that number, but only has to be 4 characters long, since it has more tokens to choose from. Essentially, it is converting a base 29 number into a base 157 number, except that the characters that represent the numbers are 1 byte tokens. it gets a compression ratio of about 30-32%, because it adds a little at the end of the input string to make it's length a multiple of 6.
Task 1
Code:
For(A,1,256
For(B,1,sum(not(L1-A
A->L2(1+dim(L2
End
End
L2->L1
Basically, this just figures out how many 1s there are in the initial list, then adds that many to the final list, then works it's way through all 256 integers... very slow, but also very small
Task 4
Code:
DelVar D" ->Str3
While length(Str1)/6!=int(length(Str1)/6
Str1+"A->Str1
D+1->D
End
For(G,1,length(Str1),6
DelVar BFor(A,5,0,~1
B+29^A(inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ., ",sub(sub(Str1,G,6),abs(A-6),1))-1->B
End
For(A,3,0,~1
int(B/157^A->C
Str3+sub("ABCDEFGHIJKLMNOPQRSTUVWXYZtheta0123456789[i]pi[e]?(){}[]+-*/^~!=!=>>=<<=^^o^^r^^Tplotsquareplotcross ^^2^^3^^-1randRadiancuberoot(xrootsqrt(ln(log(sin(cos(tan(sin^-1(cos^-1(tan^-1(e^(10^(|E|LSortA(SortD(dim(Fill(seq(augment(abs(round(iPart(fPart(int(min(max(Line(Tangent(Shade(Circle(Text(Pt-On(Pt-Off(Pt-Change(Pxl-On(Pxl-Off(Pxl-Change(pxl-Test(cosh(cosh^-1(sinh(tanh(tanh^-1(sinh^-1(fMax(fMin(Horizontal Vertical not( or fMin(fMax(AnsMenu(Output(If ThenElseFor(While Repeat EndPause Lbl Goto ReturnStopPrompt Disp DispGraphDispTablegetKeyClrHomeClrTableDrawF DrawInv >Frac>DecIS>(DS<(Input SciEngPolar",C+1,1->Str3
B-157^AC->B
End:End
{0,1->L1
{0,D->L2
LinReg(ax+b) {Y1}
Equ>String({Y1},Str1
sub(Str1,1,1)+sub(Str3,2,length(Str3)-1->Str1
This is more of a brute force kind of approach in the sense that it's compression ratio is directly proportional to the number of one byte tokens I could cram in. I know there are more one byte tokens, however, some simple power juggling indicates that I needed 157 tokens to cover all combinations. Basically, it considers a string of 6 characters, which can be any combination of the 29 available characters, then created a decimal number representing which combination the characters are (for example, AAAAAA would be 1, AAAAAB would be 2 and so on), then it just creates a string from the 157 tokens availalbe to it that is that number, but only has to be 4 characters long, since it has more tokens to choose from. Essentially, it is converting a base 29 number into a base 157 number, except that the characters that represent the numbers are 1 byte tokens. it gets a compression ratio of about 30-32%, because it adds a little at the end of the input string to make it's length a multiple of 6.