/* 배치했을 경우의 평균높이를 계산. */ public void Evaluate_Height(int Order) { Heuristic_Height = new double[Width]; Average_Height = new double[Width]; int[,] Detector; char[,] temp; int x = 0, y; double height_Average1 = 0; double height_Average2 = 0; //bool check_detection = false; temp = (char[, ])Matrix.Clone();// 깊은 복사 수행 while (x < Width) { y = Height - Height_info[x] - 1;//실제 높이. while (!Check_Height(x, y, Order, temp, Minimum_Rotation[x]) && y > 0) { y--; } if (y <= 0) { Heuristic_Height[x] = Disenable; x++; continue; } Detector = form.Block_Rotate(Order, x, y, Minimum_Rotation[x]); for (int i = 0; i < 4; i++) { height_Average1 += Detector[i, 0]; height_Average2 += Height_info[Detector[i, 1]]; } height_Average1 /= 4; height_Average2 /= 4; for (int j = 0; j < 4; j++) { temp[Detector[j, 0], Detector[j, 1]] = Empty; } Heuristic_Height[x] = Height - height_Average1; Average_Height[x] = height_Average2; height_Average1 = 0; height_Average2 = 0; x++; } }
public bool TimePass(char Color) { bool isPass = false; if (flow != true) { for (int i = 0; i < 4; i++) { if (character[i, 0] < numHeight - 1 && Matrix[character[i, 0] + 1, character[i, 1]] != CharacterColor && Matrix[character[i, 0] + 1, character[i, 1]] == empty) { isPass = true; } else if (character[i, 0] < numHeight - 1 && Matrix[character[i, 0] + 1, character[i, 1]] == CharacterColor) { isPass = true; } else { isPass = false; break; } } if (isPass == true) { if (!Repaint(empty)) { return(false);//Map이 변경되지 않음. } user[1]++; character = form.Block_Rotate(Figure, user[0], user[1], Rotation); Repaint(CharacterColor); Drawed = true;//Map 이 변경되었음. } else { heuristics.set_Matrix(Matrix); Create(Color); Height_Detector(); Block_Remover(); flow = true; } } return(flow); }