Commit 28e0c62c authored by TALARI REBECCA BLESSY's avatar TALARI REBECCA BLESSY

pooja

parents
function actions = lookup_solve_3(input)
actions = zeros(3,3); #this matrix contains the actions that have been performed on input matrix so far
while(true)
activeAction = zeros(3,3); #this matrix stores the current action
activeAction(2,:) = input(1,:); #these three lines of command are for making the first row zero
input=toggle(input,activeAction,2);
actions = addActions(actions, activeAction);
activeAction = zeros(3,3); #refreshing activeAction to zero matrix
activeAction(3,:) = input(2,:); #these three lines of command are for making the second row zero
input=toggle(input,activeAction,3);
actions = addActions(actions, activeAction);
if(input == zeros(3,3))
break;
endif
activeAction = zeros(3,3); #refreshing activeAction to zero matrix
activeAction = look_up_table(input, activeAction); #this line sees the bottom row pattern in the table and tells which top row buttons to press
input = toggle(input, activeAction, 1);
actions = addActions(actions, activeAction);
endwhile
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