Signal and Systems
410687003
MATLAB CODE
clear all
[y, fs]=audioread('bgm.mp3');
[y1, fs]=audioread('b.mp3');
y = repmat(y, 10, 1);
sound(y, fs);
pic=imread('1.png');
image(pic);
set(gca,'xtick',[],'ytick',[])
pause(5);
ch=0;
connector on
m = mobiledev;
game = 1;
output = 0;
exp=0;
level=1;
while game==1
clear m;
clear or;
clear tor;
clc;
p=unidrnd(3);
if p==1
pic=imread('3.png');
sound(y1, fs);
elseif p==2
pic=imread('4.png');
sound(y1, fs);
else
pic=imread('5.png');
sound(y1, fs);
end
image(pic);
dif=1.1-level*0.2;
pause(dif);
m = mobiledev;
m.OrientationSensorEnabled=1;
m.Logging = 1;
pause(1);
m.Logging = 0;
[or,tor] = orientlog(m)
input=or(:,3);
input=input(3);
load_system('test');
sim('test');
x = max(output);
if x==1&&x==p
sound(y1, fs);
pic=imread('10.png');
image(pic);
pause(1.5);
game=1;
exp=exp+1;
elseif x==2&x==p
sound(y1, fs);
pic=imread('11.png');
image(pic);
pause(1.5);
game=1;
exp=exp+1;
elseif x==3&&x==p
sound(y1, fs);
pic=imread('12.png');
image(pic);
game=1;
pause(1.5);
exp=exp+1;
elseif x~=p&&p==1
pic=imread('8.png');
image(pic);
pause(1.5);
game=1;
ch=ch+1;
exp=exp-1;
elseif x~=p&&p==2
pic=imread('6.png');
image(pic);
pause(1.5);
game=1;
ch=ch+1;
exp=exp-1;
elseif x~=p&&p==3
pic=imread('7.png');
image(pic);
pause(1.5);
game=1;
ch=ch+1;
exp=exp-1;
end
if(ch==3)
game=0;
end
if(exp>=5&&exp<=10)
level=2;
end
if(exp>10&&exp<=15)
level=3;
end
if(exp>15&&exp<=20)
level=4;
end
if(exp>20)
level=5;
end
end
pause(2);
clear sound;
[y, fs]=audioread('end.mp3');
sound(y,fs);
pic=imread('9.png');
image(pic);