-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_over.m
31 lines (27 loc) · 969 Bytes
/
game_over.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function game_over(nx,ny,x,y,vals,id_p)
plot_grid(x,y,0);
title('GAME OVER MOTHERFUCKER','fontweight','bold');
all = (1:nx*ny)';
list = all(vals ~= 0);
for cont = 1:size(list,1)
id = list(cont);
if vals(id) == -1
if id == id_p
plot(x(id),y(id),'sr','MarkerSize',10,'MarkerEdgeColor',[0.5 0 0],'MarkerFaceColor','red');
else
plot(x(id),y(id),'or','MarkerSize',7,'MarkerEdgeColor',[0.5 0 0],'MarkerFaceColor','red');
end
elseif vals(id) > 0
switch vals(id)
case 1, str = 'blue';
case 2, str = 'green';
case 3, str = 'red';
case 4, str = [0 0 0.5];
case 5, str = [0.5 0 0];
case 6, str = [0.5 0 0.5];
case 7, str = [0 0.5 0.5];
case 8, str = [0.35 0.2 0];
end
text(x(id)-1,y(id),num2str(vals(id)),'color',str,'fontweight','bold','fontsize',13);
end
end