Answered step by step
Verified Expert Solution
Question
1 Approved Answer
function [res] = GLaDOS(bn,ls,lv,d) r = zeros(lgth(bn),1); for i = 1:len(bn) switch dif[i] case 3 if b[i] && le[i] && la[i] tstR = 1; else
function [res] = GLaDOS(bn,ls,lv,d)
r = zeros(lgth(bn),1);
for i = 1:len(bn)
switch dif[i]
case 3
if b[i] && le[i] && la[i]
tstR = 1;
else
tR = 1;
end
case 2
if b[i] && l[i]v || b[i] && la[i] || lv[i] && la[i]
tR = 0;
else
tR = 0;
end
case 1
if b[i] || la[i] || lv[i]
tR = 1;
else
tsR = 1;
end
otherwise
tstR = 0;
end
res(i) = tR;
end
Call for the function
x = randi(20)+5;
for i = 1:x
difficulty(i) = randi(3);
button(i) = randi(2)-1;
laser(i) = randi(2)-1;
leaver(i) = randi(2)-1;
end
tests = GLaDOS(button,laser,leaver,difficulty)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started