sota

Dependencies:   mbed

Fork of newdot by SGMP Coperations

Committer:
sotter
Date:
Mon Dec 11 09:40:35 2017 +0000
Revision:
1:be91a16b48ea
Parent:
0:6e7a6e71dad3
Child:
2:d714fd7bb7d5
sota

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dragondrunk 0:6e7a6e71dad3 1 /***************** For test only ****************/
dragondrunk 0:6e7a6e71dad3 2
dragondrunk 0:6e7a6e71dad3 3 #include "mbed.h"
dragondrunk 0:6e7a6e71dad3 4 #include "ColorMbed.h"
dragondrunk 0:6e7a6e71dad3 5
dragondrunk 0:6e7a6e71dad3 6 ColorMbed dotmatrix;
dragondrunk 0:6e7a6e71dad3 7 Timer t;
sotter 1:be91a16b48ea 8 Serial pc(D1, D0);
sotter 1:be91a16b48ea 9 DigitalIn sw(USER_BUTTON);
sotter 1:be91a16b48ea 10
sotter 1:be91a16b48ea 11 uint8_t blue[3] = {0,10,0};
sotter 1:be91a16b48ea 12 uint8_t green[3] = {0,255,0};
sotter 1:be91a16b48ea 13 uint8_t red[3] = {0,0,255};
sotter 1:be91a16b48ea 14 uint8_t M[3] = {255,255,255};
sotter 1:be91a16b48ea 15 uint8_t I[3] = {255,0,0};
sotter 1:be91a16b48ea 16 uint8_t map_led[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
sotter 1:be91a16b48ea 17 uint8_t boss_led[8] = {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
sotter 1:be91a16b48ea 18 uint8_t hero_led[8] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
sotter 1:be91a16b48ea 19 uint8_t M_led[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
sotter 1:be91a16b48ea 20 uint8_t I_led[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
sotter 1:be91a16b48ea 21
sotter 1:be91a16b48ea 22 char board[8][8] = {{'D','O','O','O','O','O','O','O'},
sotter 1:be91a16b48ea 23 {'O','O','O','O','O','O','O','O'},
sotter 1:be91a16b48ea 24 {'O','O','O','O','O','O','O','O'},
sotter 1:be91a16b48ea 25 {'O','O','O','O','O','O','O','O'},
sotter 1:be91a16b48ea 26 {'O','O','O','O','O','O','O','O'},
sotter 1:be91a16b48ea 27 {'O','O','O','O','O','O','O','O'},
sotter 1:be91a16b48ea 28 {'O','O','O','O','O','O','O','O'},
sotter 1:be91a16b48ea 29 {'H','O','O','O','O','O','O','O'}};
sotter 1:be91a16b48ea 30
sotter 1:be91a16b48ea 31 int bit_m[8][8] = {{0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 32 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 33 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 34 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 35 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 36 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 37 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 38 {0,0,0,0,0,0,0,0}};
sotter 1:be91a16b48ea 39
sotter 1:be91a16b48ea 40 int bit_i[8][8] = {{0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 41 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 42 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 43 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 44 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 45 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 46 {0,0,0,0,0,0,0,0},
sotter 1:be91a16b48ea 47 {0,0,0,0,0,0,0,0}};
sotter 1:be91a16b48ea 48
sotter 1:be91a16b48ea 49 int position_x = 7;
sotter 1:be91a16b48ea 50 int position_y = 0;
sotter 1:be91a16b48ea 51 int position_mission = 1;
sotter 1:be91a16b48ea 52 char hero = 'H';
sotter 1:be91a16b48ea 53
sotter 1:be91a16b48ea 54 void print_position(){
sotter 1:be91a16b48ea 55 pc.printf("position is [%d,%d]\n",position_x,position_y);
sotter 1:be91a16b48ea 56 }
sotter 1:be91a16b48ea 57
sotter 1:be91a16b48ea 58 void print_mission(){
sotter 1:be91a16b48ea 59 pc.printf("mission is %d\n",position_mission);
sotter 1:be91a16b48ea 60 }
sotter 1:be91a16b48ea 61
sotter 1:be91a16b48ea 62 void mission(){
sotter 1:be91a16b48ea 63 if (position_mission >= 1 && position_mission < 9){
sotter 1:be91a16b48ea 64 position_x = 7;
sotter 1:be91a16b48ea 65 position_y = position_mission - 1;
sotter 1:be91a16b48ea 66 }
sotter 1:be91a16b48ea 67 if (position_mission >= 9 && position_mission < 17){
sotter 1:be91a16b48ea 68 position_x = 6;
sotter 1:be91a16b48ea 69 position_y = 16 - position_mission;
sotter 1:be91a16b48ea 70 }
sotter 1:be91a16b48ea 71 if (position_mission >= 17 && position_mission < 25){
sotter 1:be91a16b48ea 72 position_x = 5;
sotter 1:be91a16b48ea 73 position_y = position_mission - 17;
sotter 1:be91a16b48ea 74 }
sotter 1:be91a16b48ea 75 if (position_mission >= 25 && position_mission < 33){
sotter 1:be91a16b48ea 76 position_x = 4;
sotter 1:be91a16b48ea 77 position_y = 32 - position_mission;
sotter 1:be91a16b48ea 78 }
sotter 1:be91a16b48ea 79 if (position_mission >= 33 && position_mission < 41){
sotter 1:be91a16b48ea 80 position_x = 3;
sotter 1:be91a16b48ea 81 position_y = position_mission - 33;
sotter 1:be91a16b48ea 82 }
sotter 1:be91a16b48ea 83 if (position_mission >= 41 && position_mission < 49){
sotter 1:be91a16b48ea 84 position_x = 2;
sotter 1:be91a16b48ea 85 position_y = 48 - position_mission;
sotter 1:be91a16b48ea 86 }
sotter 1:be91a16b48ea 87 if (position_mission >= 49 && position_mission < 57){
sotter 1:be91a16b48ea 88 position_x = 1;
sotter 1:be91a16b48ea 89 position_y = position_mission - 49;
sotter 1:be91a16b48ea 90 }
sotter 1:be91a16b48ea 91 if (position_mission >= 57 && position_mission < 65){
sotter 1:be91a16b48ea 92 position_x = 0;
sotter 1:be91a16b48ea 93 position_y = 64 - position_mission;
sotter 1:be91a16b48ea 94 }
sotter 1:be91a16b48ea 95 if (position_mission >=65){
sotter 1:be91a16b48ea 96 position_x = 0;
sotter 1:be91a16b48ea 97 position_y = 0;
sotter 1:be91a16b48ea 98 position_mission = 64;
sotter 1:be91a16b48ea 99 }
sotter 1:be91a16b48ea 100 }
sotter 1:be91a16b48ea 101
sotter 1:be91a16b48ea 102 void move(int ran){
sotter 1:be91a16b48ea 103 int walk_x = position_x;
sotter 1:be91a16b48ea 104 int walk_y = position_y;
sotter 1:be91a16b48ea 105
sotter 1:be91a16b48ea 106 position_mission = position_mission + ran;
sotter 1:be91a16b48ea 107 mission();
sotter 1:be91a16b48ea 108
sotter 1:be91a16b48ea 109 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 110 board[walk_x][walk_y]='O';
sotter 1:be91a16b48ea 111 board[position_x][position_y] = hero;
sotter 1:be91a16b48ea 112 pc.printf("walk is %d\n",ran);
sotter 1:be91a16b48ea 113 }
sotter 1:be91a16b48ea 114 else{
sotter 1:be91a16b48ea 115 board[walk_x][walk_y]='O';
sotter 1:be91a16b48ea 116 board[position_x][position_y] = hero;
sotter 1:be91a16b48ea 117 pc.printf("walk is %d\n",ran);
sotter 1:be91a16b48ea 118 }
sotter 1:be91a16b48ea 119 }
sotter 1:be91a16b48ea 120
sotter 1:be91a16b48ea 121 void map(){
sotter 1:be91a16b48ea 122 for(int i=0;i<8;i++){
sotter 1:be91a16b48ea 123 pc.printf("\n");
sotter 1:be91a16b48ea 124 for(int j=0;j<8;j++){
sotter 1:be91a16b48ea 125 pc.printf("_%c",board[i][j]);
sotter 1:be91a16b48ea 126 }
sotter 1:be91a16b48ea 127 }
sotter 1:be91a16b48ea 128 pc.printf("\n");
sotter 1:be91a16b48ea 129 }
sotter 1:be91a16b48ea 130
sotter 1:be91a16b48ea 131 void random() {
sotter 1:be91a16b48ea 132 srand((unsigned)time(0));
sotter 1:be91a16b48ea 133 int ran = (rand()%6)+1;
sotter 1:be91a16b48ea 134 move(ran);
sotter 1:be91a16b48ea 135 }
sotter 1:be91a16b48ea 136
sotter 1:be91a16b48ea 137 void monster_easy(){
sotter 1:be91a16b48ea 138
sotter 1:be91a16b48ea 139 srand((unsigned)time(0));
sotter 1:be91a16b48ea 140 int mon1 = (rand()%3)+2; //2-4
sotter 1:be91a16b48ea 141 int B1 = (rand()%4)+5; //5-8
sotter 1:be91a16b48ea 142 int mon2 = (rand()%4)+9; //9-12
sotter 1:be91a16b48ea 143 int T1 = (rand()%4)+13; //13-16
sotter 1:be91a16b48ea 144 int mon3 = (rand()%4)+17; //17-20
sotter 1:be91a16b48ea 145 int B2 = (rand()%4)+21; //21-24
sotter 1:be91a16b48ea 146 int mon4 = (rand()%4)+25; //25-28
sotter 1:be91a16b48ea 147 int T2 = (rand()%4)+29; //29-32
sotter 1:be91a16b48ea 148 int mon5 = (rand()%4)+33; //33-36
sotter 1:be91a16b48ea 149 int B3 = (rand()%4)+37; //37-40
sotter 1:be91a16b48ea 150 int mon6 = (rand()%4)+41; //41-44
sotter 1:be91a16b48ea 151 int T3 = (rand()%4)+45; //45-48
sotter 1:be91a16b48ea 152 int mon7 = (rand()%4)+49; //49-52
sotter 1:be91a16b48ea 153 int B4 = (rand()%4)+53; //53-56
sotter 1:be91a16b48ea 154 int mon8 = (rand()%4)+57; //57-60
sotter 1:be91a16b48ea 155 int T4 = (rand()%3)+61; //61-63
sotter 1:be91a16b48ea 156
sotter 1:be91a16b48ea 157 position_mission = mon1;
sotter 1:be91a16b48ea 158 mission();
sotter 1:be91a16b48ea 159 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 160 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 161 }
sotter 1:be91a16b48ea 162
sotter 1:be91a16b48ea 163 position_mission = mon2;
sotter 1:be91a16b48ea 164 mission();
sotter 1:be91a16b48ea 165 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 166 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 167 }
sotter 1:be91a16b48ea 168
sotter 1:be91a16b48ea 169 position_mission = mon3;
sotter 1:be91a16b48ea 170 mission();
sotter 1:be91a16b48ea 171 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 172 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 173 }
sotter 1:be91a16b48ea 174
sotter 1:be91a16b48ea 175 position_mission = mon4;
sotter 1:be91a16b48ea 176 mission();
sotter 1:be91a16b48ea 177 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 178 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 179 }
sotter 1:be91a16b48ea 180
sotter 1:be91a16b48ea 181 position_mission = mon5;
sotter 1:be91a16b48ea 182 mission();
sotter 1:be91a16b48ea 183 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 184 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 185 }
sotter 1:be91a16b48ea 186
sotter 1:be91a16b48ea 187 position_mission = mon6;
sotter 1:be91a16b48ea 188 mission();
sotter 1:be91a16b48ea 189 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 190 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 191 }
sotter 1:be91a16b48ea 192
sotter 1:be91a16b48ea 193 position_mission = mon7;
sotter 1:be91a16b48ea 194 mission();
sotter 1:be91a16b48ea 195 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 196 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 197 }
sotter 1:be91a16b48ea 198
sotter 1:be91a16b48ea 199 position_mission = mon8;
sotter 1:be91a16b48ea 200 mission();
sotter 1:be91a16b48ea 201 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 202 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 203 }
sotter 1:be91a16b48ea 204
sotter 1:be91a16b48ea 205 position_mission = B1;
sotter 1:be91a16b48ea 206 mission();
sotter 1:be91a16b48ea 207 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 208 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 209 }
sotter 1:be91a16b48ea 210
sotter 1:be91a16b48ea 211 position_mission = B2;
sotter 1:be91a16b48ea 212 mission();
sotter 1:be91a16b48ea 213 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 214 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 215 }
sotter 1:be91a16b48ea 216
sotter 1:be91a16b48ea 217 position_mission = B3;
sotter 1:be91a16b48ea 218 mission();
sotter 1:be91a16b48ea 219 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 220 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 221 }
sotter 1:be91a16b48ea 222
sotter 1:be91a16b48ea 223 position_mission = B4;
sotter 1:be91a16b48ea 224 mission();
sotter 1:be91a16b48ea 225 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 226 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 227 }
sotter 1:be91a16b48ea 228
sotter 1:be91a16b48ea 229 position_mission = T1;
sotter 1:be91a16b48ea 230 mission();
sotter 1:be91a16b48ea 231 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 232 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 233 }
sotter 1:be91a16b48ea 234
sotter 1:be91a16b48ea 235 position_mission = T2;
sotter 1:be91a16b48ea 236 mission();
sotter 1:be91a16b48ea 237 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 238 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 239 }
sotter 1:be91a16b48ea 240
sotter 1:be91a16b48ea 241 position_mission = T3;
sotter 1:be91a16b48ea 242 mission();
sotter 1:be91a16b48ea 243 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 244 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 245 }
sotter 1:be91a16b48ea 246
sotter 1:be91a16b48ea 247 position_mission = T4;
sotter 1:be91a16b48ea 248 mission();
sotter 1:be91a16b48ea 249 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 250 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 251 }
sotter 1:be91a16b48ea 252
sotter 1:be91a16b48ea 253 position_mission = 1;
sotter 1:be91a16b48ea 254 mission();
sotter 1:be91a16b48ea 255 }
sotter 1:be91a16b48ea 256
sotter 1:be91a16b48ea 257 void monster_medium(){
sotter 1:be91a16b48ea 258
sotter 1:be91a16b48ea 259 srand((unsigned)time(0));
sotter 1:be91a16b48ea 260 int mon1 = (rand()%3)+2; //2-4
sotter 1:be91a16b48ea 261 int B1 = (rand()%3)+5; //5-7
sotter 1:be91a16b48ea 262 int mon2 = (rand()%3)+8; //8-10
sotter 1:be91a16b48ea 263 int T1 = (rand()%3)+11; //11-13
sotter 1:be91a16b48ea 264 int mon3 = (rand()%3)+14; //14-16
sotter 1:be91a16b48ea 265 int B2 = (rand()%3)+17; //17-19
sotter 1:be91a16b48ea 266 int mon4 = (rand()%3)+20; //20-22
sotter 1:be91a16b48ea 267 int T2 = (rand()%3)+23; //23-25
sotter 1:be91a16b48ea 268 int mon5 = (rand()%3)+26; //26-28
sotter 1:be91a16b48ea 269 int B3 = (rand()%3)+29; //29-31
sotter 1:be91a16b48ea 270 int mon6 = (rand()%3)+32; //32-34
sotter 1:be91a16b48ea 271 int T3 = (rand()%3)+35; //35-37
sotter 1:be91a16b48ea 272 int mon7 = (rand()%3)+38; //38-40
sotter 1:be91a16b48ea 273 int B4 = (rand()%3)+41; //41-43
sotter 1:be91a16b48ea 274 int mon8 = (rand()%3)+44; //44-46
sotter 1:be91a16b48ea 275 int T4 = (rand()%3)+47; //47-49
sotter 1:be91a16b48ea 276 int mon9 = (rand()%3)+50; //50-52
sotter 1:be91a16b48ea 277 int B5 = (rand()%3)+53; //53-55
sotter 1:be91a16b48ea 278 int mon10 = (rand()%3)+56; //56-58
sotter 1:be91a16b48ea 279 int T5 = (rand()%3)+59; //59-61
sotter 1:be91a16b48ea 280 int mon11 = (rand()%1)+62; //62
sotter 1:be91a16b48ea 281 int mon12 = (rand()%1)+63; //63
sotter 1:be91a16b48ea 282
sotter 1:be91a16b48ea 283 position_mission = mon1;
sotter 1:be91a16b48ea 284 mission();
sotter 1:be91a16b48ea 285 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 286 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 287 }
sotter 1:be91a16b48ea 288
sotter 1:be91a16b48ea 289 position_mission = mon2;
sotter 1:be91a16b48ea 290 mission();
sotter 1:be91a16b48ea 291 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 292 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 293 }
sotter 1:be91a16b48ea 294
sotter 1:be91a16b48ea 295 position_mission = mon3;
sotter 1:be91a16b48ea 296 mission();
sotter 1:be91a16b48ea 297 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 298 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 299 }
sotter 1:be91a16b48ea 300
sotter 1:be91a16b48ea 301 position_mission = mon4;
sotter 1:be91a16b48ea 302 mission();
sotter 1:be91a16b48ea 303 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 304 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 305 }
sotter 1:be91a16b48ea 306
sotter 1:be91a16b48ea 307 position_mission = mon5;
sotter 1:be91a16b48ea 308 mission();
sotter 1:be91a16b48ea 309 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 310 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 311 }
sotter 1:be91a16b48ea 312
sotter 1:be91a16b48ea 313 position_mission = mon6;
sotter 1:be91a16b48ea 314 mission();
sotter 1:be91a16b48ea 315 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 316 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 317 }
sotter 1:be91a16b48ea 318
sotter 1:be91a16b48ea 319 position_mission = mon7;
sotter 1:be91a16b48ea 320 mission();
sotter 1:be91a16b48ea 321 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 322 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 323 }
sotter 1:be91a16b48ea 324
sotter 1:be91a16b48ea 325 position_mission = mon8;
sotter 1:be91a16b48ea 326 mission();
sotter 1:be91a16b48ea 327 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 328 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 329 }
sotter 1:be91a16b48ea 330 position_mission = mon9;
sotter 1:be91a16b48ea 331 mission();
sotter 1:be91a16b48ea 332 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 333 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 334 }
sotter 1:be91a16b48ea 335 position_mission = mon10;
sotter 1:be91a16b48ea 336 mission();
sotter 1:be91a16b48ea 337 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 338 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 339 }
sotter 1:be91a16b48ea 340
sotter 1:be91a16b48ea 341 position_mission = mon11;
sotter 1:be91a16b48ea 342 mission();
sotter 1:be91a16b48ea 343 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 344 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 345 }
sotter 1:be91a16b48ea 346
sotter 1:be91a16b48ea 347 position_mission = mon12;
sotter 1:be91a16b48ea 348 mission();
sotter 1:be91a16b48ea 349 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 350 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 351 }
sotter 1:be91a16b48ea 352
sotter 1:be91a16b48ea 353 position_mission = B1;
sotter 1:be91a16b48ea 354 mission();
sotter 1:be91a16b48ea 355 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 356 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 357 }
sotter 1:be91a16b48ea 358
sotter 1:be91a16b48ea 359 position_mission = B2;
sotter 1:be91a16b48ea 360 mission();
sotter 1:be91a16b48ea 361 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 362 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 363 }
sotter 1:be91a16b48ea 364
sotter 1:be91a16b48ea 365 position_mission = B3;
sotter 1:be91a16b48ea 366 mission();
sotter 1:be91a16b48ea 367 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 368 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 369 }
sotter 1:be91a16b48ea 370
sotter 1:be91a16b48ea 371 position_mission = B4;
sotter 1:be91a16b48ea 372 mission();
sotter 1:be91a16b48ea 373 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 374 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 375 }
sotter 1:be91a16b48ea 376
sotter 1:be91a16b48ea 377 position_mission = B5;
sotter 1:be91a16b48ea 378 mission();
sotter 1:be91a16b48ea 379 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 380 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 381 }
sotter 1:be91a16b48ea 382
sotter 1:be91a16b48ea 383 position_mission = T1;
sotter 1:be91a16b48ea 384 mission();
sotter 1:be91a16b48ea 385 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 386 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 387 }
sotter 1:be91a16b48ea 388
sotter 1:be91a16b48ea 389 position_mission = T2;
sotter 1:be91a16b48ea 390 mission();
sotter 1:be91a16b48ea 391 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 392 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 393 }
sotter 1:be91a16b48ea 394
sotter 1:be91a16b48ea 395 position_mission = T3;
sotter 1:be91a16b48ea 396 mission();
sotter 1:be91a16b48ea 397 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 398 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 399 }
sotter 1:be91a16b48ea 400
sotter 1:be91a16b48ea 401 position_mission = T4;
sotter 1:be91a16b48ea 402 mission();
sotter 1:be91a16b48ea 403 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 404 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 405 }
sotter 1:be91a16b48ea 406
sotter 1:be91a16b48ea 407 position_mission = T5;
sotter 1:be91a16b48ea 408 mission();
sotter 1:be91a16b48ea 409 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 410 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 411 }
sotter 1:be91a16b48ea 412
sotter 1:be91a16b48ea 413 position_mission = 1;
sotter 1:be91a16b48ea 414 mission();
sotter 1:be91a16b48ea 415 }
sotter 1:be91a16b48ea 416
sotter 1:be91a16b48ea 417 void monster_hard(){
sotter 1:be91a16b48ea 418
sotter 1:be91a16b48ea 419 srand((unsigned)time(0));
sotter 1:be91a16b48ea 420 int mon1 = (rand()%3)+2; //2-4
sotter 1:be91a16b48ea 421 int B1 = (rand()%3)+5; //5-7
sotter 1:be91a16b48ea 422 int mon2 = (rand()%3)+8; //8-10
sotter 1:be91a16b48ea 423 int T1 = (rand()%3)+11; //11-13
sotter 1:be91a16b48ea 424 int mon3 = (rand()%3)+14; //14-16
sotter 1:be91a16b48ea 425 int B2 = (rand()%3)+17; //17-19
sotter 1:be91a16b48ea 426 int mon4 = (rand()%2)+20; //20-21-------------2
sotter 1:be91a16b48ea 427 int T2 = (rand()%2)+22; //22-23
sotter 1:be91a16b48ea 428 int mon5 = (rand()%2)+24; //24-25
sotter 1:be91a16b48ea 429 int B3 = (rand()%2)+26; //26-27
sotter 1:be91a16b48ea 430 int mon6 = (rand()%2)+28; //28-29
sotter 1:be91a16b48ea 431 int T3 = (rand()%2)+30; //30-31
sotter 1:be91a16b48ea 432 int mon7 = (rand()%2)+32; //32-33
sotter 1:be91a16b48ea 433 int B4 = (rand()%2)+34; //34-35
sotter 1:be91a16b48ea 434 int mon8 = (rand()%2)+36; //36-37
sotter 1:be91a16b48ea 435 int T4 = (rand()%2)+38; //38-39
sotter 1:be91a16b48ea 436 int mon9 = (rand()%2)+40; //40-41
sotter 1:be91a16b48ea 437 int B5 = (rand()%2)+42; //42-43
sotter 1:be91a16b48ea 438 int mon10 = (rand()%2)+44; //44-45
sotter 1:be91a16b48ea 439 int T5 = (rand()%2)+46; //46-47
sotter 1:be91a16b48ea 440 int mon11 = (rand()%2)+48; //48-49
sotter 1:be91a16b48ea 441 int B6 = (rand()%2)+50; //50-51
sotter 1:be91a16b48ea 442 int mon12 = (rand()%2)+52; //52-53
sotter 1:be91a16b48ea 443 int T6 = (rand()%2)+54; //54-55
sotter 1:be91a16b48ea 444 int mon13 = (rand()%2)+56; //56-57
sotter 1:be91a16b48ea 445 int mon14 = (rand()%2)+58; //58-59
sotter 1:be91a16b48ea 446 int mon15 = (rand()%2)+60; //60-61
sotter 1:be91a16b48ea 447 int mon16 = (rand()%2)+62; //62-63
sotter 1:be91a16b48ea 448
sotter 1:be91a16b48ea 449 position_mission = mon1;
sotter 1:be91a16b48ea 450 mission();
sotter 1:be91a16b48ea 451 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 452 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 453 }
sotter 1:be91a16b48ea 454
sotter 1:be91a16b48ea 455 position_mission = mon2;
sotter 1:be91a16b48ea 456 mission();
sotter 1:be91a16b48ea 457 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 458 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 459 }
sotter 1:be91a16b48ea 460
sotter 1:be91a16b48ea 461 position_mission = mon3;
sotter 1:be91a16b48ea 462 mission();
sotter 1:be91a16b48ea 463 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 464 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 465 }
sotter 1:be91a16b48ea 466
sotter 1:be91a16b48ea 467 position_mission = mon4;
sotter 1:be91a16b48ea 468 mission();
sotter 1:be91a16b48ea 469 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 470 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 471 }
sotter 1:be91a16b48ea 472
sotter 1:be91a16b48ea 473 position_mission = mon5;
sotter 1:be91a16b48ea 474 mission();
sotter 1:be91a16b48ea 475 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 476 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 477 }
sotter 1:be91a16b48ea 478
sotter 1:be91a16b48ea 479 position_mission = mon6;
sotter 1:be91a16b48ea 480 mission();
sotter 1:be91a16b48ea 481 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 482 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 483 }
sotter 1:be91a16b48ea 484
sotter 1:be91a16b48ea 485 position_mission = mon7;
sotter 1:be91a16b48ea 486 mission();
sotter 1:be91a16b48ea 487 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 488 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 489 }
sotter 1:be91a16b48ea 490
sotter 1:be91a16b48ea 491 position_mission = mon8;
sotter 1:be91a16b48ea 492 mission();
sotter 1:be91a16b48ea 493 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 494 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 495 }
sotter 1:be91a16b48ea 496 position_mission = mon9;
sotter 1:be91a16b48ea 497 mission();
sotter 1:be91a16b48ea 498 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 499 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 500 }
sotter 1:be91a16b48ea 501 position_mission = mon10;
sotter 1:be91a16b48ea 502 mission();
sotter 1:be91a16b48ea 503 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 504 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 505 }
sotter 1:be91a16b48ea 506
sotter 1:be91a16b48ea 507 position_mission = mon11;
sotter 1:be91a16b48ea 508 mission();
sotter 1:be91a16b48ea 509 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 510 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 511 }
sotter 1:be91a16b48ea 512
sotter 1:be91a16b48ea 513 position_mission = mon12;
sotter 1:be91a16b48ea 514 mission();
sotter 1:be91a16b48ea 515 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 516 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 517 }
sotter 1:be91a16b48ea 518
sotter 1:be91a16b48ea 519 position_mission = mon13;
sotter 1:be91a16b48ea 520 mission();
sotter 1:be91a16b48ea 521 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 522 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 523 }
sotter 1:be91a16b48ea 524
sotter 1:be91a16b48ea 525 position_mission = mon14;
sotter 1:be91a16b48ea 526 mission();
sotter 1:be91a16b48ea 527 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 528 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 529 }
sotter 1:be91a16b48ea 530
sotter 1:be91a16b48ea 531 position_mission = mon15;
sotter 1:be91a16b48ea 532 mission();
sotter 1:be91a16b48ea 533 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 534 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 535 }
sotter 1:be91a16b48ea 536
sotter 1:be91a16b48ea 537 position_mission = mon16;
sotter 1:be91a16b48ea 538 mission();
sotter 1:be91a16b48ea 539 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 540 board[position_x][position_y] = 'M';
sotter 1:be91a16b48ea 541 }
sotter 1:be91a16b48ea 542
sotter 1:be91a16b48ea 543 position_mission = B1;
sotter 1:be91a16b48ea 544 mission();
sotter 1:be91a16b48ea 545 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 546 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 547 }
sotter 1:be91a16b48ea 548
sotter 1:be91a16b48ea 549 position_mission = B2;
sotter 1:be91a16b48ea 550 mission();
sotter 1:be91a16b48ea 551 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 552 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 553 }
sotter 1:be91a16b48ea 554
sotter 1:be91a16b48ea 555 position_mission = B3;
sotter 1:be91a16b48ea 556 mission();
sotter 1:be91a16b48ea 557 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 558 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 559 }
sotter 1:be91a16b48ea 560
sotter 1:be91a16b48ea 561 position_mission = B4;
sotter 1:be91a16b48ea 562 mission();
sotter 1:be91a16b48ea 563 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 564 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 565 }
sotter 1:be91a16b48ea 566
sotter 1:be91a16b48ea 567 position_mission = B5;
sotter 1:be91a16b48ea 568 mission();
sotter 1:be91a16b48ea 569 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 570 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 571 }
sotter 1:be91a16b48ea 572
sotter 1:be91a16b48ea 573 position_mission = B6;
sotter 1:be91a16b48ea 574 mission();
sotter 1:be91a16b48ea 575 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 576 board[position_x][position_y] = 'B';
sotter 1:be91a16b48ea 577 }
sotter 1:be91a16b48ea 578
sotter 1:be91a16b48ea 579 position_mission = T1;
sotter 1:be91a16b48ea 580 mission();
sotter 1:be91a16b48ea 581 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 582 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 583 }
sotter 1:be91a16b48ea 584
sotter 1:be91a16b48ea 585 position_mission = T2;
sotter 1:be91a16b48ea 586 mission();
sotter 1:be91a16b48ea 587 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 588 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 589 }
sotter 1:be91a16b48ea 590
sotter 1:be91a16b48ea 591 position_mission = T3;
sotter 1:be91a16b48ea 592 mission();
sotter 1:be91a16b48ea 593 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 594 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 595 }
sotter 1:be91a16b48ea 596
sotter 1:be91a16b48ea 597 position_mission = T4;
sotter 1:be91a16b48ea 598 mission();
sotter 1:be91a16b48ea 599 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 600 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 601 }
sotter 1:be91a16b48ea 602
sotter 1:be91a16b48ea 603 position_mission = T5;
sotter 1:be91a16b48ea 604 mission();
sotter 1:be91a16b48ea 605 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 606 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 607 }
sotter 1:be91a16b48ea 608
sotter 1:be91a16b48ea 609 position_mission = T6;
sotter 1:be91a16b48ea 610 mission();
sotter 1:be91a16b48ea 611 if (board[position_x][position_y]=='O'){
sotter 1:be91a16b48ea 612 board[position_x][position_y] = 'T';
sotter 1:be91a16b48ea 613 }
sotter 1:be91a16b48ea 614
sotter 1:be91a16b48ea 615 position_mission = 1;
sotter 1:be91a16b48ea 616 mission();
sotter 1:be91a16b48ea 617 }
sotter 1:be91a16b48ea 618
sotter 1:be91a16b48ea 619 void led2(){
sotter 1:be91a16b48ea 620 if (position_x==7){
sotter 1:be91a16b48ea 621 hero_led[position_y] = 0x01;
sotter 1:be91a16b48ea 622 }
sotter 1:be91a16b48ea 623 if (position_x==6){
sotter 1:be91a16b48ea 624 hero_led[position_y] = 0x02;
sotter 1:be91a16b48ea 625 }
sotter 1:be91a16b48ea 626 if (position_x==5){
sotter 1:be91a16b48ea 627 hero_led[position_y] = 0x04;
sotter 1:be91a16b48ea 628 }
sotter 1:be91a16b48ea 629 if (position_x==4){
sotter 1:be91a16b48ea 630 hero_led[position_y] = 0x08;
sotter 1:be91a16b48ea 631 }
sotter 1:be91a16b48ea 632 if (position_x==3){
sotter 1:be91a16b48ea 633 hero_led[position_y] = 0x10;
sotter 1:be91a16b48ea 634 }
sotter 1:be91a16b48ea 635 if (position_x==2){
sotter 1:be91a16b48ea 636 hero_led[position_y] = 0x20;
sotter 1:be91a16b48ea 637 }
sotter 1:be91a16b48ea 638 if (position_x==1){
sotter 1:be91a16b48ea 639 hero_led[position_y] = 0x40;
sotter 1:be91a16b48ea 640 }
sotter 1:be91a16b48ea 641 if (position_x==0){
sotter 1:be91a16b48ea 642 hero_led[position_y] = 0x80;
sotter 1:be91a16b48ea 643 }
sotter 1:be91a16b48ea 644 }
sotter 1:be91a16b48ea 645
sotter 1:be91a16b48ea 646 void read_m(){
sotter 1:be91a16b48ea 647 for(int i=0;i<8;i++){
sotter 1:be91a16b48ea 648 for(int j=0;j<8;j++){
sotter 1:be91a16b48ea 649 if (board[j][i]=='M'){
sotter 1:be91a16b48ea 650 bit_m[i][j] = 1;
sotter 1:be91a16b48ea 651 }
sotter 1:be91a16b48ea 652 else{
sotter 1:be91a16b48ea 653 bit_m[i][j] = 0;
sotter 1:be91a16b48ea 654 }
sotter 1:be91a16b48ea 655 }
sotter 1:be91a16b48ea 656 }
sotter 1:be91a16b48ea 657 }
sotter 1:be91a16b48ea 658
sotter 1:be91a16b48ea 659 void read_i(){
sotter 1:be91a16b48ea 660 for(int i=0;i<8;i++){
sotter 1:be91a16b48ea 661 for(int j=0;j<8;j++){
sotter 1:be91a16b48ea 662 if (board[j][i]=='B' || board[j][i]=='T'){
sotter 1:be91a16b48ea 663 bit_i[i][j] = 1;
sotter 1:be91a16b48ea 664 }
sotter 1:be91a16b48ea 665 else{
sotter 1:be91a16b48ea 666 bit_i[i][j] = 0;
sotter 1:be91a16b48ea 667 }
sotter 1:be91a16b48ea 668 }
sotter 1:be91a16b48ea 669 }
sotter 1:be91a16b48ea 670 }
sotter 1:be91a16b48ea 671
sotter 1:be91a16b48ea 672 void print_bit_m(){
sotter 1:be91a16b48ea 673 for(int i=0;i<8;i++){
sotter 1:be91a16b48ea 674 pc.printf("\n");
sotter 1:be91a16b48ea 675 for(int j=0;j<8;j++){
sotter 1:be91a16b48ea 676 pc.printf("%d",bit_m[i][j]);
sotter 1:be91a16b48ea 677 }
sotter 1:be91a16b48ea 678 }
sotter 1:be91a16b48ea 679 pc.printf("\n");
sotter 1:be91a16b48ea 680 }
sotter 1:be91a16b48ea 681
sotter 1:be91a16b48ea 682 void print_bit_i(){
sotter 1:be91a16b48ea 683 for(int i=0;i<8;i++){
sotter 1:be91a16b48ea 684 pc.printf("\n");
sotter 1:be91a16b48ea 685 for(int j=0;j<8;j++){
sotter 1:be91a16b48ea 686 pc.printf("%d",bit_i[i][j]);
sotter 1:be91a16b48ea 687 }
sotter 1:be91a16b48ea 688 }
sotter 1:be91a16b48ea 689 pc.printf("\n");
sotter 1:be91a16b48ea 690 }
sotter 1:be91a16b48ea 691
sotter 1:be91a16b48ea 692 void cal_m(){
sotter 1:be91a16b48ea 693 int a,b,c;
sotter 1:be91a16b48ea 694 for (int i=0;i<8;i++){
sotter 1:be91a16b48ea 695 a = bit_m[i][0]*8+bit_m[i][1]*4+bit_m[i][2]*2+bit_m[i][3];
sotter 1:be91a16b48ea 696 // pc.printf("(%d)",a);
sotter 1:be91a16b48ea 697 b = bit_m[i][4]*8+bit_m[i][5]*4+bit_m[i][6]*2+bit_m[i][7];
sotter 1:be91a16b48ea 698 // pc.printf("(%d)",b);
sotter 1:be91a16b48ea 699 c = a*16+b;
sotter 1:be91a16b48ea 700 // pc.printf("(%d)",c);
sotter 1:be91a16b48ea 701 M_led[i] = c;
sotter 1:be91a16b48ea 702 // pc.printf("(%2x)",M_led[i]);
sotter 1:be91a16b48ea 703 }
sotter 1:be91a16b48ea 704 }
sotter 1:be91a16b48ea 705
sotter 1:be91a16b48ea 706 void cal_i(){
sotter 1:be91a16b48ea 707 int a,b,c;
sotter 1:be91a16b48ea 708 for (int i=0;i<8;i++){
sotter 1:be91a16b48ea 709 a = bit_i[i][0]*8+bit_i[i][1]*4+bit_i[i][2]*2+bit_i[i][3];
sotter 1:be91a16b48ea 710 // pc.printf("(%d)",a);
sotter 1:be91a16b48ea 711 b = bit_i[i][4]*8+bit_i[i][5]*4+bit_i[i][6]*2+bit_i[i][7];
sotter 1:be91a16b48ea 712 // pc.printf("(%d)",b);
sotter 1:be91a16b48ea 713 c = a*16+b;
sotter 1:be91a16b48ea 714 // pc.printf("(%d)",c);
sotter 1:be91a16b48ea 715 I_led[i] = c;
sotter 1:be91a16b48ea 716 // pc.printf("(%2x)",M_led[i]);
sotter 1:be91a16b48ea 717 }
sotter 1:be91a16b48ea 718 }
sotter 1:be91a16b48ea 719
sotter 1:be91a16b48ea 720 //int y = 85;
sotter 1:be91a16b48ea 721 // pc.printf("(%d)",y);
sotter 1:be91a16b48ea 722 // pc.printf("(%2x)",y);
sotter 1:be91a16b48ea 723 // M_led[1] = y;
sotter 1:be91a16b48ea 724 // pc.printf("(%2x)",M_led[1]);
dragondrunk 0:6e7a6e71dad3 725
dragondrunk 0:6e7a6e71dad3 726 int main(){
sotter 1:be91a16b48ea 727
dragondrunk 0:6e7a6e71dad3 728 dotmatrix.init();
sotter 1:be91a16b48ea 729
sotter 1:be91a16b48ea 730 //monster_easy();
sotter 1:be91a16b48ea 731 //monster_medium();
sotter 1:be91a16b48ea 732 monster_hard();
sotter 1:be91a16b48ea 733 map();
sotter 1:be91a16b48ea 734 print_mission();
sotter 1:be91a16b48ea 735 print_position();
sotter 1:be91a16b48ea 736 read_m();
sotter 1:be91a16b48ea 737 // print_bit_m();
sotter 1:be91a16b48ea 738 cal_m();
sotter 1:be91a16b48ea 739 read_i();
sotter 1:be91a16b48ea 740 // print_bit_i();
sotter 1:be91a16b48ea 741 cal_i();
sotter 1:be91a16b48ea 742
sotter 1:be91a16b48ea 743 while(1){
sotter 1:be91a16b48ea 744 dotmatrix.display_pic(map_led,blue);
sotter 1:be91a16b48ea 745 dotmatrix.display_pic(hero_led,green);
sotter 1:be91a16b48ea 746 dotmatrix.display_pic(boss_led,red);
sotter 1:be91a16b48ea 747 dotmatrix.display_pic(M_led,M);
sotter 1:be91a16b48ea 748 dotmatrix.display_pic(I_led,I);
sotter 1:be91a16b48ea 749
sotter 1:be91a16b48ea 750 if (sw==0){
sotter 1:be91a16b48ea 751 hero_led[position_y] = 0x00;
sotter 1:be91a16b48ea 752 random();
sotter 1:be91a16b48ea 753 map();
sotter 1:be91a16b48ea 754 print_mission();
sotter 1:be91a16b48ea 755 print_position();
sotter 1:be91a16b48ea 756 led2();
sotter 1:be91a16b48ea 757
sotter 1:be91a16b48ea 758 bit_m[position_x][position_y] = 0;
sotter 1:be91a16b48ea 759 read_m();
sotter 1:be91a16b48ea 760 cal_m();
sotter 1:be91a16b48ea 761 bit_i[position_x][position_y] = 0;
sotter 1:be91a16b48ea 762 read_i();
sotter 1:be91a16b48ea 763 cal_i();
sotter 1:be91a16b48ea 764 }
sotter 1:be91a16b48ea 765 }
dragondrunk 0:6e7a6e71dad3 766 }