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