/********************************* * * 座標coのマスの上下左右に1つでも未定マスがあればtrueを返す。 * 引数 * co : 黒マスの座標 * * *******************************/ public static bool canExtendBlackBox(Coordinates co) { if (Tapa.box[co.x][co.y].Color != Box.BLACK) { Console.WriteLine("Error: canExtendBlackBoxに黒マス以外の座標を引数として渡しています。({0},{1})", co.x, co.y); Application.Exit(); } if (Tapa.box[co.x - 1][co.y].Color == Box.NOCOLOR // 上のマス色 || Tapa.box[co.x][co.y + 1].Color == Box.NOCOLOR // 右のマス色 || Tapa.box[co.x + 1][co.y].Color == Box.NOCOLOR // 下のマス色 || Tapa.box[co.x][co.y - 1].Color == Box.NOCOLOR) { // 左のマス色 return true; } return false; }
/********************************* * * 数字マスを追加して問題生成する。 * 引数: * boxnumber_in_whitebox_coord_dict : 数字マスの座標と数字の対応 * * *******************************/ private void generateTapaProblemInAddNumBox(Dictionary<Coordinates, int> boxnumber_in_whitebox_coord_dict) { do { // 時間計測開始 System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew(); // 埋める数字マスをランダムに選択 Coordinates adopting_boxnumber_coord = Problem.can_be_number_whitebox_list[ Problem.getRandomInt(0, Problem.can_be_number_whitebox_list.Count)]; Box tmp_box = Tapa.box[adopting_boxnumber_coord.x][adopting_boxnumber_coord.y]; // 選択した座標が既に配色済みの場合 if (tmp_box.Color != Box.NOCOLOR) { Problem.can_be_number_whitebox_list.Remove(adopting_boxnumber_coord); // 数字マスを格納できる座標リストから除外 // boxnumber_in_whitebox_coord_dict.Remove(adopting_boxnumber_coord); // ハッシュから除外 continue; } Box.during_make_inputbord = true; tmp_box.hasNum = true; // 数字を持ってるフラグをオンにする tmp_box.boxNum = boxnumber_in_whitebox_coord_dict[adopting_boxnumber_coord]; // 選択した座標に数字を格納 Tapa.numbox_coord_list.Add(new Coordinates(adopting_boxnumber_coord)); // 数字マスリストに追加 Tapa.not_deployedbox_coord_list.Remove(adopting_boxnumber_coord); // 未定マスリストから除外 tmp_box.id_list = PatternAroundNumBox.getPatternAroundNumBoxList(tmp_box.boxNum); // 数字に対応したidを格納 Problem.can_be_number_whitebox_list.Remove(adopting_boxnumber_coord); // 数字マスを格納できる座標リストから除外 boxnumber_in_whitebox_coord_dict.Remove(adopting_boxnumber_coord); // ハッシュから除外 Box.during_make_inputbord = false; Tapa.solveTapa(); //時間計測終了 sw.Stop(); adopting_boxnumber_coord.printCoordinates(); Console.WriteLine("の追加にかかった時間 >> " + sw.Elapsed + "(" + Problem.can_be_number_whitebox_list.Count + ")"); } while (Problem.can_be_number_whitebox_list.Count > 0); Console.WriteLine("数字マスランダム配置後"); Tapa.printBoard(); while (Tapa.not_deployedbox_coord_list.Count > 0) { Console.WriteLine("未定マスが存在!!!!"); // 白マス周りにある未定マスの数を格納 Dictionary<Coordinates, int> count_whitebox_dict = new Dictionary<Coordinates, int>(); foreach (Coordinates tmp_co in Tapa.not_deployedbox_coord_list) { List<Coordinates> whitebox_around_notdeployedbox_list = Box.getWhiteBoxCoordAround8(tmp_co); foreach (Coordinates tmp_whitebox_co in whitebox_around_notdeployedbox_list) { if (!count_whitebox_dict.ContainsKey(tmp_whitebox_co)) { count_whitebox_dict[tmp_whitebox_co] = 1; } else { count_whitebox_dict[tmp_whitebox_co]++; } } } int max = 0; Coordinates white2numbox = new Coordinates(); // 未定マスが最も多く周囲にある白マス foreach (KeyValuePair<Coordinates, int> pair in count_whitebox_dict) { if (pair.Value > max) { white2numbox = new Coordinates(pair.Key); } } Box.during_make_inputbord = true; Box tmp_box = Tapa.box[white2numbox.x][white2numbox.y]; tmp_box.hasNum = true; tmp_box.boxNum = boxnumber_in_whitebox_coord_dict[white2numbox]; // 数字を格納 Tapa.numbox_coord_list.Add(new Coordinates(white2numbox)); // 数字マスリストに追加 tmp_box.id_list = PatternAroundNumBox.getPatternAroundNumBoxList(tmp_box.boxNum); // 数字に対応したidを格納 Box.during_make_inputbord = false; Tapa.solveTapa(); if (Tapa.DEBUG) { Console.WriteLine("未定マス修正"); Tapa.printBoard(); } } // 数字ごとのidを元に戻す(回答中にid_listは減少) PatternAroundNumBox.preparePatternArroundNumBox(); // 盤面にある数字マス以外のマスを未定マスにする Tapa.numbox_coord_list.Clear(); // 数字マスの座標リスト Tapa.not_deployedbox_coord_list.Clear(); // 未定マスの座標リスト Tapa.isolation_notdeployedboxes_group_list.Clear(); // 一繋がりの未定マス群の座標リスト Tapa.edge_blackbox_coord_list.Clear(); // 伸び代のある黒マスの座標リスト Tapa.isolation_blackboxes_group_list.Clear(); // 一繋がりの黒マス群の座標リスト for (int i = 1; i <= Tapa.MAX_BOARD_ROW; i++) { for (int j = 1; j <= Tapa.MAX_BOARD_COL; j++) { Box tmp = Tapa.box[i][j]; if (!tmp.hasNum) { tmp.revision_color = Box.NOCOLOR; Tapa.not_deployedbox_coord_list.Add(new Coordinates(tmp.coord)); } else { Tapa.numbox_coord_list.Add(new Coordinates(tmp.coord)); } } } }
/********************************* * * 一繋がりの黒マスを生成する * 始点はランダム * * *******************************/ private void makeBlackBoxRoute() { doTarjan(Tapa.not_deployedbox_coord_list, Box.NOCOLOR); // 切断点をcutpoint_listに格納 foreach (Coordinates cp in cutpoint_list) { // 切断点を黒マスにする Tapa.box[cp.x][cp.y].Color = Box.BLACK; } // 切断点が存在しなければ、未定マスからランダムに選択、それを黒マスにする。 if (cutpoint_list.Count == 0) { Coordinates base_blackbox_coord = new Coordinates(Tapa.not_deployedbox_coord_list[ getRandomInt(0, Tapa.not_deployedbox_coord_list.Count)]); Tapa.box[base_blackbox_coord.x][base_blackbox_coord.y].Color = Box.BLACK; } // 伸び代のある黒マスがなくなるまで以下を実行 while (Tapa.edge_blackbox_coord_list.Count > 0) { // 伸び代のある黒マスリストからランダムに1つ選択、その黒マスから伸びることのできるマスをランダムに選択、そのマスを黒色にする。 Coordinates new_blackbox_coord = getRandCoordAround( Tapa.edge_blackbox_coord_list[getRandomInt(0, Tapa.edge_blackbox_coord_list.Count)]); Tapa.box[new_blackbox_coord.x][new_blackbox_coord.y].Color = Box.BLACK; doTarjan(Tapa.not_deployedbox_coord_list, Box.NOCOLOR); // 切断点を黒マスにする } // 白マスに囲まれた未定マスが残っている時、それを白マスで埋める for (int i = Tapa.not_deployedbox_coord_list.Count - 1; i >= 0; i--) { Coordinates tmp_coord = Tapa.not_deployedbox_coord_list[i]; Tapa.box[tmp_coord.x][tmp_coord.y].Color = Box.WHITE; } }
/********************************* * * color_board内でcenterを中心とした3*3マスの座標の内、黒マスの団子があるか調べる。 * true : 黒マスの団子がない * false : 黒マスの団子がある * * 引数 * center : 3*3の中心座標 * color_board : color情報を持った配列 * * *******************************/ private static bool checkNotDumpling(Coordinates center, int[,] color_board) { // 3*3の中心が白なら黒マスの団子はない if (color_board[center.x, center.y] == Box.WHITE) { return true; } int TL = color_board[center.x - 1, center.y - 1]; // (左上) Top-Left int TC = color_board[center.x - 1, center.y]; // (上) Top-Center int TR = color_board[center.x - 1, center.y + 1]; // (右上) Top-Right int MR = color_board[center.x, center.y + 1]; // (右) Middle-Right int BR = color_board[center.x + 1, center.y + 1]; // (右下) Bottom-Right int BC = color_board[center.x + 1, center.y]; // (下) Bottom-Center int BL = color_board[center.x + 1, center.y - 1]; // (左下) Bottom-Left int ML = color_board[center.x, center.y - 1]; // (左) Middle-Left if (TC == Box.BLACK) { // 上マスが黒色の場合 if ((ML == Box.BLACK && TL == Box.BLACK) // 左上 || (TR == Box.BLACK && MR == Box.BLACK)) { // 右上 return false; } } else if (BC == Box.BLACK) { // 下マスが黒色の場合 if ((MR == Box.BLACK && BR == Box.BLACK) // 左下 || (BL == Box.BLACK && ML == Box.BLACK)) { // 右下 return false; } } return true; }
/********************************* * * base_coordの上下左右の未定マスの座標をランダムで1つ返す * * 引数 * base_coord : 中心座標 * * *******************************/ private static Coordinates getRandCoordAround(Coordinates base_coord) { List<Coordinates> extendable_coord_list = Box.getWhatColorBoxCoordListAround(base_coord, Box.NOCOLOR); if (extendable_coord_list.Count == 0) { return null; } return extendable_coord_list[getRandomInt(0, extendable_coord_list.Count)]; }
/********************************* * * 1. 呼ばれた時の状態を保存する。 * 2. co座標のid_listからidを取り出し、配置する。 * 3. 黒マスの孤立を調べ、孤立していればidを除外する。 * 4. 状態を元に戻す。 * 5. 2-4をid_list内のid全てに対して行う。 * * 引数 * co : 数字マスの座標 * id_list : idのリスト * * *******************************/ private static void excludeIdToMakeIsolationBlackBoxGroup(Coordinates co, List<byte> id_list) { StateSave save_point = new StateSave(); // 現在の状態を保存 StateSave.saveNowState(save_point); // 孤立するidのid_listでの要素番号を保存するリスト List<int> iso_id_ite_list = new List<int>(); for (int i = id_list.Count - 1; i >= 0; i--) { PatternAroundNumBox.setPatternAroundNumBox(co, id_list[i]); // 数字マスの周囲5*5マス以内にある黒マス群のリストを取得 List<int> bbgroup_index_list = Box.getIndexBlackBoxGroupListAround55(co); List<List<Coordinates>> multi_list = new List<List<Coordinates>>(); foreach (int index in bbgroup_index_list) { multi_list.Add(Tapa.isolation_blackboxes_group_list[index]); } if (!Box.checkNotIsolationBlackBoxGroup(multi_list) // 盤面に孤立した黒マス群がないか調べる && Tapa.not_deployedbox_coord_list.Count > 0) { iso_id_ite_list.Add(i); } StateSave.loadSavedState(save_point); } // 孤立したidをid_listから削除 foreach (int tmp_ite in iso_id_ite_list) { // id_list.RemoveAt(tmp_ite); Tapa.box[co.x][co.y].id_list.RemoveAt(tmp_ite); } }
/********************************* * * 座標とidから座標周りでidの通り黒マスを配置する。 * 引数 * co : マスの座標 * id : 各パターンを識別するための数値(型はbyte) * clone_box_arround_numbox_list [default : null] * : 数字マス周りの8マスのリスト * * *******************************/ private static void setPatternAroundNumBox(Coordinates co, byte id , List<Box> clone_box_around_numbox_list = null) { Box TL = new Box(); // 左上(Top-Left) Box TC = new Box(); // 中上(Top-Center) Box TR = new Box(); // 右上(Top-Right) Box ML = new Box(); // 左中(Middle-Left) Box MR = new Box(); // 右中(Middle-Right) Box BL = new Box(); // 左下(Bottom-Left) Box BC = new Box(); // 中下(Bottom-Center) Box BR = new Box(); // 右下(Bottom-Right) if (clone_box_around_numbox_list == null) { // 盤面の数字マス周りのマスを取得(盤面本体) TL = Tapa.box[co.x - 1][co.y - 1]; // 左上(Top-Left) TC = Tapa.box[co.x - 1][co.y]; // 中上(Top-Center) TR = Tapa.box[co.x - 1][co.y + 1]; // 右上(Top-Right) ML = Tapa.box[co.x][co.y - 1]; // 左中(Middle-Left) MR = Tapa.box[co.x][co.y + 1]; // 右中(Middle-Right) BL = Tapa.box[co.x + 1][co.y - 1]; // 左下(Bottom-Left) BC = Tapa.box[co.x + 1][co.y]; // 中下(Bottom-Center) BR = Tapa.box[co.x + 1][co.y + 1]; // 右下(Bottom-Right) } else { // 盤面の数字マス周りのマスを取得(盤面のコピー) TL = clone_box_around_numbox_list[0]; // 左上(Top-Left) TC = clone_box_around_numbox_list[1]; // 中上(Top-Center) TR = clone_box_around_numbox_list[2]; // 右上(Top-Right) ML = clone_box_around_numbox_list[3]; // 左中(Middle-Left) MR = clone_box_around_numbox_list[4]; // 右中(Middle-Right) BL = clone_box_around_numbox_list[5]; // 左下(Bottom-Left) BC = clone_box_around_numbox_list[6]; // 中下(Bottom-Center) BR = clone_box_around_numbox_list[7]; // 右下(Bottom-Right) } // idから数字マス周りに黒マスを配置 // [0] id=0 if (id == HEAD_BN_0) { TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; } // [1] id=1~8 else if (HEAD_BN_1 <= id && id < HEAD_BN_2) { switch (id) { case (byte)1: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)2: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)3: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)4: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)5: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)6: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)7: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)8: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[1]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [2] id=9~16 else if (HEAD_BN_2 <= id && id < HEAD_BN_3) { switch (id) { case (byte)9: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)10: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)11: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)12: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)13: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)14: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)15: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)16: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[2]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [3] id=17~24 else if (HEAD_BN_3 <= id && id < HEAD_BN_4) { switch (id) { case (byte)17: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)18: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)19: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)20: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)21: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)22: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)23: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)24: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[3]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [4] id=25~32 else if (HEAD_BN_4 <= id && id < HEAD_BN_5) { switch (id) { case (byte)25: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)26: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)27: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)28: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)29: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)30: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)31: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)32: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[4]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [5] id=33~40 else if (HEAD_BN_5 <= id && id < HEAD_BN_6) { switch (id) { case (byte)33: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)34: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)35: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)36: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)37: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)38: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)39: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)40: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[5]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [6] id=41~48 else if (HEAD_BN_6 <= id && id < HEAD_BN_7) { switch (id) { case (byte)41: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)42: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)43: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)44: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)45: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)46: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)47: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)48: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[6]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [7] id=49~56 else if (HEAD_BN_7 <= id && id < HEAD_BN_8) { switch (id) { case (byte)49: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)50: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)51: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)52: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)53: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)54: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)55: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)56: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[7]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [8] id=57 else if (id == HEAD_BN_8) { TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; } // [11] id=58~77 else if (HEAD_BN_11 <= id && id < HEAD_BN_12) { switch (id) { case (byte)58: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)59: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)60: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)61: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)62: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)63: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)64: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)65: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)66: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)67: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)68: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)69: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)70: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)71: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)72: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)73: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)74: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)75: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)76: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)77: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[11]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [12] id=78~109 else if (HEAD_BN_12 <= id && id < HEAD_BN_13) { switch (id) { case (byte)78: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)79: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)80: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)81: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)82: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)83: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)84: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)85: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)86: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)87: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)88: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)89: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)90: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)91: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)92: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)93: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)94: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)95: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)96: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)97: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)98: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)99: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)100: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)101: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)102: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)103: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)104: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)105: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)106: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)107: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)108: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)109: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[12]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [13] id=110~133 else if (HEAD_BN_13 <= id && id < HEAD_BN_14) { switch (id) { case (byte)110: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)111: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)112: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)113: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)114: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)115: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)116: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)117: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)118: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)119: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)120: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)121: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)122: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)123: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)124: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)125: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)126: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)127: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)128: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)129: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)130: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)131: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)132: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)133: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[13]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [14] id=134~149 else if (HEAD_BN_14 <= id && id < HEAD_BN_15) { switch (id) { case (byte)134: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)135: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)136: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)137: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)138: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)139: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)140: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)141: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)142: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)143: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)144: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)145: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)146: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)147: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)148: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)149: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[14]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [15] id=150~157 else if (HEAD_BN_15 <= id && id < HEAD_BN_22) { switch (id) { case (byte)150: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)151: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)152: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)153: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)154: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)155: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)156: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)157: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[15]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [22] id=158~169 else if (HEAD_BN_22 <= id && id < HEAD_BN_23) { switch (id) { case (byte)158: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)159: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)160: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)161: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)162: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)163: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)164: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)165: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)166: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)167: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)168: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)169: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[22]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [23] id=170~185 else if (HEAD_BN_23 <= id && id < HEAD_BN_24) { switch (id) { case (byte)170: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)171: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)172: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)173: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)174: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)175: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)176: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)177: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)178: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)179: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)180: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)181: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)182: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)183: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)184: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)185: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[23]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [24] id=186~193 else if (HEAD_BN_24 <= id && id < HEAD_BN_33) { switch (id) { case (byte)186: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)187: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)188: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)189: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)190: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)191: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)192: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)193: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[24]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [33] id=194~197 else if (HEAD_BN_33 <= id && id < HEAD_BN_111) { switch (id) { case (byte)194: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)195: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)196: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)197: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[33]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [111] id=198~213 else if (HEAD_BN_111 <= id && id < HEAD_BN_112) { switch (id) { case (byte)198: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)199: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)200: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)201: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)202: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)203: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)204: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)205: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)206: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)207: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)208: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)209: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)210: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE; /* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)211: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)212: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK; /* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)213: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK; /* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[111]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [112] id=214~237 else if (HEAD_BN_112 <= id && id < HEAD_BN_113) { switch (id) { case (byte)214: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)215: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)216: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)217: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)218: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)219: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)220: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)221: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)222: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)223: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)224: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)225: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)226: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)227: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)228: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)229: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)230: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)231: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)232: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.WHITE; break; case (byte)233: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)234: TL.Color = Box.WHITE; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)235: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)236: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)237: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[112]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [113] id=238~245 else if (HEAD_BN_113 <= id && id < HEAD_BN_122) { switch (id) { case (byte)238: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)239: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)240: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)241: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)242: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)243: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)244: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)245: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[113]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [122] id=246~253 else if (HEAD_BN_122 <= id && id < HEAD_BN_1111) { switch (id) { case (byte)246: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)247: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)248: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; case (byte)249: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)250: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)251: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; case (byte)252: TL.Color = Box.BLACK; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.WHITE;/* */MR.Color = Box.BLACK; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)253: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.BLACK; ML.Color = Box.BLACK;/* */MR.Color = Box.WHITE; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.BLACK; break; default: Console.WriteLine("Error: 数字マス[122]周りの黒マス配置中にエラー"); Application.Exit(); break; } } // [1111] id=254~255 else if (HEAD_BN_1111 <= id && id <= MAX_ID) { switch (id) { case (byte)254: TL.Color = Box.BLACK; TC.Color = Box.WHITE; TR.Color = Box.BLACK; ML.Color = Box.WHITE;/* */MR.Color = Box.WHITE; BL.Color = Box.BLACK; BC.Color = Box.WHITE; BR.Color = Box.BLACK; break; case (byte)255: TL.Color = Box.WHITE; TC.Color = Box.BLACK; TR.Color = Box.WHITE; ML.Color = Box.BLACK;/* */MR.Color = Box.BLACK; BL.Color = Box.WHITE; BC.Color = Box.BLACK; BR.Color = Box.WHITE; break; default: Console.WriteLine("Error: 数字マス[1111]周りの黒マス配置中にエラー"); Application.Exit(); break; } } else { Console.WriteLine("Error: idから数字マス周りの黒マスを配置中にエラー"); Application.Exit(); } }
/********************************* * * co1とco2の距離を計算して返す * 引数 * co1,co2 : 距離を求めたい座標 * * *******************************/ public static int getDistance(Coordinates co1, Coordinates co2) { return Math.Abs(co1.x - co2.x) + Math.Abs(co1.y - co2.y); }
/********************************* * * 座標co周り5*5マスにある黒マスの属する黒マス群のインデックスをリストで返す。 * * 引数 * co : 注目座標 * * *******************************/ public static List<int> getIndexBlackBoxGroupListAround55(Coordinates co) { // co周り5*5マス内の黒マスを取得 List<Coordinates> bb_co_around55 = new List<Coordinates>(); for (int i = co.x - 2; i <= co.x + 2; i++) { for (int j = co.y - 2; j <= co.y + 2; j++) { // 外周より外側 if (i <= 0 || Tapa.MAX_BOARD_ROW < i || j <= 0 || Tapa.MAX_BOARD_COL < j) { continue; } else if (Tapa.box[i][j].Color == Box.BLACK) { bb_co_around55.Add(Tapa.box[i][j].coord); } } } List<int> bbgroup_index_list = new List<int>(); // 黒マス群リストのインデックス保存用 for (int ite_iso_group = Tapa.isolation_blackboxes_group_list.Count - 1; ite_iso_group >= 0; ite_iso_group--) { // 周囲の黒い数字マスで処理の終わった黒マスのインデックス保存用 List<int> del_index = new List<int>(); for (int ite_around_box = bb_co_around55.Count - 1; ite_around_box >= 0; ite_around_box--) { if (Tapa.isolation_blackboxes_group_list[ite_iso_group].Contains(bb_co_around55[ite_around_box])) { del_index.Add(ite_around_box); } } if (del_index.Count > 0) { // 黒マス群のインデックスを追加 bbgroup_index_list.Add(ite_iso_group); // 今回追加する黒マス群に含まれる周りの黒マスをリストから除外 foreach (int i in del_index) { bb_co_around55.RemoveAt(i); } } if (bb_co_around55.Count == 0) { break; } } return bbgroup_index_list; }
/********************************* * * 座標co周り8マスに未定マスが存在するか。 * true: 存在する * * 引数 * co : 注目座標 * * *******************************/ public static bool existWhatColorBoxAround8(Coordinates co, int color) { for (int i = co.x - 1; i <= co.x + 1; i++) { for (int j = co.y - 1; j <= co.y + 1; j++) { Coordinates around_co = new Coordinates(i, j); if ((i == co.x && j == co.y) || !Box.checkNotOuterBox(around_co)) { continue; } if (Tapa.box[i][j].Color == color) { return true; } } } return false; }
/********************************* * * 【coが黒マス群リストの末尾に属していること前提】 * co座標から最も近くにある別黒マス群に属する黒マスの座標を取得 * co座標の黒マスは黒マス群の末尾のリストに属する(for文) * 引数 * co : 注目座標 * belong_list : coの属する黒マスリスト * * *******************************/ public static Coordinates getCloseBlackBoxCoord(Coordinates co, List<Coordinates> belong_list) { Coordinates close_coord = new Coordinates(); int distance = int.MaxValue; int tmp_distance = int.MaxValue; // ### 近い黒マスを黒マスリストから探す for (int i = 0; i < Tapa.isolation_blackboxes_group_list.Count - 1; i++) { List<Coordinates> list = Tapa.isolation_blackboxes_group_list[i]; if (list.Equals(belong_list)) { continue; } for (int j = 0; j < list.Count; j++) { Coordinates tmp_co = list[j]; tmp_distance = Box.getDistance(co, tmp_co); if (tmp_distance < distance) { distance = tmp_distance; close_coord = tmp_co; } } } return close_coord; }
/********************************* * * 座標coのマスの上下左右に1つでも黒マスがあればtrueを返す。 * 引数 * co : 黒マスの座標 * * *******************************/ public static bool existBlackBoxAround(Coordinates co) { if (Tapa.box[co.x - 1][co.y].Color != Box.BLACK // 上のマス色 && Tapa.box[co.x][co.y + 1].Color != Box.BLACK // 右のマス色 && Tapa.box[co.x + 1][co.y].Color != Box.BLACK // 下のマス色 && Tapa.box[co.x][co.y - 1].Color != Box.BLACK) { // 左のマス色 return false; } return true; }
/********************************* * * 座標coが外周の座標かどうか返す * true : 外周の座標ではない * false : 外周の座標である * * 引数 * co : 注目座標 * * *******************************/ public static bool checkNotOuterBox(Coordinates co) { if (co.x <= 0 || Tapa.MAX_BOARD_ROW < co.x || co.y <= 0 || Tapa.MAX_BOARD_COL < co.y) { return false; } return true; }
/********************************* * * co座標の周囲3*3マスに黒マスの団子がないか調べる * true : ない * false : ある * * *******************************/ public static bool checkNotDumplingBlackBoxAround(Coordinates co) { int TL = Tapa.box[co.x - 1][co.y - 1].Color; // 左上 int TC = Tapa.box[co.x - 1][co.y].Color; // 上 int TR = Tapa.box[co.x - 1][co.y + 1].Color; // 右上 int ML = Tapa.box[co.x][co.y - 1].Color; // 左 int MC = Tapa.box[co.x][co.y].Color; // 真ん中 int MR = Tapa.box[co.x][co.y + 1].Color; // 右 int BL = Tapa.box[co.x + 1][co.y - 1].Color; // 左下 int BC = Tapa.box[co.x + 1][co.y].Color; // 下 int BR = Tapa.box[co.x + 1][co.y + 1].Color; // 右下 if (TL + TC + ML + MC == 4) { return false; } if (TC + TR + MC + MR == 4) { return false; } if (ML + MC + BL + BC == 4) { return false; } if (MC + MR + BC + BR == 4) { return false; } return true; }
private static void excludeDumplingId(Coordinates co, List<byte> id_list) { // int max_box_col = Tapa.box[0].Count - 1; // 列の添字の最大値 //int max_box_row = Tapa.box.Count; // 行の添字の最大値 int max_box_row = Tapa.MAX_BOARD_ROW; // 行の添字の最大値 int max_box_col = Tapa.MAX_BOARD_COL; // 列の添字の最大値 const int MAX_CLONE_ROW = 5; const int MAX_CLONE_COL = 5; Coordinates center = new Coordinates(2, 2); int[,] clone_color_55 = new int[MAX_CLONE_ROW, MAX_CLONE_COL]; // 数字マス周りの5*5マスのcolorを格納する配列 int[,] origin_color_around_numbox = new int[3, 3]; // 関数が呼ばれた時点での、数字マス周りの3*3マスのcolorを格納する配列 // 数字マス周り5*5マスの色を取得 for (int i_box = co.x - 2, i_color = 0; i_color < MAX_CLONE_ROW; i_box++, i_color++) { for (int j_box = co.y - 2, j_color = 0; j_color < MAX_CLONE_COL; j_box++, j_color++) { // 外周かそれより外側の要素番号の場合、白色とする。 if (i_box <= 0 || max_box_row < i_box || j_box <= 0 || max_box_col < j_box) { clone_color_55[i_color, j_color] = Box.WHITE; if (1 <= i_color && i_color <= 3 && 1 <= j_color && j_color <= 3) { // 数字マス周り8マスのColor origin_color_around_numbox[i_color - 1, j_color - 1] = Box.WHITE; } } else { clone_color_55[i_color, j_color] = Tapa.box[i_box][j_box].Color; if (1 <= i_color && i_color <= 3 && 1 <= j_color && j_color <= 3) { // 数字マス周り8マスのColor origin_color_around_numbox[i_color - 1, j_color - 1] = clone_color_55[i_color, j_color]; } } } } if (DEBUG_DANGO) { Console.WriteLine("【DEBUG_DANGO】団子マス確認用 "); co.printCoordinates(); Console.WriteLine(); for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { if (clone_color_55[i, j] == Box.BLACK) { Console.Write("■"); } else if (clone_color_55[i, j] == Box.WHITE) { Console.Write("□"); } else { Console.Write("-"); } } Console.WriteLine(); } } for (int ite_id = id_list.Count - 1; ite_id >= 0; ite_id--) { // id_list // 数字マス周り3*3マスの色を元に戻す for (int i_color = 1; i_color <= 3; i_color++) { for (int j_color = 1; j_color <= 3; j_color++) { clone_color_55[i_color, j_color] = origin_color_around_numbox[i_color - 1, j_color - 1]; } } // 数字マス周りのクローンを作成 List<Box> clonebox_around_numbox_list = new List<Box> { new Box(Tapa.box[co.x-1][co.y-1]), // 左上 new Box(Tapa.box[co.x-1][co.y]), // 上 new Box(Tapa.box[co.x-1][co.y+1]), // 右上 new Box(Tapa.box[co.x][co.y-1]), // 左 new Box(Tapa.box[co.x][co.y+1]), // 右 new Box(Tapa.box[co.x+1][co.y-1]), // 左下 new Box(Tapa.box[co.x+1][co.y]), // 下 new Box(Tapa.box[co.x+1][co.y+1]) // 右下 }; // ######## <begin> クローン処理中はリスト関係の処理をしない Box.during_clone = true; // クローンに色を塗る PatternAroundNumBox.setPatternAroundNumBox(co, id_list[ite_id], clonebox_around_numbox_list); Box.during_clone = false; // ######## <end> クローン処理中はリスト関係の処理をしない // 数字マス周りにある黒色のマスを格納 List<Coordinates> blackbox_coord_list = new List<Coordinates>(); // 数字マス周り8マスをidで埋めた場合の色で塗る int ite_clonebox_list = 0; for (int i = center.x - 1; i <= center.x + 1; i++) { for (int j = center.y - 1; j <= center.y + 1; j++) { if (i == center.x && j == center.y) { continue; } // clonebox_around_numbox_listに中心の数字マスが含まれないため // idで塗られた色が黒だった場合リストに追加 else if ((clone_color_55[i, j] = clonebox_around_numbox_list[ite_clonebox_list++].Color) == Box.BLACK) { blackbox_coord_list.Add(new Coordinates(i, j)); } } } // 数字マス周りの黒マス周りで団子ができないか調べる。 foreach (Coordinates tmp_co in blackbox_coord_list) { if (!checkNotDumpling(tmp_co, clone_color_55)) { Tapa.box[co.x][co.y].id_list.RemoveAt(ite_id); break; } } } }
/********************************* * * 座標coのマスの上下左右にある指定色マスの座標をリストで返す。 * 引数 * co : マスの座標 * color : 調べたい色 * * *******************************/ public static List<Coordinates> getWhatColorBoxCoordListAround(Coordinates co, int color) { List<Coordinates> tmp_coord_list = new List<Coordinates>(); List<Box> around_box = new List<Box> { Tapa.box[co.x-1][co.y], Tapa.box[co.x][co.y+1], Tapa.box[co.x+1][co.y], Tapa.box[co.x][co.y-1] }; foreach (Box tmp_box in around_box) { if (tmp_box.Color == color) { tmp_coord_list.Add(new Coordinates(tmp_box.coord)); } } return tmp_coord_list; }
/********************************* * * 1. 呼ばれた時の状態を保存する。 * 2. co座標のid_listからidを取り出し、配置する。 * 3. 2.の状態で他の数字マスのidのチェック→除外を行う。 * 4. どれか1つでも数字マスのid_listの大きさが0になった場合、 * そのidのid_listでの添字を記録する。 * 5. id_listの次のidに対して、2-5を繰り返す。 * 6. id_listのid全ての調査が終わったら、4.で記録したidをid_listから除外する。 * * 引数 * co : 数字マスの座標 * id_list : idのリスト * * *******************************/ private static void excludeIdToKillOtherNameBoxAllId(Coordinates co, List<byte> id_list) { StateSave save_point = new StateSave(); // 現在の状態を保存 StateSave.saveNowState(save_point); // 除外するidのid_listでのインデックスを保存するリスト List<int> kill_id_ite_list = new List<int>(); for (int i = id_list.Count - 1; i >= 0; i--) { // idの試し塗り PatternAroundNumBox.setPatternAroundNumBox(co, id_list[i]); // 数字マスのリストから今回試し塗りしたidの数字マスを除外 Tapa.numbox_coord_list.Remove(co); Tapa.box[co.x][co.y].hasNum = false; // co周り5*5マスにある黒マスが属する黒マス群のインデックスを取得 List<int> bbgroup_index_list = Box.getIndexBlackBoxGroupListAround55(co); List<Coordinates> numbox_around_bbgroup_coord_list = Box.getCoordListAroundBlackBoxGroup(bbgroup_index_list); for (int ite_coord = numbox_around_bbgroup_coord_list.Count - 1; ite_coord >= 0; ite_coord--) { // 黒マス群付近の数字マスリスト Coordinates tmp_co = new Coordinates(numbox_around_bbgroup_coord_list[ite_coord]); for (int ite_id = Tapa.box[tmp_co.x][tmp_co.y].id_list.Count - 1; ite_id >= 0; ite_id--) { // id_list byte tmp_id = Tapa.box[tmp_co.x][tmp_co.y].id_list[ite_id]; if (!PatternAroundNumBox.checkPatternAroundNumBox(tmp_co, tmp_id)) { // idのパターンが配置できない Tapa.box[tmp_co.x][tmp_co.y].id_list.RemoveAt(ite_id); } } // idの通り配置したら黒マスの団子ができてしまう PatternAroundNumBox.excludeDumplingId(tmp_co, Tapa.box[tmp_co.x][tmp_co.y].id_list); // id_listのうち、孤立する黒マス群を作るidを除外(id_listごとに処理したほうが効率的) PatternAroundNumBox.excludeIdToMakeIsolationBlackBoxGroup(tmp_co, Tapa.box[tmp_co.x][tmp_co.y].id_list); // id_listの大きさが0なら今回試し塗りしたidの添字を、除外するid_listに追加し、次のidを見に行く。 if (Tapa.box[tmp_co.x][tmp_co.y].id_list.Count == 0) { kill_id_ite_list.Add(i); break; } } // 保存した状態をロード StateSave.loadSavedState(save_point); } // 除外対象のidをid_listから除外 foreach (int tmp_ite in kill_id_ite_list) { Tapa.box[co.x][co.y].id_list.RemoveAt(tmp_ite); } }
/********************************* * * 座標co周り8マスにある白マスの座標をリストで返す。(外周を除く) * * 引数 * co : 注目座標 * * *******************************/ public static List<Coordinates> getWhiteBoxCoordAround8(Coordinates co) { List<Coordinates> around_whitebox_list = new List<Coordinates>(); for (int i = co.x - 1; i <= co.x + 1; i++) { for (int j = co.y - 1; j <= co.y + 1; j++) { Coordinates around_co = new Coordinates(i, j); if ((i == co.x && j == co.y) || !Box.checkNotOuterBox(around_co)) { continue; } if (Tapa.box[i][j].Color == Box.WHITE) { around_whitebox_list.Add(around_co); } } } return around_whitebox_list; }
/********************************* * * 数字マスのid_listを見て、数字マス周りで色が確定するマスを埋める。 * 引数 * co : 数字マスの座標 * * *******************************/ private static void setConfirmBoxArroundNumBox(Coordinates co) { Tapa.sw_csv.Restart(); // CSV // 数字マス周りのクローンを作成 List<Box> clonebox_around_numbox_list = new List<Box> { new Box(Tapa.box[co.x-1][co.y-1]), // 左上 new Box(Tapa.box[co.x-1][co.y]), // 上 new Box(Tapa.box[co.x-1][co.y+1]), // 右上 new Box(Tapa.box[co.x][co.y-1]), // 左 new Box(Tapa.box[co.x][co.y+1]), // 右 new Box(Tapa.box[co.x+1][co.y-1]), // 左下 new Box(Tapa.box[co.x+1][co.y]), // 下 new Box(Tapa.box[co.x+1][co.y+1]) // 右下 }; // クローンのマス色変更回数を0にする。 foreach (Box tmp_box in clonebox_around_numbox_list) { tmp_box.changed_count_in_search_confirm_box = 0; } // ######## <begin> クローン処理中はリスト関係の処理をしない Box.during_clone = true; // クローンのマス色が何回変化するか調べる。 foreach (byte tmp_id in Tapa.box[co.x][co.y].id_list) { // id_list(配置可能なパターン) PatternAroundNumBox.setPatternAroundNumBox(co, tmp_id, clonebox_around_numbox_list); } Box.during_clone = false; // ######## <end> クローン処理中はリスト関係の処理をしない bool is_change = false; ; // クローンのマス色変更回数が1回なら、そのマスをその色で埋める。 foreach (Box tmp_box in clonebox_around_numbox_list) { int first_count = Tapa.not_deployedbox_coord_list.Count; if (tmp_box.changed_count_in_search_confirm_box == 1 && Tapa.box[tmp_box.coord.x][tmp_box.coord.y].Color == Box.NOCOLOR) { Tapa.box[tmp_box.coord.x][tmp_box.coord.y].Color = tmp_box.Color; is_change = true; /////////// if (Tapa.is_count) { Tapa.processnum_kakuteimasu += first_count - Tapa.not_deployedbox_coord_list.Count; if (Tapa.DEBUG) { Console.Write("確定マス" + Tapa.processnum_kakuteimasu); tmp_box.coord.printCoordinates(); Console.WriteLine(); } } } } if (is_change) { Tapa.sum_times_kakuteimasu += Tapa.sw_csv.ElapsedMilliseconds; // CSV Tapa.visittimes_kakuteimasu++; } }
/********************************* * * マスの状態を初期化 * 初期値 * co : -100, -100 * changed_count_in_search_confirm_box : 0 * has_num : 0 * box_num : -1 * id_list : null * color : Box.NOCOLOR * can_extend_blackbox : false * id_not_deployedbox_group : 0 * * *******************************/ public void clear() { this.coord = new Coordinates(); this.changed_count_in_search_confirm_box = 0; this.hasNum = false; this.box_num = -1; this.id_list.Clear(); this.color = Box.NOCOLOR; this.can_extend_blackbox = false; this.id_not_deployedbox_group = 0; }
public static void managePatternAroundNumBox(int use_process = 4, int solve_limit = -1) { for (int ite_coord = Tapa.numbox_coord_list.Count - 1; ite_coord >= 0; ite_coord--) { // 数字マスのリスト Coordinates tmp_co = new Coordinates(Tapa.numbox_coord_list[ite_coord]); //Tapa.DEBUG = false; //if (tmp_co.Equals(new Coordinates(52, 1))) { Tapa.DEBUG = true; } if (Tapa.box[tmp_co.x][tmp_co.y].id_list.Count == 1) { first_1 = true; } else { first_1 = false; } int first_count = Tapa.not_deployedbox_coord_list.Count; int process = 0; if (Tapa.DEBUG) { tmp_co.printCoordinates(); Console.WriteLine(Tapa.box[tmp_co.x][tmp_co.y].boxNum + "の処理前"); Console.Write("0 :id"); Tapa.box[tmp_co.x][tmp_co.y].printIdList(); } Tapa.sw_csv.Restart(); // CSV // 配置できないidを削除 if (Tapa.box[tmp_co.x][tmp_co.y].id_list.Count != 1) { for (int ite_id = Tapa.box[tmp_co.x][tmp_co.y].id_list.Count - 1; ite_id >= 0; ite_id--) { // id_list byte tmp_id = Tapa.box[tmp_co.x][tmp_co.y].id_list[ite_id]; if (!PatternAroundNumBox.checkPatternAroundNumBox(tmp_co, tmp_id)) { Tapa.box[tmp_co.x][tmp_co.y].id_list.RemoveAt(ite_id); if (Tapa.is_count && !first_1 && Tapa.box[tmp_co.x][tmp_co.y].id_list.Count == 1) { // Tapa.processnum_kakuteijogaiid++; first_1 = true; if (Tapa.DEBUG) { tmp_co.printCoordinates(); Console.WriteLine("確定除外id" + Tapa.processnum_kakuteijogaiid); } } } } Tapa.sum_times_kakuteijogaiid += Tapa.sw_csv.ElapsedMilliseconds; // CSV Tapa.visittimes_kakuteijogaiid++; } if (Tapa.DEBUG) { Console.Write("1 :id"); Tapa.box[tmp_co.x][tmp_co.y].printIdList(); } // id_listのうち、idの通り配置したら黒マスの団子ができてしまうようなidを除外 if (Tapa.box[tmp_co.x][tmp_co.y].id_list.Count != 1) { Tapa.sw_csv.Restart(); // CSV PatternAroundNumBox.excludeDumplingId(tmp_co, Tapa.box[tmp_co.x][tmp_co.y].id_list); if (Tapa.is_count && !first_1 && Tapa.box[tmp_co.x][tmp_co.y].id_list.Count == 1) { // Tapa.processnum_dangoid++; process = 1; first_1 = true; if (Tapa.DEBUG) { tmp_co.printCoordinates(); Console.WriteLine("団子id" + Tapa.processnum_dangoid); } } Tapa.sum_times_dangoid += Tapa.sw_csv.ElapsedMilliseconds; // CSV Tapa.visittimes_dangoid++; } if (Tapa.DEBUG) { Console.Write("2 :id"); Tapa.box[tmp_co.x][tmp_co.y].printIdList(); } // id_listのうち、孤立する黒マス群を作るidを除外 if (use_process >= 3 && Tapa.box[tmp_co.x][tmp_co.y].id_list.Count != 1) { Tapa.sw_csv.Restart(); // CSV excludeIdToMakeIsolationBlackBoxGroup(tmp_co, Tapa.box[tmp_co.x][tmp_co.y].id_list); if (Tapa.is_count && !first_1 && Tapa.box[tmp_co.x][tmp_co.y].id_list.Count == 1) { // Tapa.processnum_korituid++; process = 2; first_1 = true; if (Tapa.DEBUG) { tmp_co.printCoordinates(); Console.WriteLine("孤立id" + Tapa.processnum_korituid); } } Tapa.sum_times_korituid += Tapa.sw_csv.ElapsedMilliseconds; // CSV Tapa.visittimes_korituid++; } if (Tapa.DEBUG) { Console.Write("3 :id"); Tapa.box[tmp_co.x][tmp_co.y].printIdList(); } // id_listのうち、idを配置して別の数字マスのid_listの大きさが0になるようなidを除外する。 if (use_process >= 4 && Tapa.box[tmp_co.x][tmp_co.y].id_list.Count != 1) { Tapa.sw_csv.Restart(); // CSV excludeIdToKillOtherNameBoxAllId(tmp_co, Tapa.box[tmp_co.x][tmp_co.y].id_list); if (Tapa.is_count && !first_1 && Tapa.box[tmp_co.x][tmp_co.y].id_list.Count == 1) { // Tapa.processnum_betu0id++; process = 3; first_1 = true; if (Tapa.DEBUG) { tmp_co.printCoordinates(); Console.WriteLine("別0id" + Tapa.processnum_betu0id); } } Tapa.sum_times_betu0id += Tapa.sw_csv.ElapsedMilliseconds; // CSV Tapa.visittimes_betu0id++; } if (Tapa.DEBUG) { Console.Write("4 :id"); Tapa.box[tmp_co.x][tmp_co.y].printIdList(); } // id_listが一意ならそれを配置して数字マスリストから除外 if (Tapa.box[tmp_co.x][tmp_co.y].id_list.Count == 1) { PatternAroundNumBox.setPatternAroundNumBox(tmp_co, Tapa.box[tmp_co.x][tmp_co.y].id_list[0]); Tapa.numbox_coord_list.RemoveAt(ite_coord); if (Tapa.DEBUG) { Console.Write("5a :"); Tapa.box[tmp_co.x][tmp_co.y].coord.printCoordinates(); Console.WriteLine(Tapa.box[tmp_co.x][tmp_co.y].boxNum + "周りが確定!"); Tapa.printBoard(); } if (Tapa.is_count) { countProcess(process, first_count - Tapa.not_deployedbox_coord_list.Count); } // ヒント生成数が上限を超えたら終了 if (solve_limit >= Tapa.not_deployedbox_coord_list.Count) { Tapa.is_over_solve_num = true; return; } continue; } // tmp_coのid_listを見て数字周りで色が確定しているマスを埋める setConfirmBoxArroundNumBox(tmp_co); if (solve_limit >= Tapa.not_deployedbox_coord_list.Count) { Tapa.is_over_solve_num = true; return; } // ヒント生成数が上限を超えたら終了 if (Tapa.DEBUG) { Console.Write("5b :id"); Tapa.box[tmp_co.x][tmp_co.y].printIdList(); Tapa.box[tmp_co.x][tmp_co.y].coord.printCoordinates(); Tapa.printBoard(); } } }
/********************************* * * 黒マスの上下左右で3つが白マスかつ1つが未定マスならそれを黒にし、 * 伸び代のある黒マスリスト(edge_blackbox_coord_list)から除外する。 * 引数 * ite_coord : 伸び代のある黒マスリストの要素番号 * * *******************************/ //private static void extendBlackBox(int ite_coord) //{ // Coordinates tmp_coord = new Coordinates(Tapa.edge_blackbox_coord_list[ite_coord]); // Box T = new Box(Tapa.box[tmp_coord.x - 1][tmp_coord.y]); // TOP // Box R = new Box(Tapa.box[tmp_coord.x][tmp_coord.y + 1]); // RIGHT // Box B = new Box(Tapa.box[tmp_coord.x + 1][tmp_coord.y]); // BOTTOM // Box L = new Box(Tapa.box[tmp_coord.x][tmp_coord.y - 1]); // LEFT // // 伸び代のある黒マスが予期せぬ動きをしたら見てみるといいかも // //Console.WriteLine("(" + tmp_coord.x + "," + tmp_coord.y + ')'); // //Console.WriteLine("T >> " + "(" + T.coord.x + "," + T.coord.y + ") " + T.color.ToString() + " " + T.hasNum.ToString()); // //Console.WriteLine("R >> " + "(" + R.coord.x + "," + R.coord.y + ") " + R.color.ToString() + " " + R.hasNum.ToString()); // //Console.WriteLine("B >> " + "(" + B.coord.x + "," + B.coord.y + ") " + B.color.ToString() + " " + B.hasNum.ToString()); // //Console.WriteLine("L >> " + "(" + L.coord.x + "," + L.coord.y + ") " + L.color.ToString() + " " + L.hasNum.ToString()); // //Console.WriteLine(); // if (T.Color == Box.NOCOLOR && R.Color == Box.WHITE && B.Color == Box.WHITE && L.Color == Box.WHITE) { // Tapa.box[tmp_coord.x - 1][tmp_coord.y].Color = Box.BLACK; // 上のマスを黒に // Tapa.edge_blackbox_coord_list.RemoveAt(ite_coord); // } // else if (T.Color == Box.WHITE && R.Color == Box.NOCOLOR && B.Color == Box.WHITE && L.Color == Box.WHITE) { // Tapa.box[tmp_coord.x][tmp_coord.y + 1].Color = Box.BLACK; // 右のマスを黒に // Tapa.edge_blackbox_coord_list.RemoveAt(ite_coord); // } // else if (T.Color == Box.WHITE && R.Color == Box.WHITE && B.Color == Box.NOCOLOR && L.Color == Box.WHITE) { // Tapa.box[tmp_coord.x + 1][tmp_coord.y].Color = Box.BLACK; // 下のマスを黒に // Tapa.edge_blackbox_coord_list.RemoveAt(ite_coord); // } // else if (T.Color == Box.WHITE && R.Color == Box.WHITE && B.Color == Box.WHITE && L.Color == Box.NOCOLOR) { // Tapa.box[tmp_coord.x][tmp_coord.y - 1].Color = Box.BLACK; // 左のマスを黒に // Tapa.edge_blackbox_coord_list.RemoveAt(ite_coord); // } //} /********************************* * * 黒マスが2*2の四角(団子、Dumpling)にならないように白マスを配置するメソッド * 、 * 黒マスの周囲8マスを見てその未定マスが黒になると団子になってしまう場合、 * そのマスを白マスにする。 * 引数 * co : (黒)マスの座標 * * *******************************/ private static void avoidDumpling(Coordinates co) { // ### 浅いコピー Box TL = Tapa.box[co.x - 1][co.y - 1]; // (左上) Top-Left Box TC = Tapa.box[co.x - 1][co.y]; // (上) Top-Center Box TR = Tapa.box[co.x - 1][co.y + 1]; // (右上) Top-Right Box ML = Tapa.box[co.x][co.y - 1]; // (左) Middle-Left Box MC = Tapa.box[co.x][co.y]; // (真ん中) Middle-Center Box MR = Tapa.box[co.x][co.y + 1]; // (右) Middle-Right Box BR = Tapa.box[co.x + 1][co.y + 1]; // (右下) Bottom-Right Box BC = Tapa.box[co.x + 1][co.y]; // (下) Bottom-Center Box BL = Tapa.box[co.x + 1][co.y - 1]; // (左下) Bottom-Left if (TL.Color + TC.Color + ML.Color + MC.Color == 3) { // 左上 if (TL.Color == Box.NOCOLOR) { TL.Color = Box.WHITE; } else if (TC.Color == Box.NOCOLOR) { TC.Color = Box.WHITE; } else if (ML.Color == Box.NOCOLOR) { ML.Color = Box.WHITE; } else if (MC.Color == Box.NOCOLOR) { MC.Color = Box.WHITE; } } if (TC.Color + TR.Color + MC.Color + MR.Color == 3) { // 右上 if (TC.Color == Box.NOCOLOR) { TC.Color = Box.WHITE; } else if (TR.Color == Box.NOCOLOR) { TR.Color = Box.WHITE; } else if (MC.Color == Box.NOCOLOR) { MC.Color = Box.WHITE; } else if (MR.Color == Box.NOCOLOR) { MR.Color = Box.WHITE; } } if (ML.Color + MC.Color + BL.Color + BC.Color == 3) { // 左下 if (ML.Color == Box.NOCOLOR) { ML.Color = Box.WHITE; } else if (MC.Color == Box.NOCOLOR) { MC.Color = Box.WHITE; } else if (BL.Color == Box.NOCOLOR) { BL.Color = Box.WHITE; } else if (BC.Color == Box.NOCOLOR) { BC.Color = Box.WHITE; } } if (MC.Color + MR.Color + BC.Color + BR.Color == 3) { // 右下 if (MC.Color == Box.NOCOLOR) { MC.Color = Box.WHITE; } else if (MR.Color == Box.NOCOLOR) { MR.Color = Box.WHITE; } else if (BC.Color == Box.NOCOLOR) { BC.Color = Box.WHITE; } else if (BR.Color == Box.NOCOLOR) { BR.Color = Box.WHITE; } } }
/********************************* * * 座標とidから座標周りでidの配置方法が可能か判定する。 * 引数 * co : マスの座標 * id : 各パターンを識別するための数値(型はbyte) * * *******************************/ private static bool checkPatternAroundNumBox(Coordinates co, byte id) { int TL = Tapa.box[co.x - 1][co.y - 1].Color; // 左上(Top-Left) int TC = Tapa.box[co.x - 1][co.y].Color; // 中上(Top-Center) int TR = Tapa.box[co.x - 1][co.y + 1].Color; // 右上(Top-Right) int ML = Tapa.box[co.x][co.y - 1].Color; // 左中(Middle-Left) int MR = Tapa.box[co.x][co.y + 1].Color; // 右中(Middle-Right) int BL = Tapa.box[co.x + 1][co.y - 1].Color; // 左下(Bottom-Left) int BC = Tapa.box[co.x + 1][co.y].Color; // 中下(Bottom-Center) int BR = Tapa.box[co.x + 1][co.y + 1].Color; // 右下(Bottom-Right) // [0] id=0 if (id == HEAD_BN_0) { if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK/* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } } // [1] id=1~8 else if (HEAD_BN_1 <= id && id < HEAD_BN_2) { switch (id) { case (byte)1: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)2: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)3: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)4: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)5: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)6: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)7: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)8: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[1]周りのパターンチェック"); Application.Exit(); return false; } } // [2] id=9~16 else if (HEAD_BN_2 <= id && id < HEAD_BN_3) { switch (id) { case (byte)9: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)10: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)11: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)12: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)13: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)14: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)15: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)16: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[2]周りのパターンチェック"); Application.Exit(); return false; } } // [3] id=17~24 else if (HEAD_BN_3 <= id && id < HEAD_BN_4) { switch (id) { case (byte)17: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)18: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)19: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)20: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)21: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)22: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)23: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)24: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[3]周りのパターンチェック"); Application.Exit(); return false; } } // [4] id=25~32 else if (HEAD_BN_4 <= id && id < HEAD_BN_5) { switch (id) { case (byte)25: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)26: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)27: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)28: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)29: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)30: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)31: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)32: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[4]周りのパターンチェック"); Application.Exit(); return false; } } // [5] id=33~40 else if (HEAD_BN_5 <= id && id < HEAD_BN_6) { switch (id) { case (byte)33: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)34: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)35: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)36: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)37: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)38: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)39: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)40: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[5]周りのパターンチェック"); Application.Exit(); return false; } } // [6] id=41~48 else if (HEAD_BN_6 <= id && id < HEAD_BN_7) { switch (id) { case (byte)41: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)42: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)43: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)44: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)45: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)46: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)47: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)48: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[6]周りのパターンチェック"); Application.Exit(); return false; } } // [7] id=49~56 else if (HEAD_BN_7 <= id && id < HEAD_BN_8) { switch (id) { case (byte)49: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)50: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)51: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)52: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)53: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)54: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)55: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)56: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[7]周りのパターンチェック"); Application.Exit(); return false; } } // [8] id=57 else if (id == HEAD_BN_8) { if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } } // [11] id=58~77 else if (HEAD_BN_11 <= id && id < HEAD_BN_12) { switch (id) { case (byte)58: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)59: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)60: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)61: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)62: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)63: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)64: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)65: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)66: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)67: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)68: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)69: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)70: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)71: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)72: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)73: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)74: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)75: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)76: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)77: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[11]周りのパターンチェック"); Application.Exit(); return false; } } // [12] id=78~109 else if (HEAD_BN_12 <= id && id < HEAD_BN_13) { switch (id) { case (byte)78: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)79: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)80: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)81: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)82: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)83: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)84: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)85: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)86: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)87: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)88: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)89: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)90: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)91: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)92: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)93: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)94: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)95: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)96: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)97: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)98: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)99: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)100: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)101: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)102: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)103: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)104: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)105: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)106: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)107: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)108: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)109: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[12]周りのパターンチェック"); Application.Exit(); return false; } } // [13] id=110~133 else if (HEAD_BN_13 <= id && id < HEAD_BN_14) { switch (id) { case (byte)110: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)111: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)112: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)113: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK/* */ && MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)114: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)115: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)116: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)117: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)118: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)119: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)120: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)121: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)122: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)123: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)124: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)125: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)126: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)127: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)128: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)129: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)130: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)131: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)132: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)133: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[13]周りのパターンチェック"); Application.Exit(); return false; } } // [14] id=134~149 else if (HEAD_BN_14 <= id && id < HEAD_BN_15) { switch (id) { case (byte)134: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)135: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)136: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)137: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)138: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)139: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)140: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)141: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)142: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)143: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)144: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)145: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)146: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)147: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)148: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)149: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[14]周りのパターンチェック"); Application.Exit(); return false; } } // [15] id=150~157 else if (HEAD_BN_15 <= id && id < HEAD_BN_22) { switch (id) { case (byte)150: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)151: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)152: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)153: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)154: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)155: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)156: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)157: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[14]周りのパターンチェック"); Application.Exit(); return false; } } // [22] id=158~169 else if (HEAD_BN_22 <= id && id < HEAD_BN_23) { switch (id) { case (byte)158: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)159: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)160: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)161: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)162: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)163: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)164: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)165: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)166: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)167: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)168: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)169: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[22]周りのパターンチェック"); Application.Exit(); return false; } } // [23] id=170~185 else if (HEAD_BN_23 <= id && id < HEAD_BN_24) { switch (id) { case (byte)170: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)171: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)172: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)173: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)174: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)175: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)176: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)177: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)178: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)179: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)180: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)181: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)182: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)183: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)184: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)185: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[23]周りのパターンチェック"); Application.Exit(); return false; } } // [24] id=186~193 else if (HEAD_BN_24 <= id && id < HEAD_BN_33) { switch (id) { case (byte)186: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)187: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)188: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)189: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)190: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)191: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)192: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)193: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[24]周りのパターンチェック"); Application.Exit(); return false; } } // [33] id=194~197 else if (HEAD_BN_33 <= id && id < HEAD_BN_111) { switch (id) { case (byte)194: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)195: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)196: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)197: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[33]周りのパターンチェック"); Application.Exit(); return false; } } // [111] id=198~213 else if (HEAD_BN_111 <= id && id < HEAD_BN_112) { switch (id) { case (byte)198: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)199: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)200: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)201: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)202: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)203: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)204: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)205: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)206: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)207: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)208: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)209: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)210: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)211: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)212: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)213: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[111]周りのパターンチェック"); Application.Exit(); return false; } } // [112] id=214~237 else if (HEAD_BN_112 <= id && id < HEAD_BN_113) { switch (id) { case (byte)214: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)215: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)216: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)217: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)218: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)219: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)220: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)221: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)222: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)223: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)224: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)225: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)226: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)227: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)228: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)229: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)230: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)231: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)232: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.BLACK) { return true; } else { return false; } case (byte)233: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)234: if (TL != Box.BLACK && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)235: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)236: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)237: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[112]周りのパターンチェック"); Application.Exit(); return false; } } // [113] id=238~245 else if (HEAD_BN_113 <= id && id < HEAD_BN_122) { switch (id) { case (byte)238: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)239: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)240: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)241: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)242: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)243: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)244: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)245: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[113]周りのパターンチェック"); Application.Exit(); return false; } } // [122] id=246~253 else if (HEAD_BN_122 <= id && id < HEAD_BN_1111) { switch (id) { case (byte)246: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)247: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)248: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } case (byte)249: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)250: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)251: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } case (byte)252: if (TL != Box.WHITE && TC != Box.WHITE && TR != Box.BLACK && ML != Box.BLACK /* */&& MR != Box.WHITE && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)253: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.WHITE && ML != Box.WHITE /* */&& MR != Box.BLACK && BL != Box.BLACK && BC != Box.WHITE && BR != Box.WHITE) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[122]周りのパターンチェック"); Application.Exit(); return false; } } // [1111] id=254~255 else if (HEAD_BN_1111 <= id && id <= MAX_ID) { switch (id) { case (byte)254: if (TL != Box.WHITE && TC != Box.BLACK && TR != Box.WHITE && ML != Box.BLACK /* */&& MR != Box.BLACK && BL != Box.WHITE && BC != Box.BLACK && BR != Box.WHITE) { return true; } else { return false; } case (byte)255: if (TL != Box.BLACK && TC != Box.WHITE && TR != Box.BLACK && ML != Box.WHITE /* */&& MR != Box.WHITE && BL != Box.BLACK && BC != Box.WHITE && BR != Box.BLACK) { return true; } else { return false; } default: Console.WriteLine("Error: 数字マス[1111]周りのパターンチェック"); Application.Exit(); return false; } } else { Console.WriteLine("Error: 数字マスのid振り分けでエラー"); Application.Exit(); return false; } }
/********************************* * * 引数で受け取った座標リストのうち、 * 伸び代のある黒マスを前側にソートし、そのリストを返す。 * 引数 * origin_list : (一繋がりの黒マス群の各)マスの座標リスト * * *******************************/ //private static List<Coordinates> sortFrontExtendableList(List<Coordinates> origin_list) //{ // List<Coordinates> sorted_list = new List<Coordinates>(origin_list.Count); // foreach (Coordinates tmp_coord in origin_list) { // if (Tapa.box[tmp_coord.x][tmp_coord.y].can_extend_blackbox) { // sorted_list.Insert(0, tmp_coord); // } // else { // sorted_list.Add(tmp_coord); // } // } // return sorted_list; //} /********************************* * * 座標coのマスの上下左右にある黒マスの数を返す。 * 引数 * co : マスの座標 * * *******************************/ //private static int countBlackBoxAround(Coordinates co) //{ // List<int> around_colors = new List<int> { // Tapa.box[co.x-1][co.y].Color, // Tapa.box[co.x][co.y+1].Color, // Tapa.box[co.x+1][co.y].Color, // Tapa.box[co.x][co.y-1].Color // }; // int count = 0; // // [色と定数の関係] Box.WHITE : 0 Box.BLACK : 1 Box.NOCOLOR : -1 // foreach (int tmp_color in around_colors) { // if (tmp_color == Box.BLACK) { // count++; // } // } // return count; //} /********************************* * * 座標coのマスの上下左右にある未定マスの数を返す。 * 引数 * co : マスの座標 * * *******************************/ private static int countNoColorBoxAround(Coordinates co) { List<int> around_colors = new List<int> { Tapa.box[co.x-1][co.y].Color, Tapa.box[co.x][co.y+1].Color, Tapa.box[co.x+1][co.y].Color, Tapa.box[co.x][co.y-1].Color }; int count = 0; // [色と定数の関係] Box.WHITE : -1 Box.BLACK : 1 Box.NOCOLOR : 0 foreach (int tmp_color in around_colors) { if (tmp_color == Box.NOCOLOR) { count++; } } return count; }
/********************************* * * DFSを行う過程で切断点をcutpoint_listに格納する * * root以外 :ord[u] <= low[v]ならuは切断点 * root :子が2つ以上で、子が部分木ならrootは切断点 * * 引数: * u :注目しているマス * parent :uの親 * * *******************************/ private void doDFS(Coordinates u, Coordinates parent, List<Coordinates> list) { visited[u] = true; // 到達済みフラグ ord[u] = low[u] = reach_num++; // ord(とlow)の値を格納(lowは高々ord) int visit_children = 0; // DFSで辿った子の数 bool is_cutpoint = false; foreach (Coordinates v in edge[u]) { // 自身の全ての子に対して if (!visited[v]) { visit_children++; doDFS(v, u, list); low[u] = low[u] < low[v] ? low[u] : low[v]; // 子のlowのほうが小さければ、lowを更新 if (!u.Equals(list[0]) && ord[u] <= low[v]) { is_cutpoint = true; } } else if (!v.Equals(parent)) { // 親以外の到達済みマスなら low[u] = low[u] < ord[v] ? low[u] : ord[v]; // 自身のlowと子のordのうち、小さい方でlowを更新 } } if (u.Equals(list[0]) && visit_children >= 2) { is_cutpoint = true; } if (is_cutpoint) { cutpoint_list.Add(u); } }
/********************************* * * co(新しく黒マスになった座標)周りの孤立した黒マス群を1つの黒マス群に結合する。 * 引数 * co : 黒マスの座標 * * *******************************/ private static void divideBlackBoxToGroup(Coordinates co) { // [浅いコピー] 上下左右のBoxのリスト List<Box> around_box = new List<Box> { Tapa.box[co.x-1][co.y], // 上 Tapa.box[co.x][co.y+1], // 右 Tapa.box[co.x+1][co.y], // 下 Tapa.box[co.x][co.y-1] // 左 }; // 上下左右にある黒マスの座標リスト List<Coordinates> around_box_coord = new List<Coordinates>(); foreach (Box tmp_box in around_box) { if (tmp_box.Color == Box.BLACK) { around_box_coord.Add(tmp_box.coord); } } // 上下左右に黒マスがない場合、自身を新しい孤立した黒マス群としてリストに追加 if (around_box_coord.Count == 0) { Tapa.isolation_blackboxes_group_list.Add(new List<Coordinates>() { co }); } else { List<Coordinates> merged_group_list = new List<Coordinates>() { co }; // 結合したリストの保存用 for (int ite_iso_group = Tapa.isolation_blackboxes_group_list.Count - 1; ite_iso_group >= 0; ite_iso_group--) { // 周囲の黒い数字マスで処理の終わった黒マスのインデックス保存用 List<int> del_index = new List<int>(); for (int ite_around_box = around_box_coord.Count - 1; ite_around_box >= 0; ite_around_box--) { if (Tapa.isolation_blackboxes_group_list[ite_iso_group].Contains(around_box_coord[ite_around_box])) { del_index.Add(ite_around_box); } } if (del_index.Count > 0) { // 新たに結合されるリストに孤立していた黒マス群を追加 merged_group_list.AddRange(new List<Coordinates>(Tapa.isolation_blackboxes_group_list[ite_iso_group])); // 直前でmerged_group_listに追加したリストの元を孤立する黒マス群から削除 Tapa.isolation_blackboxes_group_list.RemoveAt(ite_iso_group); // 今回追加する黒マス群に含まれる周りの黒マスをリストから除外 foreach (int i in del_index) { around_box_coord.RemoveAt(i); } } if (around_box_coord.Count == 0) { break; } } // 今回の結合で伸び代の無くなった黒マスを伸び代のある黒マスリストから除外 // resetExtendableBlackBoxAround(co); for (int i = Tapa.edge_blackbox_coord_list.Count - 1; i >= 0; i--) { Coordinates tmp_co = Tapa.edge_blackbox_coord_list[i]; if (!Box.canExtendBlackBox(tmp_co)) { Tapa.box[tmp_co.x][tmp_co.y].can_extend_blackbox = false; Tapa.edge_blackbox_coord_list.RemoveAt(i); } } // 今回新たに結合された孤立した黒マスリストを、孤立した黒マス群リストに追加。 Tapa.isolation_blackboxes_group_list.Add(new List<Coordinates>(merged_group_list)); } }
/********************************* * * co周りのマス色から、coに入る数字を返す。 * * 引数: * co : 数字を入れたいマス * * *******************************/ private int getBoxNumber(Coordinates co) { // 周囲8マスの色を取得 List<int> around_boxcolor = new List<int> { Tapa.box[co.x-1][co.y-1].Color, // 左上 Tapa.box[co.x-1][co.y].Color, // 上 Tapa.box[co.x-1][co.y+1].Color, // 右上 Tapa.box[co.x][co.y+1].Color, // 右 Tapa.box[co.x+1][co.y+1].Color, // 右下 Tapa.box[co.x+1][co.y].Color, // 下 Tapa.box[co.x+1][co.y-1].Color, // 左下 Tapa.box[co.x][co.y-1].Color, // 左 }; // 周囲8マスの連続した黒マスの数の格納用 List<int> around_blackbox = new List<int>(); bool is_counting = false; int count = 0; foreach (int color in around_boxcolor) { if (color == Box.BLACK) { is_counting = true; count++; } else if (color == Box.WHITE) { if (is_counting) { around_blackbox.Add(count); count = 0; is_counting = false; } } } if (around_boxcolor[7] == Box.BLACK) { around_blackbox.Add(count); } // 全てが黒マスでなく左上と左が黒マスだった場合、始めと最後に数えた黒マスの数を足して、改めて格納し直す。 if (count != 8 && around_boxcolor[0] == Box.BLACK && around_boxcolor[7] == Box.BLACK) { around_blackbox[0] = around_blackbox[0] + around_blackbox[around_blackbox.Count - 1]; around_blackbox.RemoveAt(around_blackbox.Count - 1); } around_blackbox.Sort(); // 昇順にソート int digit_pow = (int)Math.Pow(10, around_blackbox.Count - 1); // 10^(桁数-1) int tmp_num = 0; foreach (int _num in around_blackbox) { tmp_num += _num * digit_pow; digit_pow /= 10; } return tmp_num; }
/********************************* * * 黒マス群に対してdfsを行い、黒マス群周りの数字マスの数字マスリストにおけるインデックスを * ret_numbox_index_listに格納する。 * * 引数 * u : 親の黒マス群インデックス * s : 現在の直線の始点の黒マス群インデックス * t : 現在の直線の端(始点とは反対側)の黒マス群インデックス * d : dfsがたどっている直線の向き * ret_numbox_index_list : 黒マス群周りにある数字マス座標格納用 * * *******************************/ private static void doDFStoSortBlackBoxGroup( int u, int s, int t, Coordinates d, ref List<Coordinates> ret_numbox_coord_list) { if (visited[u]) { return; } visited[u] = true; t = u; // 突き当りを更新 foreach (int v in edge[u]) { Coordinates next_d = bb_group[v] - bb_group[u]; if (s == t) { d = next_d; } // 突き当りと始点が同じ = 曲がったばかり else { if (d != next_d) { getNumBoxIndexAroundLine(s, t, d, ref ret_numbox_coord_list); s = t; // 始点を今の位置に } } doDFStoSortBlackBoxGroup(v, s, t, d, ref ret_numbox_coord_list); } }
/********************************* * * 白マスに入る数字を格納する * * *******************************/ private void setBoxNumber() { Box.during_make_inputbord = true; can_be_number_whitebox_list.Clear(); for (int i = 1; i <= Tapa.MAX_BOARD_ROW; i++) { for (int j = 1; j <= Tapa.MAX_BOARD_COL; j++) { if (Tapa.box[i][j].Color == Box.WHITE) { Tapa.box[i][j].hasNum = true; Tapa.box[i][j].boxNum = getBoxNumber(Tapa.box[i][j].coord); can_be_number_whitebox_list.Add(Tapa.box[i][j].coord); } } } Box.during_make_inputbord = false; // 数字マスのリストをシャッフル(安定ソートで偏りを出さないため) for (int i = 0; i < can_be_number_whitebox_list.Count; i++) { Coordinates tmp_co = can_be_number_whitebox_list[i]; int random = Problem.getRandomInt(0, can_be_number_whitebox_list.Count); can_be_number_whitebox_list[i] = new Coordinates(can_be_number_whitebox_list[random]); can_be_number_whitebox_list[random] = tmp_co; } }
public Box(Box origin_box) { this.coord = new Coordinates(origin_box.coord); this.changed_count_in_search_confirm_box = origin_box.changed_count_in_search_confirm_box; this.hasNum = origin_box.has_num; this.box_num = origin_box.box_num; this.id_list = new List<byte>(); if (origin_box.id_list.Count > 0) { foreach (byte tmp_id in origin_box.id_list) { this.id_list.Add(tmp_id); } } this.color = origin_box.color; this.can_extend_blackbox = origin_box.can_extend_blackbox; this.id_not_deployedbox_group = origin_box.id_not_deployedbox_group; }