Commit fdc600e6 authored by SILU PANDA's avatar SILU PANDA

silu panda

parent a92d558c
function[z]=final_state(x,y) %x is action matrix and y is the initial matrix
a=[1 1 0 1 0 0 0 0 0;1 1 1 0 1 0 0 0 0;0 1 1 0 0 1 0 0 0;1 0 0 1 1 0 1 0 0;0 1 0 1 1 1 0 1 0;0 0 1 0 1 1 0 0 1;0 0 0 1 0 0 1 1 0;0 0 0 0 1 0 1 1 1;0 0 0 0 0 1 0 1 1];
b=[x(1,1);x(1,2);x(1,3);x(2,1);x(2,2);x(2,3);x(3,1);x(3,2);x(3,3)];
c=[y(1,1);y(1,2);y(1,3);y(2,1);y(2,2);y(2,3);y(3,1);y(3,2);y(3,3)];
v=a*b;
h=v.+c;%element wise addition
p=mod(h,2);%remainder after dividing by 2
z=[p(1,1),p(2,1),p(3,1);p(4,1),p(5,1),p(6,1);p(7,1),p(8,1),p(9,1)];
return
endfunction;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment