Leander Moesinger
  • Member for 4 years, 7 months
  • Last seen more than a month ago
  • Vienna, Austria
Fire propagation simulator
12 votes

Matlab, 235 257 190 182 178 bytes Input: Matrix A, 1x2 vector p containing the starting coordinates. function t=F(A,p) [n,m]=size(A);x=2:n*m;x(mod(x,n)==1)=0;B=diag(x,1)+diag(n+1:n*m,n);k=sub2ind([n ...

View answer
X Steps Forward, 1 Step Back
3 votes

Matlab/Octave, 31 26 bytes 5 bytes saved thx to Luis Mendo! @(n)sum(1:n/2+.5)-fix(n/2)

View answer
Am I a golfy array?
2 votes

Matlab and Octave, 41 36 bytes 5 bytes saved thx to Luis Mendo all([a inf]>=[0 cumsum(a)./find(a)]) Try it online!

View answer
The Chroma Key to Success
2 votes

Matlab 2016b and Octave, 62 59 bytes Input: A = MxNx3 unit8 foreground matrix, B = MxNx3 unit8 background matrix. k=sum(A(:,:,2)-A(:,:,[1 3]),3)==510.*ones(1,1,3);A(k)=B(k); Output: A = MxNx3 unit8 ...

View answer
Is it a super-prime?
1 votes

Matlab, 36 34 bytes Saved 2 bytes thanks to Tom Carpenter. A very naive implementation using built-in functions: isprime(x)&isprime(nzz(primes(x)))

View answer
Rotational Average
0 votes

Matlab, 65 bytes c=num2str(n);l=nnz(c);mean(str2num(c(mod((1:l)+(0:l-1)'-1,l)+1))) Gonna work on this, pretty sure it can be done better.

View answer