h

Dependencies:   mbed 4DGL-uLCD-SE PinDetect

Committer:
cdong49
Date:
Mon Oct 21 04:20:42 2019 +0000
Revision:
0:5b7c2ab43c28
poop

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cdong49 0:5b7c2ab43c28 1 #include "uLCD_4DGL.h"
cdong49 0:5b7c2ab43c28 2 #include "PinDetect.h"
cdong49 0:5b7c2ab43c28 3 #include "mbed.h"
cdong49 0:5b7c2ab43c28 4 #include <ctime> // For time()
cdong49 0:5b7c2ab43c28 5 #include <cstdlib> // For srand() and rand()
cdong49 0:5b7c2ab43c28 6 #include "Speaker.h"
cdong49 0:5b7c2ab43c28 7 uLCD_4DGL uLCD(p9, p10, p11);
cdong49 0:5b7c2ab43c28 8
cdong49 0:5b7c2ab43c28 9 PinDetect pbLeft(p21); //left
cdong49 0:5b7c2ab43c28 10 PinDetect pbRight(p22); //right
cdong49 0:5b7c2ab43c28 11 PinDetect pbExit(p23); //Exit
cdong49 0:5b7c2ab43c28 12 Speaker mySpeaker(p24);
cdong49 0:5b7c2ab43c28 13
cdong49 0:5b7c2ab43c28 14 int lemur_game();
cdong49 0:5b7c2ab43c28 15 void print_result_screen(bool left, int delay);
cdong49 0:5b7c2ab43c28 16 void print_exit_screen();
cdong49 0:5b7c2ab43c28 17 int check_value_in_random_array(int &val);
cdong49 0:5b7c2ab43c28 18 void clear_random_array();
cdong49 0:5b7c2ab43c28 19 void generate_shape(int box, int shape);
cdong49 0:5b7c2ab43c28 20 void start_up_hello();
cdong49 0:5b7c2ab43c28 21 void clear_screen();
cdong49 0:5b7c2ab43c28 22 void print_two_white_rect();
cdong49 0:5b7c2ab43c28 23 void print_random_circle(int x1, int y1, int x2, int y2);
cdong49 0:5b7c2ab43c28 24 void print_random_triangle(int x1, int y1, int x2, int y2);
cdong49 0:5b7c2ab43c28 25 void print_random_square(int x1, int y1, int x2, int y2);
cdong49 0:5b7c2ab43c28 26 void pick_spot(int box, int index, int* result);
cdong49 0:5b7c2ab43c28 27
cdong49 0:5b7c2ab43c28 28 int arr[4]; // store x1, y1, x2, y2
cdong49 0:5b7c2ab43c28 29 int rand0 = 0; // number of random objects in left box
cdong49 0:5b7c2ab43c28 30 int rand1 = 0; // the number of random objects in right box
cdong49 0:5b7c2ab43c28 31 int random_check_array[15] = {};
cdong49 0:5b7c2ab43c28 32 int random_check_value = 0;
cdong49 0:5b7c2ab43c28 33 int trial_number = 1;
cdong49 0:5b7c2ab43c28 34 int correct_trial_number = 0;
cdong49 0:5b7c2ab43c28 35
cdong49 0:5b7c2ab43c28 36
cdong49 0:5b7c2ab43c28 37 int main() {
cdong49 0:5b7c2ab43c28 38 start_up_hello();
cdong49 0:5b7c2ab43c28 39 pbLeft.mode(PullUp);
cdong49 0:5b7c2ab43c28 40 pbRight.mode(PullUp);
cdong49 0:5b7c2ab43c28 41 pbExit.mode(PullUp);
cdong49 0:5b7c2ab43c28 42 wait_ms(1000);
cdong49 0:5b7c2ab43c28 43 print_two_white_rect(); // init the 2 rectangular box
cdong49 0:5b7c2ab43c28 44 srand(time(0));
cdong49 0:5b7c2ab43c28 45 lemur_game(); // start trial!
cdong49 0:5b7c2ab43c28 46 }
cdong49 0:5b7c2ab43c28 47
cdong49 0:5b7c2ab43c28 48 int lemur_game() {
cdong49 0:5b7c2ab43c28 49 while(1) {
cdong49 0:5b7c2ab43c28 50 Timer t = Timer();
cdong49 0:5b7c2ab43c28 51 int shape = rand()%3;
cdong49 0:5b7c2ab43c28 52 generate_shape(0, shape);
cdong49 0:5b7c2ab43c28 53 generate_shape(1, shape);
cdong49 0:5b7c2ab43c28 54 t.start();
cdong49 0:5b7c2ab43c28 55 bool done = false;
cdong49 0:5b7c2ab43c28 56 int left = 0;
cdong49 0:5b7c2ab43c28 57 while(!done) {
cdong49 0:5b7c2ab43c28 58 if(!pbLeft) {
cdong49 0:5b7c2ab43c28 59 t.stop();
cdong49 0:5b7c2ab43c28 60 done = true;
cdong49 0:5b7c2ab43c28 61 left = true;
cdong49 0:5b7c2ab43c28 62 wait_ms(1000);
cdong49 0:5b7c2ab43c28 63 }
cdong49 0:5b7c2ab43c28 64 if(!pbRight) {
cdong49 0:5b7c2ab43c28 65 t.stop();
cdong49 0:5b7c2ab43c28 66 done = true;
cdong49 0:5b7c2ab43c28 67 left = false;
cdong49 0:5b7c2ab43c28 68 wait_ms(1000);
cdong49 0:5b7c2ab43c28 69 }
cdong49 0:5b7c2ab43c28 70 if(!pbExit) {
cdong49 0:5b7c2ab43c28 71 print_exit_screen();
cdong49 0:5b7c2ab43c28 72 return 1;
cdong49 0:5b7c2ab43c28 73 }
cdong49 0:5b7c2ab43c28 74 }
cdong49 0:5b7c2ab43c28 75
cdong49 0:5b7c2ab43c28 76 print_result_screen(left, t.read_ms());
cdong49 0:5b7c2ab43c28 77 t.reset();
cdong49 0:5b7c2ab43c28 78 clear_screen();
cdong49 0:5b7c2ab43c28 79 }
cdong49 0:5b7c2ab43c28 80 }
cdong49 0:5b7c2ab43c28 81
cdong49 0:5b7c2ab43c28 82 void print_result_screen(bool left, int delay) { // print result screen after each trial
cdong49 0:5b7c2ab43c28 83 if((left && rand0 < rand1) || (!left && rand1 < rand0)) { // check if the button hit was right or not
cdong49 0:5b7c2ab43c28 84 correct_trial_number++; // if its right, execute the correct code
cdong49 0:5b7c2ab43c28 85 uLCD.cls();
cdong49 0:5b7c2ab43c28 86 uLCD.textbackground_color(0x000000);
cdong49 0:5b7c2ab43c28 87 uLCD.color(GREEN);
cdong49 0:5b7c2ab43c28 88 uLCD.text_bold(TEXTBOLD);
cdong49 0:5b7c2ab43c28 89 uLCD.text_height(1.5);
cdong49 0:5b7c2ab43c28 90 uLCD.text_width(1.5);
cdong49 0:5b7c2ab43c28 91 uLCD.locate(6, 4);
cdong49 0:5b7c2ab43c28 92 uLCD.printf("Trial %d\n", trial_number);
cdong49 0:5b7c2ab43c28 93 uLCD.locate(2, 6);
cdong49 0:5b7c2ab43c28 94 uLCD.printf("You are correct!\n");
cdong49 0:5b7c2ab43c28 95 uLCD.locate(4,8);
cdong49 0:5b7c2ab43c28 96 uLCD.printf("time: %dms\n", delay);
cdong49 0:5b7c2ab43c28 97 uLCD.locate(1, 10);
cdong49 0:5b7c2ab43c28 98 uLCD.printf("fraction correct:\n");
cdong49 0:5b7c2ab43c28 99 uLCD.locate(6, 12);
cdong49 0:5b7c2ab43c28 100 uLCD.printf("%.2f%%\n", (((float)correct_trial_number)/trial_number)*100.0);
cdong49 0:5b7c2ab43c28 101 wait_ms(2000); //wait 2s
cdong49 0:5b7c2ab43c28 102 uLCD.cls();
cdong49 0:5b7c2ab43c28 103 } else {
cdong49 0:5b7c2ab43c28 104 uLCD.cls(); // execute the incorrect code
cdong49 0:5b7c2ab43c28 105 uLCD.textbackground_color(0x000000);
cdong49 0:5b7c2ab43c28 106 uLCD.color(GREEN);
cdong49 0:5b7c2ab43c28 107 uLCD.text_bold(TEXTBOLD);
cdong49 0:5b7c2ab43c28 108 uLCD.text_height(1.5);
cdong49 0:5b7c2ab43c28 109 uLCD.text_width(1.5);
cdong49 0:5b7c2ab43c28 110 uLCD.locate(6, 4);
cdong49 0:5b7c2ab43c28 111 uLCD.printf("Trial %d\n", trial_number);
cdong49 0:5b7c2ab43c28 112 uLCD.locate(1, 6);
cdong49 0:5b7c2ab43c28 113 uLCD.printf("You are incorrect\n");
cdong49 0:5b7c2ab43c28 114 uLCD.locate(4,8);
cdong49 0:5b7c2ab43c28 115 uLCD.printf("time: %dms\n", delay);
cdong49 0:5b7c2ab43c28 116 uLCD.locate(1, 10);
cdong49 0:5b7c2ab43c28 117 uLCD.printf("fraction correct:\n");
cdong49 0:5b7c2ab43c28 118 uLCD.locate(6, 12);
cdong49 0:5b7c2ab43c28 119 uLCD.printf("%.2f%%\n", (((float)correct_trial_number)/trial_number)*100.0);
cdong49 0:5b7c2ab43c28 120 wait_ms(2000); //wait 2s
cdong49 0:5b7c2ab43c28 121 uLCD.cls();
cdong49 0:5b7c2ab43c28 122 }
cdong49 0:5b7c2ab43c28 123 trial_number++; // increment trial_number
cdong49 0:5b7c2ab43c28 124 }
cdong49 0:5b7c2ab43c28 125 void print_exit_screen() { // print exit screen when exit button is hit
cdong49 0:5b7c2ab43c28 126 uLCD.cls();
cdong49 0:5b7c2ab43c28 127 uLCD.textbackground_color(0x000000);
cdong49 0:5b7c2ab43c28 128 uLCD.color(GREEN);
cdong49 0:5b7c2ab43c28 129 uLCD.text_bold(TEXTBOLD);
cdong49 0:5b7c2ab43c28 130 uLCD.text_height(1.5);
cdong49 0:5b7c2ab43c28 131 uLCD.text_width(1.5);
cdong49 0:5b7c2ab43c28 132 uLCD.locate(4, 4);
cdong49 0:5b7c2ab43c28 133 uLCD.printf("Trial Done!\n");
cdong49 0:5b7c2ab43c28 134 uLCD.locate(2, 7);
cdong49 0:5b7c2ab43c28 135 uLCD.printf("You've been an\n");
cdong49 0:5b7c2ab43c28 136 uLCD.locate(3, 10);
cdong49 0:5b7c2ab43c28 137 uLCD.printf("Awesome lemur\n");
cdong49 0:5b7c2ab43c28 138 wait_ms(2000); //wait 2s
cdong49 0:5b7c2ab43c28 139 uLCD.cls();
cdong49 0:5b7c2ab43c28 140 }
cdong49 0:5b7c2ab43c28 141
cdong49 0:5b7c2ab43c28 142 int check_value_in_random_array(int &val) { // return -1 if not found. This takes in a value and we compare it with every value in our random_check_array
cdong49 0:5b7c2ab43c28 143 for(int i = 0; i < sizeof(random_check_array)/sizeof(int); i++) { // if our current random_check_array does not contain any value equals to val, return -1
cdong49 0:5b7c2ab43c28 144 if(random_check_array[i] == val) { // else return 1
cdong49 0:5b7c2ab43c28 145 return 1;
cdong49 0:5b7c2ab43c28 146 }
cdong49 0:5b7c2ab43c28 147 }
cdong49 0:5b7c2ab43c28 148 return -1;
cdong49 0:5b7c2ab43c28 149 }
cdong49 0:5b7c2ab43c28 150 void clear_random_array() { // reset random array and random_check_value
cdong49 0:5b7c2ab43c28 151 for(int i = 0; i < sizeof(random_check_array)/sizeof(int); i++) {
cdong49 0:5b7c2ab43c28 152 random_check_array[i] = -1;
cdong49 0:5b7c2ab43c28 153 }
cdong49 0:5b7c2ab43c28 154 random_check_value = 0;
cdong49 0:5b7c2ab43c28 155 }
cdong49 0:5b7c2ab43c28 156 void generate_shape(int box, int shape) { // This method will generate the shapes in a specific box, box = 0 -> left box, box = 1 -> right box. shape = 0 -> circle
cdong49 0:5b7c2ab43c28 157 int pos; // shape = 1 -> triangle, shape = 2 -> square
cdong49 0:5b7c2ab43c28 158 if(box == 0) { // left box
cdong49 0:5b7c2ab43c28 159 do {
cdong49 0:5b7c2ab43c28 160 rand0 = rand()%15 + 1;
cdong49 0:5b7c2ab43c28 161 } while(rand0 == rand1); // randomly get the number of shape for this box and make sure it is not the same number as the other box
cdong49 0:5b7c2ab43c28 162 for(int i = 0; i < rand0;i++) { // loop from 0 to that number-1 to generate shapes
cdong49 0:5b7c2ab43c28 163 pos = rand()%18; // pos will check to make sure all shapes are uniquely placed and no shape is overwritten by any other shape
cdong49 0:5b7c2ab43c28 164 while(check_value_in_random_array(pos) == 1) {
cdong49 0:5b7c2ab43c28 165 pos = rand()%18;
cdong49 0:5b7c2ab43c28 166 }
cdong49 0:5b7c2ab43c28 167
cdong49 0:5b7c2ab43c28 168 random_check_array[random_check_value] = pos; // push pos onto the random_check_value array to keep checking
cdong49 0:5b7c2ab43c28 169 random_check_value++;
cdong49 0:5b7c2ab43c28 170 pick_spot(box, pos, arr); // call pick_spot to assign values to arr element. arr[0] stores x1, arr[1] stores y1, arr[2] stores x2, arr[3] stores y3
cdong49 0:5b7c2ab43c28 171 if(shape == 0) { // generate the shape based on our random input
cdong49 0:5b7c2ab43c28 172 print_random_circle(arr[0], arr[1], arr[2], arr[3]);
cdong49 0:5b7c2ab43c28 173 } else if(shape == 1) {
cdong49 0:5b7c2ab43c28 174 print_random_triangle(arr[0], arr[1], arr[2], arr[3]);
cdong49 0:5b7c2ab43c28 175 } else if(shape == 2) {
cdong49 0:5b7c2ab43c28 176 print_random_square(arr[0], arr[1], arr[2], arr[3]);
cdong49 0:5b7c2ab43c28 177 }
cdong49 0:5b7c2ab43c28 178 }
cdong49 0:5b7c2ab43c28 179 clear_random_array(); // clear to reset random_check_array
cdong49 0:5b7c2ab43c28 180 } else if(box == 1) { // do the same thing but with box 1
cdong49 0:5b7c2ab43c28 181 do {
cdong49 0:5b7c2ab43c28 182 rand1 = rand()%15 + 1;
cdong49 0:5b7c2ab43c28 183 } while(rand0 == rand1);
cdong49 0:5b7c2ab43c28 184 for(int i = 0; i < rand1;i++) {
cdong49 0:5b7c2ab43c28 185 pos = rand()%18;
cdong49 0:5b7c2ab43c28 186 while(check_value_in_random_array(pos) == 1) {
cdong49 0:5b7c2ab43c28 187 pos = rand()%18;
cdong49 0:5b7c2ab43c28 188 }
cdong49 0:5b7c2ab43c28 189 random_check_array[random_check_value] = pos;
cdong49 0:5b7c2ab43c28 190 random_check_value++;
cdong49 0:5b7c2ab43c28 191 pick_spot(box, pos, arr);
cdong49 0:5b7c2ab43c28 192 if(shape == 0) {
cdong49 0:5b7c2ab43c28 193 print_random_circle(arr[0], arr[1], arr[2], arr[3]);
cdong49 0:5b7c2ab43c28 194 } else if(shape == 1) {
cdong49 0:5b7c2ab43c28 195 print_random_triangle(arr[0], arr[1], arr[2], arr[3]);
cdong49 0:5b7c2ab43c28 196 } else if(shape == 2) {
cdong49 0:5b7c2ab43c28 197 print_random_square(arr[0], arr[1], arr[2], arr[3]);
cdong49 0:5b7c2ab43c28 198 }
cdong49 0:5b7c2ab43c28 199 }
cdong49 0:5b7c2ab43c28 200 clear_random_array();
cdong49 0:5b7c2ab43c28 201 }
cdong49 0:5b7c2ab43c28 202 }
cdong49 0:5b7c2ab43c28 203 void start_up_hello() { // 1.1, print the startup screen and play some music
cdong49 0:5b7c2ab43c28 204 uLCD.textbackground_color(0x000000);
cdong49 0:5b7c2ab43c28 205 uLCD.color(GREEN);
cdong49 0:5b7c2ab43c28 206 uLCD.text_bold(TEXTBOLD);
cdong49 0:5b7c2ab43c28 207 uLCD.text_height(1.5);
cdong49 0:5b7c2ab43c28 208 uLCD.text_width(1.5);
cdong49 0:5b7c2ab43c28 209 uLCD.locate(4, 4);
cdong49 0:5b7c2ab43c28 210 uLCD.printf("Welcome to\n");
cdong49 0:5b7c2ab43c28 211 uLCD.locate(2, 7);
cdong49 0:5b7c2ab43c28 212 uLCD.printf("Peter's Awesome\n");
cdong49 0:5b7c2ab43c28 213 uLCD.locate(3, 10);
cdong49 0:5b7c2ab43c28 214 uLCD.printf("Lemur Party\n");
cdong49 0:5b7c2ab43c28 215 wait_ms(5000);
cdong49 0:5b7c2ab43c28 216 mySpeaker.PlayNote(400, 0.5, 0.5);
cdong49 0:5b7c2ab43c28 217 mySpeaker.PlayNote(400, 0.5, 0.5);
cdong49 0:5b7c2ab43c28 218 mySpeaker.PlayNote(450, 0.8, 0.5);
cdong49 0:5b7c2ab43c28 219 mySpeaker.PlayNote(400, 0.8, 0.5);
cdong49 0:5b7c2ab43c28 220 mySpeaker.PlayNote(540, 0.8, 0.5);
cdong49 0:5b7c2ab43c28 221 mySpeaker.PlayNote(500, 0.8, 0.5);
cdong49 0:5b7c2ab43c28 222
cdong49 0:5b7c2ab43c28 223 wait_ms(2000); //wait 2s
cdong49 0:5b7c2ab43c28 224 uLCD.cls();
cdong49 0:5b7c2ab43c28 225 }
cdong49 0:5b7c2ab43c28 226 void clear_screen() { // clear the trial screen, leaving two empty white boxes
cdong49 0:5b7c2ab43c28 227 uLCD.cls();
cdong49 0:5b7c2ab43c28 228 print_two_white_rect();
cdong49 0:5b7c2ab43c28 229 wait_ms(200);
cdong49 0:5b7c2ab43c28 230 }
cdong49 0:5b7c2ab43c28 231 void print_two_white_rect() { // print the empty white boxes
cdong49 0:5b7c2ab43c28 232 uLCD.filled_rectangle(0, 0, 62, 1, 0xFFFFFF); // I was a dumbass here I should've called rectangle 2 times instead of doing a bunch of small filled_rectangle lmao
cdong49 0:5b7c2ab43c28 233 uLCD.filled_rectangle(64,0, 126, 1, 0xFFFFFF); // I'm too lazy to fix this to make it cleaner so bear with me! :D
cdong49 0:5b7c2ab43c28 234
cdong49 0:5b7c2ab43c28 235 uLCD.filled_rectangle(0, 0, 1, 122, 0xFFFFFF);
cdong49 0:5b7c2ab43c28 236 uLCD.filled_rectangle(61, 0, 62, 122, 0xFFFFFF);
cdong49 0:5b7c2ab43c28 237 uLCD.filled_rectangle(64, 0, 65, 122, 0xFFFFFF);
cdong49 0:5b7c2ab43c28 238 uLCD.filled_rectangle(125, 0, 126, 122, 0xFFFFFF);
cdong49 0:5b7c2ab43c28 239
cdong49 0:5b7c2ab43c28 240 uLCD.filled_rectangle(0, 121, 62, 122, 0xFFFFFF);
cdong49 0:5b7c2ab43c28 241 uLCD.filled_rectangle(64, 121, 126, 122, 0xFFFFFF);
cdong49 0:5b7c2ab43c28 242 }
cdong49 0:5b7c2ab43c28 243
cdong49 0:5b7c2ab43c28 244 void print_random_circle(int x1, int y1, int x2, int y2) { // print a circle at the specific position given with a random radius
cdong49 0:5b7c2ab43c28 245 uLCD.filled_circle((x2 + x1)/2.0 , (y2 + y1)/2.0 , (rand() % ((21-1)/2)), RED);
cdong49 0:5b7c2ab43c28 246 }
cdong49 0:5b7c2ab43c28 247
cdong49 0:5b7c2ab43c28 248 void print_random_triangle(int x1, int y1, int x2, int y2) { // print a triangle at the specific position
cdong49 0:5b7c2ab43c28 249 uLCD.triangle((x2+x1)/2.0, y1, x1, y2, x2, y2, RED);
cdong49 0:5b7c2ab43c28 250 }
cdong49 0:5b7c2ab43c28 251
cdong49 0:5b7c2ab43c28 252 void print_random_square(int x1, int y1, int x2, int y2) { // print a square at a specific position
cdong49 0:5b7c2ab43c28 253 uLCD.filled_rectangle(x1+2, y1+2, x2-2, y2-2, RED);
cdong49 0:5b7c2ab43c28 254 }
cdong49 0:5b7c2ab43c28 255
cdong49 0:5b7c2ab43c28 256 void pick_spot(int box, int index, int* result) { // box = 0 -> left box, box = 1 -> right box. index goes from 0-17, left to right, up to down representing the square spaces inside a box
cdong49 0:5b7c2ab43c28 257 if(box == 0) { // we would pass our arr into result to get specific x,y coordinate out
cdong49 0:5b7c2ab43c28 258 switch(index) {
cdong49 0:5b7c2ab43c28 259 case 0:
cdong49 0:5b7c2ab43c28 260 result[0] = 1;
cdong49 0:5b7c2ab43c28 261 result[1] = 1;
cdong49 0:5b7c2ab43c28 262 result[2] = 20;
cdong49 0:5b7c2ab43c28 263 result[3] = 20;
cdong49 0:5b7c2ab43c28 264 break;
cdong49 0:5b7c2ab43c28 265 case 1:
cdong49 0:5b7c2ab43c28 266 result[0] = 21;
cdong49 0:5b7c2ab43c28 267 result[1] = 1;
cdong49 0:5b7c2ab43c28 268 result[2] = 40;
cdong49 0:5b7c2ab43c28 269 result[3] = 20;
cdong49 0:5b7c2ab43c28 270 break;
cdong49 0:5b7c2ab43c28 271 case 2:
cdong49 0:5b7c2ab43c28 272 result[0] = 41;
cdong49 0:5b7c2ab43c28 273 result[1] = 1;
cdong49 0:5b7c2ab43c28 274 result[2] = 60;
cdong49 0:5b7c2ab43c28 275 result[3] = 20;
cdong49 0:5b7c2ab43c28 276 break;
cdong49 0:5b7c2ab43c28 277 case 3:
cdong49 0:5b7c2ab43c28 278 result[0] = 1;
cdong49 0:5b7c2ab43c28 279
cdong49 0:5b7c2ab43c28 280 result[1] = 21;
cdong49 0:5b7c2ab43c28 281 result[2] = 20;
cdong49 0:5b7c2ab43c28 282 result[3] = 40;
cdong49 0:5b7c2ab43c28 283 break;
cdong49 0:5b7c2ab43c28 284 case 4:
cdong49 0:5b7c2ab43c28 285 result[0] = 21;
cdong49 0:5b7c2ab43c28 286 result[1] = 21;
cdong49 0:5b7c2ab43c28 287 result[2] = 40;
cdong49 0:5b7c2ab43c28 288 result[3] = 40;
cdong49 0:5b7c2ab43c28 289 break;
cdong49 0:5b7c2ab43c28 290 case 5:
cdong49 0:5b7c2ab43c28 291 result[0] = 41;
cdong49 0:5b7c2ab43c28 292 result[1] = 21;
cdong49 0:5b7c2ab43c28 293 result[2] = 60;
cdong49 0:5b7c2ab43c28 294 result[3] = 40;
cdong49 0:5b7c2ab43c28 295 break;
cdong49 0:5b7c2ab43c28 296 case 6:
cdong49 0:5b7c2ab43c28 297 result[0] = 1;
cdong49 0:5b7c2ab43c28 298 result[1] = 41;
cdong49 0:5b7c2ab43c28 299 result[2] = 20;
cdong49 0:5b7c2ab43c28 300 result[3] = 60;
cdong49 0:5b7c2ab43c28 301 break;
cdong49 0:5b7c2ab43c28 302 case 7:
cdong49 0:5b7c2ab43c28 303 result[0] = 21;
cdong49 0:5b7c2ab43c28 304 result[1] = 41;
cdong49 0:5b7c2ab43c28 305 result[2] = 40;
cdong49 0:5b7c2ab43c28 306 result[3] = 60;
cdong49 0:5b7c2ab43c28 307 break;
cdong49 0:5b7c2ab43c28 308 case 8:
cdong49 0:5b7c2ab43c28 309 result[0] = 41;
cdong49 0:5b7c2ab43c28 310 result[1] = 41;
cdong49 0:5b7c2ab43c28 311 result[2] = 60;
cdong49 0:5b7c2ab43c28 312 result[3] = 60;
cdong49 0:5b7c2ab43c28 313 break;
cdong49 0:5b7c2ab43c28 314 case 9:
cdong49 0:5b7c2ab43c28 315 result[0] = 1;
cdong49 0:5b7c2ab43c28 316 result[1] = 61;
cdong49 0:5b7c2ab43c28 317 result[2] = 20;
cdong49 0:5b7c2ab43c28 318 result[3] = 80;
cdong49 0:5b7c2ab43c28 319 break;
cdong49 0:5b7c2ab43c28 320 case 10:
cdong49 0:5b7c2ab43c28 321 result[0] = 21;
cdong49 0:5b7c2ab43c28 322 result[1] = 61;
cdong49 0:5b7c2ab43c28 323 result[2] = 40;
cdong49 0:5b7c2ab43c28 324 result[3] = 80;
cdong49 0:5b7c2ab43c28 325 break;
cdong49 0:5b7c2ab43c28 326 case 11:
cdong49 0:5b7c2ab43c28 327 result[0] = 41;
cdong49 0:5b7c2ab43c28 328 result[1] = 61;
cdong49 0:5b7c2ab43c28 329 result[2] = 60;
cdong49 0:5b7c2ab43c28 330 result[3] = 80;
cdong49 0:5b7c2ab43c28 331 break;
cdong49 0:5b7c2ab43c28 332 case 12:
cdong49 0:5b7c2ab43c28 333 result[0] = 1;
cdong49 0:5b7c2ab43c28 334 result[1] = 81;
cdong49 0:5b7c2ab43c28 335 result[2] = 20;
cdong49 0:5b7c2ab43c28 336 result[3] = 100;
cdong49 0:5b7c2ab43c28 337 break;
cdong49 0:5b7c2ab43c28 338 case 13:
cdong49 0:5b7c2ab43c28 339 result[0] = 21;
cdong49 0:5b7c2ab43c28 340 result[1] = 81;
cdong49 0:5b7c2ab43c28 341 result[2] = 40;
cdong49 0:5b7c2ab43c28 342 result[3] = 100;
cdong49 0:5b7c2ab43c28 343 break;
cdong49 0:5b7c2ab43c28 344 case 14:
cdong49 0:5b7c2ab43c28 345 result[0] = 41;
cdong49 0:5b7c2ab43c28 346 result[1] = 81;
cdong49 0:5b7c2ab43c28 347 result[2] = 60;
cdong49 0:5b7c2ab43c28 348 result[3] = 100;
cdong49 0:5b7c2ab43c28 349 break;
cdong49 0:5b7c2ab43c28 350 case 15:
cdong49 0:5b7c2ab43c28 351 result[0] = 1;
cdong49 0:5b7c2ab43c28 352 result[1] = 101;
cdong49 0:5b7c2ab43c28 353 result[2] = 20;
cdong49 0:5b7c2ab43c28 354 result[3] = 120;
cdong49 0:5b7c2ab43c28 355 break;
cdong49 0:5b7c2ab43c28 356 case 16:
cdong49 0:5b7c2ab43c28 357 result[0] = 21;
cdong49 0:5b7c2ab43c28 358 result[1] = 101;
cdong49 0:5b7c2ab43c28 359 result[2] = 40;
cdong49 0:5b7c2ab43c28 360 result[3] = 120;
cdong49 0:5b7c2ab43c28 361 break;
cdong49 0:5b7c2ab43c28 362 case 17:
cdong49 0:5b7c2ab43c28 363 result[0] = 41;
cdong49 0:5b7c2ab43c28 364 result[1] = 101;
cdong49 0:5b7c2ab43c28 365 result[2] = 60;
cdong49 0:5b7c2ab43c28 366 result[3] = 120;
cdong49 0:5b7c2ab43c28 367 break;
cdong49 0:5b7c2ab43c28 368 }
cdong49 0:5b7c2ab43c28 369
cdong49 0:5b7c2ab43c28 370 } else if(box == 1) {
cdong49 0:5b7c2ab43c28 371 switch(index) {
cdong49 0:5b7c2ab43c28 372 case 0:
cdong49 0:5b7c2ab43c28 373 result[0] = 65;
cdong49 0:5b7c2ab43c28 374 result[1] = 1;
cdong49 0:5b7c2ab43c28 375 result[2] = 84;
cdong49 0:5b7c2ab43c28 376 result[3] = 20;
cdong49 0:5b7c2ab43c28 377 break;
cdong49 0:5b7c2ab43c28 378 case 1:
cdong49 0:5b7c2ab43c28 379 result[0] = 85;
cdong49 0:5b7c2ab43c28 380 result[1] = 1;
cdong49 0:5b7c2ab43c28 381 result[2] = 104;
cdong49 0:5b7c2ab43c28 382 result[3] = 20;
cdong49 0:5b7c2ab43c28 383 break;
cdong49 0:5b7c2ab43c28 384 case 2:
cdong49 0:5b7c2ab43c28 385 result[0] = 105;
cdong49 0:5b7c2ab43c28 386 result[1] = 1;
cdong49 0:5b7c2ab43c28 387 result[2] = 124;
cdong49 0:5b7c2ab43c28 388 result[3] = 20;
cdong49 0:5b7c2ab43c28 389 break;
cdong49 0:5b7c2ab43c28 390 case 3:
cdong49 0:5b7c2ab43c28 391 result[0] = 65;
cdong49 0:5b7c2ab43c28 392 result[1] = 21;
cdong49 0:5b7c2ab43c28 393 result[2] = 84;
cdong49 0:5b7c2ab43c28 394 result[3] = 40;
cdong49 0:5b7c2ab43c28 395 break;
cdong49 0:5b7c2ab43c28 396 case 4:
cdong49 0:5b7c2ab43c28 397 result[0] = 85;
cdong49 0:5b7c2ab43c28 398 result[1] = 21;
cdong49 0:5b7c2ab43c28 399 result[2] = 104;
cdong49 0:5b7c2ab43c28 400 result[3] = 40;
cdong49 0:5b7c2ab43c28 401 break;
cdong49 0:5b7c2ab43c28 402 case 5:
cdong49 0:5b7c2ab43c28 403 result[0] = 105;
cdong49 0:5b7c2ab43c28 404 result[1] = 21;
cdong49 0:5b7c2ab43c28 405 result[2] = 124;
cdong49 0:5b7c2ab43c28 406 result[3] = 40;
cdong49 0:5b7c2ab43c28 407 break;
cdong49 0:5b7c2ab43c28 408 case 6:
cdong49 0:5b7c2ab43c28 409 result[0] = 65;
cdong49 0:5b7c2ab43c28 410 result[1] = 41;
cdong49 0:5b7c2ab43c28 411 result[2] = 84;
cdong49 0:5b7c2ab43c28 412 result[3] = 60;
cdong49 0:5b7c2ab43c28 413 break;
cdong49 0:5b7c2ab43c28 414 case 7:
cdong49 0:5b7c2ab43c28 415 result[0] = 85;
cdong49 0:5b7c2ab43c28 416 result[1] = 41;
cdong49 0:5b7c2ab43c28 417 result[2] = 104;
cdong49 0:5b7c2ab43c28 418 result[3] = 60;
cdong49 0:5b7c2ab43c28 419 break;
cdong49 0:5b7c2ab43c28 420 case 8:
cdong49 0:5b7c2ab43c28 421 result[0] = 105;
cdong49 0:5b7c2ab43c28 422 result[1] = 41;
cdong49 0:5b7c2ab43c28 423 result[2] = 125;
cdong49 0:5b7c2ab43c28 424 result[3] = 60;
cdong49 0:5b7c2ab43c28 425 break;
cdong49 0:5b7c2ab43c28 426 case 9:
cdong49 0:5b7c2ab43c28 427 result[0] = 65;
cdong49 0:5b7c2ab43c28 428 result[1] = 61;
cdong49 0:5b7c2ab43c28 429 result[2] = 84;
cdong49 0:5b7c2ab43c28 430 result[3] = 80;
cdong49 0:5b7c2ab43c28 431 break;
cdong49 0:5b7c2ab43c28 432 case 10:
cdong49 0:5b7c2ab43c28 433 result[0] = 85;
cdong49 0:5b7c2ab43c28 434 result[1] = 61;
cdong49 0:5b7c2ab43c28 435 result[2] = 104;
cdong49 0:5b7c2ab43c28 436 result[3] = 80;
cdong49 0:5b7c2ab43c28 437 break;
cdong49 0:5b7c2ab43c28 438 case 11:
cdong49 0:5b7c2ab43c28 439 result[0] = 105;
cdong49 0:5b7c2ab43c28 440 result[1] = 61;
cdong49 0:5b7c2ab43c28 441 result[2] = 124;
cdong49 0:5b7c2ab43c28 442 result[3] = 80;
cdong49 0:5b7c2ab43c28 443 break;
cdong49 0:5b7c2ab43c28 444 case 12:
cdong49 0:5b7c2ab43c28 445 result[0] = 65;
cdong49 0:5b7c2ab43c28 446 result[1] = 81;
cdong49 0:5b7c2ab43c28 447 result[2] = 84;
cdong49 0:5b7c2ab43c28 448 result[3] = 100;
cdong49 0:5b7c2ab43c28 449 break;
cdong49 0:5b7c2ab43c28 450 case 13:
cdong49 0:5b7c2ab43c28 451 result[0] = 85;
cdong49 0:5b7c2ab43c28 452 result[1] = 81;
cdong49 0:5b7c2ab43c28 453 result[2] = 104;
cdong49 0:5b7c2ab43c28 454 result[3] = 100;
cdong49 0:5b7c2ab43c28 455 break;
cdong49 0:5b7c2ab43c28 456 case 14:
cdong49 0:5b7c2ab43c28 457 result[0] = 105;
cdong49 0:5b7c2ab43c28 458 result[1] = 81;
cdong49 0:5b7c2ab43c28 459 result[2] = 124;
cdong49 0:5b7c2ab43c28 460 result[3] = 100;
cdong49 0:5b7c2ab43c28 461 break;
cdong49 0:5b7c2ab43c28 462 case 15:
cdong49 0:5b7c2ab43c28 463 result[0] = 65;
cdong49 0:5b7c2ab43c28 464 result[1] = 101;
cdong49 0:5b7c2ab43c28 465 result[2] = 84;
cdong49 0:5b7c2ab43c28 466 result[3] = 120;
cdong49 0:5b7c2ab43c28 467 break;
cdong49 0:5b7c2ab43c28 468 case 16:
cdong49 0:5b7c2ab43c28 469 result[0] = 85;
cdong49 0:5b7c2ab43c28 470 result[1] = 101;
cdong49 0:5b7c2ab43c28 471 result[2] = 104;
cdong49 0:5b7c2ab43c28 472 result[3] = 120;
cdong49 0:5b7c2ab43c28 473 break;
cdong49 0:5b7c2ab43c28 474 case 17:
cdong49 0:5b7c2ab43c28 475 result[0] = 105;
cdong49 0:5b7c2ab43c28 476 result[1] = 101;
cdong49 0:5b7c2ab43c28 477 result[2] = 124;
cdong49 0:5b7c2ab43c28 478 result[3] = 120;
cdong49 0:5b7c2ab43c28 479 break;
cdong49 0:5b7c2ab43c28 480 }
cdong49 0:5b7c2ab43c28 481 }
cdong49 0:5b7c2ab43c28 482 }