Obfuscated MATLAB Code
Sean's pick this week is Growth - Yet Another Obfuscated MATLAB Code by Hikaru.
This is awesome.
dbtype growth
1 figure(1)
2 clf,hold on,grid on,view(58,38),feval(@(mm,x)mm(@(O)mm(@(Y,U,V,W,v,nN,NN,Mm,mM,md,Nn)...
3 mm(@(G)mm(Y(G),x,0,0,v(mM(x))),mm(@(L)(@(M)(@(n,p,q,r)mm(mm(@(l,n)l{n},{@()1,@(){mm(Y...
4 (L), [25*...
5 v(1. /r*(...
6 n-1) )- 25/ 2*(r...
7 -1); md((n-1),r)*5 ^2-(...
8 r-1* 1)*5^ 2/ 2;0] ,[0;...
9 0;1] ,[ 1;0 ;0 ], 6) ,M(n...
10 -1,0 ,0,v(mM(x)))} }, ~(n>...
11 .0)+ 2*~(n <= 0))) )) ,(@(...
12 d)(( @( u,n ,t ,N )( (( mm (mm ((@(...
13 l,n) l{n}),{(@()mm (@ ()(mm(@()Nn(u (1),...
14 u(2) ,u(3) ,( '*g' ), U,5)) )) ),(@ ()mm...
15 ((@( w, b, p, m, mN ){( mm (@ (A )Nn(...
16 A(1, :) ,A(2,:),A(3,: ), '-',...
17 W,N^ 2* 0.3,V ,( mN(N /6 ))),...
18 [u,( u+ n* w)] )) ,( mm (@ (f ,T, S){(...
19 d(u+ n*w,S,T,N-1)) ,( d(u+n*w,f(S,n ,p),...
20 f(T, n,p), N -1)) ,( d(u+n *w ,f(S ,n,p...
21 *2), (f (T ,n ,( p)* 2)), N-1 )) }, (@(r...
22 ,n,p )r *(Mm(p))-nN(r ,n )*NN...
23 (p)+ (1 -Mm(p )) *n*( n' *r))...
24 ,NN( m) *n -t* Mm (m ), n* Mm(m...
25 )+NN (m)*t))}),9.8 /( 7.14...
26 -N), 0.1,2 +1 /10.6 ,- .102...
27 +1,( @( r) [1 *1 *.32...
28 ,.22 ,1 *.08...
29 ]*r+ [0 ,1,(...
30 .5)] *( 1-r)...
31 )))} ,1+(...
32 N>0))))))))))),@(f)mm(@(g)@(m,n,o,p)mm(f(g(g)),m,n,o,p),@(g)@(m,n,o,p)mm(f(g(g)),m,n,...
33 o,p)),O(0),O(1),O(2),O(3),O(4),O(5),O(6),O(7),O(8),O(9)),(@(I)mm(@(l,m)mm(l{1+(I>2)},...
34 char(m((m(58+I)-46):(m(59+I)-47))+18)),{@(J)J,@str2func},['[O`YS`aWhS1]Z]`ZW\SEWRbV',...
35 'TZ]]`Q`]aaaW\Q]aa_`b[]R^Z]b!TSdOZ/9>GLQTW[^c']))),@feval,9); %% (c) woodrush (2014) ...
growth
They look the same!
Hikaru, also provides the technical details about the programming features used. However, the detail I care about most was left out: How long did this take to make?
It is also a great example of pushing the MATLAB interepreter to its limits.
Maybe some day we can have an obfuscated MATLAB Code Contest, similar to the C one.
Have a great New Year everyone!
Comments
Give it a try and let us know what you think here or leave a comment for Hikaru.
- Category:
- Picks


Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.