-
Notifications
You must be signed in to change notification settings - Fork 0
/
is_move_contains.m
91 lines (88 loc) · 2.07 KB
/
is_move_contains.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
function [contains] = is_move_contains(v1, v2)
%IS_MOVE_CONTAINS 判断v1方向是否包含v2方向,例如广义的左方向包括左上,左和左下
% 此处显示详细说明
conf = config();
contains = 0;
switch v1
case conf.MOVE_RIGHTUP
if v2 == conf.MOVE_RIGHTUP
contains = 1;
end
if v2 == conf.MOVE_RIGHT
contains = 1;
end
if v2 == conf.MOVE_UP
contains = 1;
end
case conf.MOVE_RIGHTDOWN
if v2 == conf.MOVE_RIGHTDOWN
contains = 1;
end
if v2 == conf.MOVE_RIGHT
contains = 1;
end
if v2 == conf.MOVE_DOWN
contains = 1;
end
case conf.MOVE_LEFTUP
if v2 == conf.MOVE_LEFTUP
contains = 1;
end
if v2 == conf.MOVE_LEFT
contains = 1;
end
if v2 == conf.MOVE_UP
contains = 1;
end
case conf.MOVE_LEFTDOWN
if v2 == conf.MOVE_LEFTDOWN
contains = 1;
end
if v2 == conf.MOVE_LEFT
contains = 1;
end
if v2 == conf.MOVE_DOWN
contains = 1;
end
case conf.MOVE_UP
if v2 == conf.MOVE_LEFTUP
contains = 1;
end
if v2 == conf.MOVE_RIGHTUP
contains = 1;
end
if v2 == conf.MOVE_UP
contains = 1;
end
case conf.MOVE_DOWN
if v2 == conf.MOVE_LEFTDOWN
contains = 1;
end
if v2 == conf.MOVE_RIGHTDOWN
contains = 1;
end
if v2 == conf.MOVE_DOWN
contains = 1;
end
case conf.MOVE_LEFT
if v2 == conf.MOVE_LEFTUP
contains = 1;
end
if v2 == conf.MOVE_LEFTDOWN
contains = 1;
end
if v2 == conf.MOVE_LEFT
contains = 1;
end
case conf.MOVE_RIGHT
if v2 == conf.MOVE_RIGHTDOWN
contains = 1;
end
if v2 == conf.MOVE_RIGHTUP
contains = 1;
end
if v2 == conf.MOVE_RIGHT
contains = 1;
end
end
end