class Status public enum m_status BOMB BLOCKED WALL XWALL public m_sta

 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
class Status
{
public enum m_status
{
BOMB,
BLOCKED,
WALL,
XWALL
}
public m_status m_s;
public m_dist;
public Status()
{}
}
class Map
{
private enum m_status
{
BOMB,
BLOCKED,
WALL,
XWALL
}
private BotEnv m_be;
private final char map [] [];
private final int m_width,m_height;
public Map (BotEnv _obj, int _height, int _width)
{
m_be = _obj;
m_width = _width;
m_height= _height;
map = new char [_heght] [];
for (int i = 0; i< _height; i++)
{
map [i] = new char [_width];
}
}
public void addItem( int _xpos, int _ypos, char _item)
{
map[x][y] = _item;
}
public Status getStatusRight(int _xpos, int _ypos)
{
Status s = new Status();
for (int i = _xpos; i<m_width; i++)
{
if (map[_ypos][i] = '.')
{
continue;
}
else
{
if (map[_ypos][i] = '*')
{
s.m_s = m_status.BOMB;
s.m_dist = i;
}
if (map[_ypos][i] = 'w')
{
s.m_s = m_status.WALL;
s.m_dist = i;
}
if (map[_ypos][i] = 'X')
{
s.m_s = m_status.XWALL;
s.m_dist = i;
}
if (map[_ypos][i] = 'L') // буквой L будем обозначать заблокированную ячейку
{
s.m_s = m_status.BLOCKED;
s.m_dist = i;
}
}
}
}