diff --git a/2024ProconTemporary/Com/Networking.cs b/2024ProconTemporary/Com/Networking.cs index 7577a9e..ad59060 100644 --- a/2024ProconTemporary/Com/Networking.cs +++ b/2024ProconTemporary/Com/Networking.cs @@ -7,20 +7,27 @@ namespace _2024ProconTemporary.Com; public static class Networking { + private static readonly string ENV_PATH = @"./.env"; private static readonly string ServerIp = Env.GetString("SERVER_IP", "127.0.0.1"); - private static readonly string ServerPort = Env.GetString("SERVER_PORT", "80"); + private static readonly string ServerPort = Env.GetString("SERVER_PORT", "3000"); private static readonly string Token = Env.GetString("PROCON_TOKEN"); - private static readonly string AnswerEndPoint = $"http://{ServerIp}:{ServerPort}/answer"; - private static readonly string ProblemEndPoint = $"http://{ServerIp}:{ServerPort}/problem"; + private static readonly string AnswerEndPoint; + private static readonly string ProblemEndPoint; static Networking() { - Env.Load(); - ServerIp = Env.GetString("SERVER_IP", "127.0.0.1:3000"); - Token = Env.GetString("PROCON_TOKEN"); + Env.Load(ENV_PATH); + ServerIp = Env.GetString("SERVER_IP", "127.0.0.1"); + ServerPort = Env.GetString("SERVER_PORT", "3000"); + Token = Env.GetString("PROCON_TOKEN", "natori4d166dbccdd7a5a875f1246f18bf46c1f9d85d9c6e2d8f1f05c82f85da"); + AnswerEndPoint = $"http://{ServerIp}:{ServerPort}/answer"; + ProblemEndPoint = $"http://{ServerIp}:{ServerPort}/problem"; + Console.WriteLine($"Server IP: {ServerIp}"); + Console.WriteLine($"Server Port: {ServerPort}"); + Console.WriteLine($"Token: {Token}"); } @@ -67,12 +74,21 @@ public static async Task SendAnswerDataAsync(HttpClient client, AnswerData AddTokenHeader(ref req); using var jsonStream = new MemoryStream(); await JsonSerializer.SerializeAsync(jsonStream, answer); - var json = jsonStream.ToString()!; + jsonStream.Position = 0; + using var reader = new StreamReader(jsonStream); + var json = await reader.ReadToEndAsync(); req.Content = new StringContent(json, Encoding.UTF8, "application/json"); try { var res = await client.SendAsync(req); - if (res.StatusCode.Equals(HttpStatusCode.OK)) return true; + if (res.StatusCode.Equals(HttpStatusCode.OK)) + { + // デバッグ用 + var body = await res.Content.ReadAsStringAsync(); + Console.WriteLine(body); + // ここまで + return true; + } await Console.Error.WriteLineAsync($"Failed to send answer data. Status Code is {res.StatusCode}"); return false; } diff --git a/2024ProconTemporary/Command-Line/BootCommand.cs b/2024ProconTemporary/Command-Line/BootCommand.cs index 87ce551..6035201 100644 --- a/2024ProconTemporary/Command-Line/BootCommand.cs +++ b/2024ProconTemporary/Command-Line/BootCommand.cs @@ -4,6 +4,7 @@ using _2024ProconTemporary.Com; using _2024ProconTemporary; using System.Linq; +using System.Formats.Asn1; namespace _2024ProconTemporary.CommandLine.Commands @@ -25,121 +26,365 @@ public class BootCommand { public void Handle(BootCommandClient args) { - Console.WriteLine("Booting..."); // 問題データを取得する - Console.WriteLine("Getting Problem Data..."); + Console.WriteLine("問題データを取得しています..."); HttpClient client = Networking.CreateClient(); var problemData = Networking.GetProblemData(client); - if (problemData == null) { - Console.WriteLine("ERROR: ProblemData Download Failed!"); - Console.WriteLine("Please check your network connection and try again."); + Console.WriteLine("エラー: ProblemDataのダウンロードに失敗しました!"); + Console.WriteLine("ネットワーク接続を確認して、もう一度お試しください。"); return; } Console.WriteLine("Done!"); - Console.WriteLine("Converting Problem Data..."); // 問題データ、回答データをstringの配列からintの2次元配列に変換する + Console.WriteLine("Converting Problem Data..."); ReadableProblemData convertedProblemData = new ReadableProblemData(problemData); Console.WriteLine("Done!"); - Console.WriteLine("View Problem Data:"); convertedProblemData.Print(); - // 問題データを表示する - if (args.isView) + + // 回答データの初期化 + AnswerData answerData = Answer.Create(); + + // 手動操作モード用の抜き型を列挙したリストを作成 + List dieList = CreateDieList(convertedProblemData); + + // デバッグ用 + Console.WriteLine("DieList:"); + foreach (var die in dieList) { - Console.WriteLine("View Problem Data:"); - convertedProblemData.Print(); + Console.WriteLine($"P: {die.P}"); + Console.WriteLine($"Width: {die.Width}"); + Console.WriteLine($"Height: {die.Height}"); + Console.WriteLine("Cells:"); + foreach (var cell in die.Cells) + { + Console.WriteLine(string.Join(" ", cell)); + } } + // ここまで - AnswerData answerData = Answer.Create(); // 手動で回答を作成するモードに移行する if (args.isManual) { - Console.WriteLine("Manual Mode"); - Console.WriteLine("Please input answer."); - ManualMode(problemData); + Console.WriteLine("手動回答モードに移行します"); + ManualMode(convertedProblemData, dieList); } else { // 自動回答モードに移行する - Console.WriteLine("Automatic Mode"); - Console.WriteLine("Calculating Answer..."); + Console.WriteLine("回答を計算しています..."); // ここで問題データをMainAlgorithmに渡して、回答を計算する(引数はReadableProblemData型) // Mainalgorithm.MatchCalculate(); Console.WriteLine("Done!"); // 回答結果を表示する(間違っている場所、かかった手数など) 未実装 + // CompareAnswers(convertedProblemData, ); + // これで提出するか聞く - Console.WriteLine("Do you want to submit this answer? (Y/n)"); + Console.WriteLine("これで提出しますか? (Y/n)"); string input = Console.ReadLine() ?? ""; if (input == "N" || input == "n") { // 手動で回答を作成するモードに移行する - Console.WriteLine("transit to Manual Mode"); - answerData = ManualMode(problemData); + Console.WriteLine("手動回答モードに移行します"); + answerData = ManualMode(convertedProblemData, dieList); } // 回答を提出する - Console.WriteLine("Submitting Answer..."); + Console.WriteLine("回答を提出しています..."); Networking.SendAnswerData(client, answerData); Console.WriteLine("Done!"); + } + } + /// + /// 手動操作モード用の抜き型を列挙したリストを作成 + /// + /// 使用する問題データ + /// 一般抜き型と特殊抜き型をあわせた二次元配列の配列 + List CreateDieList(in ReadableProblemData problemData) + { + List dieList = new List(); + // 一般抜き型を追加 + dieList.Add(new ReadablePatternData(1, 1, 1, new List> { new List { 1 } })); + for (int i = 2; i < 257; i *= 2) + { + for (int j = 0; j < 3; j++) + { + List> cell = new List>(); + switch (j) + { + case 0: + cell = CreateGeneralCuttingDieTypeI(i); + break; + case 1: + cell = CreateGeneralCuttingDieTypeII(i); + break; + case 2: + cell = CreateGeneralCuttingDieTypeIII(i); + break; + } + dieList.Add(new ReadablePatternData(dieList.Count + 1, i, i, cell)); + } + } + + // 特殊抜き型を追加 + for (int i = 0; i < problemData.General.N; i++) + { + dieList.Add(problemData.General.Patterns[i]); } + return dieList; } + List> CreateGeneralCuttingDieTypeI(int size) + { + List> die = new List>(); + for (int y = 0; y < size; y++) + { + List row = new List(); + for (int x = 0; x < size; x++) + { + row.Add(1); + } + die.Add(row); + } + return die; + } + List> CreateGeneralCuttingDieTypeII(int size) + { + List> die = new List>(); + for (int y = 0; y < size; y++) + { + List row = new List(); + for (int x = 0; x < size; x++) + { + if (y % 2 == 0) row.Add(1); + else row.Add(0); + } + die.Add(row); + } + + return die; + } + + List> CreateGeneralCuttingDieTypeIII(int size) + { + List> die = new List>(); + for (int y = 0; y < size; y++) + { + List row = new List(); + for (int x = 0; x < size; x++) + { + if (x % 2 == 0) row.Add(1); + else row.Add(0); + } + die.Add(row); + } + return die; + } /// /// 手動で回答を作成するモードに移行する 未実装 /// /// 使用する問題データ - /// - AnswerData ManualMode(ProblemData problemData) + /// 使用する抜き型のリスト + /// 初期盤面 + /// 手動操作モードで作成した回答データ + AnswerData ManualMode(ReadableProblemData problemData, IReadOnlyList dieList, List> board = null) { + AnswerData answerData = Answer.Create(); + if (board == null) board = problemData.Board.Start.ToList(); + + int useDieIndex = 0; + bool isMovingMode = false; + (int left, int top) cursorPosition = (Console.CursorLeft, Console.CursorTop); + (int x, int y) diePosition = (0, 0); + List>> history = new List>>(); Console.WriteLine("Manual Mode"); Console.WriteLine("Please input answer."); + + // キー入力を受付、回答を作成する while (true) { + ShowNowBoard(problemData, dieList, board, cursorPosition.left, cursorPosition.top, useDieIndex, diePosition.x, diePosition.y); Console.WriteLine("Please press key..."); - - ConsoleKeyInfo key = Console.ReadKey(); - - if (key.Key == ConsoleKey.Escape) + ConsoleKeyInfo key = Console.ReadKey(true); + if (isMovingMode) Console.WriteLine("抜いたあとに詰める方向を選択してください"); + switch (key.Key) { - // 終了 - Console.WriteLine("Exit Manual Mode"); - break; - } + case ConsoleKey.Escape: + Console.WriteLine("これで提出しますか? (Y/n)"); + string input = Console.ReadLine() ?? ""; + if (input == "N" || input == "n") break; + else if (input == "Y" || input == "y" || input == "") return answerData; + break; + + // 抜く場所の移動 + case ConsoleKey.W: + if (isMovingMode) + { + history.Add(board); + board = Case.DieCuttingUP(board, dieList[useDieIndex].Cells, diePosition.x, diePosition.y, 0, 0); + answerData.N++; + answerData.Ops.Add(new AnswerData.OperationData { P = useDieIndex, X = diePosition.x, Y = diePosition.y, S = AnswerData.OperationData.Side.Up }); + isMovingMode = !isMovingMode; + } + else if (diePosition.y > -(dieList[useDieIndex].Height - 1)) diePosition.y--; + break; + + case ConsoleKey.S: + if (isMovingMode) + { + history.Add(board); + board = Case.DieCuttingDown(board, dieList[useDieIndex].Cells, diePosition.x, diePosition.y, 0, 0); + answerData.N++; + answerData.Ops.Add(new AnswerData.OperationData { P = useDieIndex, X = diePosition.x, Y = diePosition.y, S = AnswerData.OperationData.Side.Down }); + isMovingMode = !isMovingMode; + } + else if (diePosition.y < problemData.Board.Height - 1) diePosition.y++; + break; + + case ConsoleKey.A: + if (isMovingMode) + { + history.Add(board); + board = Case.DieCuttingLeft(board, dieList[useDieIndex].Cells, diePosition.x, diePosition.y, 0, 0); + answerData.N++; + answerData.Ops.Add(new AnswerData.OperationData { P = useDieIndex, X = diePosition.x, Y = diePosition.y, S = AnswerData.OperationData.Side.Left }); + isMovingMode = !isMovingMode; + } + else if (diePosition.x > -(dieList[useDieIndex].Width - 1)) diePosition.x--; + break; + + case ConsoleKey.D: + if (isMovingMode) + { + history.Add(board); + board = Case.DieCuttingRight(board, dieList[useDieIndex].Cells, diePosition.x, diePosition.y, 0, 0); + answerData.N++; + answerData.Ops.Add(new AnswerData.OperationData { P = useDieIndex, X = diePosition.x, Y = diePosition.y, S = AnswerData.OperationData.Side.Right }); + isMovingMode = !isMovingMode; + } + else if (diePosition.x < problemData.Board.Width - 1) diePosition.x++; + break; + + // 型の選択 + case ConsoleKey.LeftArrow: + useDieIndex = (useDieIndex - 1 + dieList.Count) % dieList.Count; + break; + + case ConsoleKey.RightArrow: + useDieIndex = (useDieIndex + 1) % dieList.Count; + break; + + // 決定 + case ConsoleKey.Enter: + isMovingMode = !isMovingMode; + break; + + case ConsoleKey.H: + Console.WriteLine("Help"); + break; + + case ConsoleKey.Backspace: + break; - else if (key.Key == ConsoleKey.H) - { - // ヘルプを表示 - Console.WriteLine("Help"); } - else if (key.Key == ConsoleKey.Enter) + // デバッグ用 + Console.WriteLine($"useDieIndex: {useDieIndex}"); + Console.WriteLine($"DiePosition: {diePosition.x}, {diePosition.y}"); + Console.WriteLine($"Cursor: {cursorPosition.left}, {cursorPosition.top}"); + // ここまで + + } + } + + void ShowNowBoard(ReadableProblemData problemData, IReadOnlyList dieList, List> board, int cursorLeft, int cursorTop, int useDieIndex, int diePositionX, int diePositionY) + { + Console.SetCursorPosition(cursorLeft, cursorTop); + for (int y = 0; y < board.Count; y++) + { + for (int x = 0; x < board[y].Count; x++) { + try + { + if + ( + y >= diePositionY && + y < diePositionY + dieList[useDieIndex].Height && + x >= diePositionX && + x < diePositionX + dieList[useDieIndex].Width && + dieList[useDieIndex].Cells[y - diePositionY][x - diePositionX] == 1 + ) + { + Console.ForegroundColor = ConsoleColor.Green; + Console.Write(board[y][x]); + Console.ResetColor(); + } + else Console.Write(board[y][x]); + } + catch (ArgumentOutOfRangeException e) + { + Console.WriteLine(); + Console.WriteLine("Error"); + Console.WriteLine(e.Message); + Console.WriteLine($"y: {y}, x: {x}"); + Console.WriteLine($"diePositionY: {diePositionY}, diePositionX: {diePositionX}"); + Console.WriteLine($"y - diePositionY: {y - diePositionY}, x - diePositionX: {x - diePositionX}"); + Console.WriteLine($"dieList[useDieIndex].Height: {dieList[useDieIndex].Height}, dieList[useDieIndex].Width: {dieList[useDieIndex].Width}"); + } } - + Console.WriteLine(); } - return answerData; } - - void CompareAnswers(ReadableProblemData problemData, ReadableProblemData answerData) + /// + /// 回答結果を表示する + /// + /// 問題データ + /// 回答データ + /// 回答データ通りに動かした際のBoardを2次元配列に変換したもの + void CompareAnswers(ReadableProblemData problemData, AnswerData answerData, List> answerBoard) { + int collectPieceNum = 0; + // 問題データと回答データを比較する + for (int y = 0; y < problemData.Board.Height; y++) + { + for (int x = 0; x < problemData.Board.Width; x++) + { + if (problemData.Board.Goal[y][x] != answerBoard[y][x]) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.Write(answerBoard[y][x] + " "); + Console.ResetColor(); + } + + else + { + collectPieceNum++; + Console.Write(answerBoard[y][x] + " "); + } + } + Console.WriteLine(); + } + Console.WriteLine($"一致率: {collectPieceNum / (problemData.Board.Width * problemData.Board.Height) * 100}%"); + Console.WriteLine($"一致ピース数: {collectPieceNum}"); + Console.WriteLine($"かかった手数: {answerData.N}"); } } diff --git a/2024ProconTemporary/Command-Line/Convert-Data-Class/ReadableProblemData.cs b/2024ProconTemporary/Command-Line/Convert-Data-Class/ReadableProblemData.cs index 1149e2d..9e24a70 100644 --- a/2024ProconTemporary/Command-Line/Convert-Data-Class/ReadableProblemData.cs +++ b/2024ProconTemporary/Command-Line/Convert-Data-Class/ReadableProblemData.cs @@ -12,7 +12,7 @@ public class ReadableProblemData public ReadableProblemData(ProblemData problemData) { Board = new ReadableBoardData(problemData.Board.Width, problemData.Board.Height, problemData.Board.Start, problemData.Board.Goal); - General = new ReadableGeneralData(problemData.General.N, problemData.General.Patterns.Select(p => new ReadableGeneralData.ReadablePatternData(p.P, p.Width, p.Height, p.Cells)).ToList()); + General = new ReadableGeneralData(problemData.General.N, problemData.General.Patterns.Select(p => new ReadablePatternData(p.P, p.Width, p.Height, p.Cells)).ToList()); } public void Print() @@ -46,84 +46,104 @@ public void Print() } } } - - public class ReadableBoardData + } + public class ReadableBoardData + { + public int Width { get; set; } + public int Height { get; set; } + public List> Start { get; set; } + public List> Goal { get; set; } + public ReadableBoardData(int width, int height, IList start, IList goal) { - public int Width { get; set; } - public int Height { get; set; } - public IList> Start { get; set; } - public IList> Goal { get; set; } - public ReadableBoardData(int width, int height, IList start, IList goal) - { - Width = width; - Height = height; + Width = width; + Height = height; - Start = new List>(); + Start = new List>(); - foreach (var s in start) + foreach (var s in start) + { + var list = new List(); + IEnumerable index = s.ToCharArray(); + foreach (var c in index) { - var list = new List(); - IEnumerable index = s.ToCharArray(); - foreach (var c in index) - { - list.Add(c - '0'); - } - Start.Add(list); + list.Add(c - '0'); } + Start.Add(list); + } - Goal = new List>(); + Goal = new List>(); - foreach (var g in goal) + foreach (var g in goal) + { + var list = new List(); + IEnumerable index = g.ToCharArray(); + foreach (var c in index) { - var list = new List(); - IEnumerable index = g.ToCharArray(); - foreach (var c in index) - { - list.Add(c - '0'); - } - Goal.Add(list); + list.Add(c - '0'); } + Goal.Add(list); } } + } + + public class ReadableGeneralData + { + public int N; + public IList Patterns { get; set; } - public class ReadableGeneralData + public ReadableGeneralData(int n, IList patterns) { - public int N; - public IList Patterns { get; set; } + N = n; + Patterns = patterns; + } - public ReadableGeneralData(int n, IList patterns) - { - N = n; - Patterns = patterns; - } - public class ReadablePatternData + } + + + public class ReadablePatternData + { + public int P { get; set; } + public int Width { get; set; } + public int Height { get; set; } + public List> Cells { get; set; } + public ReadablePatternData(int p, int width, int height, IList cells) + { + P = p; + Width = width; + Height = height; + + Cells = new List>(); + foreach (var c in cells) { - public int P { get; set; } - public int Width { get; set; } - public int Height { get; set; } - public IList> Cells { get; set; } - public ReadablePatternData(int p, int width, int height, IList cells) + var list = new List(); + IEnumerable index = c.ToCharArray(); + foreach (var i in index) { - P = p; - Width = width; - Height = height; - - Cells = new List>(); - foreach (var c in cells) - { - var list = new List(); - IEnumerable index = c.ToCharArray(); - foreach (var i in index) - { - list.Add(i - '0'); - } - Cells.Add(list); - } + list.Add(i - '0'); } + Cells.Add(list); + } + } + public ReadablePatternData(int p, int width, int height, IList> cells) + { + P = p; + Width = width; + Height = height; + Cells = new List>(); + foreach (var c in cells) + { + var list = new List(); + foreach (var i in c) + { + list.Add(i); + } + Cells.Add(list); } } + + } } diff --git a/2024ProconTemporary/Command-Line/BootProgram.cs b/2024ProconTemporary/Command-Line/EntryPoint.cs similarity index 68% rename from 2024ProconTemporary/Command-Line/BootProgram.cs rename to 2024ProconTemporary/Command-Line/EntryPoint.cs index b28352d..39cca61 100644 --- a/2024ProconTemporary/Command-Line/BootProgram.cs +++ b/2024ProconTemporary/Command-Line/EntryPoint.cs @@ -8,8 +8,8 @@ class BootProgram { - // static void Main(string[] args) - // { - // Cli.Execute(args); - // } + static void Main(string[] args) + { + Cli.Execute(args); + } } \ No newline at end of file diff --git a/2024ProconTemporary/MainAlgorithm.cs b/2024ProconTemporary/MainAlgorithm.cs index a0e19b3..d8b32c2 100644 --- a/2024ProconTemporary/MainAlgorithm.cs +++ b/2024ProconTemporary/MainAlgorithm.cs @@ -254,18 +254,18 @@ public static int WarpValuationCalculation(List> Ques, List> for (int Y = 0; Y < pieceY; Y++) { - WantListXS[Y] = new int[4]; - for (int number = 0; number < 4; number++) - { - var WantCheckS = Ans[Y].Count(item => item == number) - Ques[Y].Count(item => item == number); +// WantListXS[Y] = new int[4]; +// for (int number = 0; number < 4; number++) +// { +// var WantCheckS = Ans[Y].Count(item => item == number) - Ques[Y].Count(item => item == number); - WantListXS[Y][number] = WantCheckS; - Count += WantListXS[Y].Count(item => item == 0); - } + // WantListXS[Y][number] = WantCheckS; + // Count += WantListXS[Y].Count(item => item == 0); + // } - } - return Count; - } + // } + // return Count; + // } public static List> QuestionShunting(List> Ques, List> Ans, int pieceX, int pieceY, int[][] WantListX, int[][] WantListY, int[][] WantListXS) { @@ -322,10 +322,10 @@ public static bool XYWantCount(List> Ques, List> Ans, int pi WantListY[Number][X] = WantCheck; - } - } - return true; - } +// } +// } +// return true; +// } public static int ListWarp(int X, int Y, int[][] WantListX, int[][] WantListY) { @@ -875,29 +875,29 @@ public static void PatternCount(List> Ques, List>> Patt OneIndexList[i][Y].Add(X); } - } + // } - if (ZeroIndexList[i][Y].Count == 0) - { - ZeroIndexList[i][Y].Add(0); - } - if (OneIndexList[i][Y].Count == 0) - { - OneIndexList[i][Y].Add(0); - } + if (ZeroIndexList[i][Y].Count == 0) + { + ZeroIndexList[i][Y].Add(0); + } + if (OneIndexList[i][Y].Count == 0) + { + OneIndexList[i][Y].Add(0); + } - } - if (PatternList[i].Count >= Ques.Count) - { - if (PatternList[i][0].Count >= Ques[0].Count) + } + if (PatternList[i].Count >= Ques.Count) { - PatternSizeListOver.Add(i); - continue; + if (PatternList[i][0].Count >= Ques[0].Count) + { + PatternSizeListOver.Add(i); + continue; + } } + PatternSizeListNotOver.Add(i); } - PatternSizeListNotOver.Add(i); } - } public static void IndexCount(List> Ques, int pieceX, int pieceY) { NumberIndexList = new List>>(); @@ -1047,73 +1047,73 @@ public static (int, int, int, int) SearchDie(List> ques, List> beforeCollectPieceArray, List> afterCollectPieceArray, bool T) - { - int effectiveScore = 0; - if (T) + static int CalculateEffectiveScore(List> beforeCollectPieceArray, List> afterCollectPieceArray, bool T) { - for (int y = 0; y < Ymax; y++) + int effectiveScore = 0; + if (T) { - for (int x = 0; x < Xmax; x++) + for (int y = 0; y < Ymax; y++) { - effectiveScore += (int)beforeCollectPieceArray[x][y] - afterCollectPieceArray[x][y]; + for (int x = 0; x < Xmax; x++) + { + effectiveScore += (int)beforeCollectPieceArray[x][y] - afterCollectPieceArray[x][y]; + } } } - } - else - { - for (int y = 0; y < Ymax; y++) + else { - for (int x = 0; x < Xmax; x++) + for (int y = 0; y < Ymax; y++) { - effectiveScore += (int)beforeCollectPieceArray[x][y] - afterCollectPieceArray[x][y]; + for (int x = 0; x < Xmax; x++) + { + effectiveScore += (int)beforeCollectPieceArray[x][y] - afterCollectPieceArray[x][y]; + } } } - } - return effectiveScore; - } + return effectiveScore; + } - static List> CreateCollectPieceArray(List> ques, List> ans, bool T) - { - if (T) + static List> CreateCollectPieceArray(List> ques, List> ans, bool T) { - List> collectPieceArray = new List>(); - for (int x = 0; x < Xmax; x++) + if (T) { - List collectPieceRaw = new List(); - for (int y = 0; y < Ymax; y++) + List> collectPieceArray = new List>(); + for (int x = 0; x < Xmax; x++) { - if (ques[x][y] == ans[x][y]) collectPieceRaw.Add(1); - else collectPieceRaw.Add(0); + List collectPieceRaw = new List(); + for (int y = 0; y < Ymax; y++) + { + if (ques[x][y] == ans[x][y]) collectPieceRaw.Add(1); + else collectPieceRaw.Add(0); + } + collectPieceArray.Add(collectPieceRaw); } - collectPieceArray.Add(collectPieceRaw); + return collectPieceArray; } - return collectPieceArray; - } - else - { - List> collectPieceArray = new List>(); - for (int x = 0; x < Xmax; x++) + else { - List collectPieceRaw = new List(); - for (int y = 0; y < Ymax; y++) + List> collectPieceArray = new List>(); + for (int x = 0; x < Xmax; x++) { - if (ques[y][x] == ans[y][x]) collectPieceRaw.Add(1); - else collectPieceRaw.Add(0); + List collectPieceRaw = new List(); + for (int y = 0; y < Ymax; y++) + { + if (ques[y][x] == ans[y][x]) collectPieceRaw.Add(1); + else collectPieceRaw.Add(0); + } + collectPieceArray.Add(collectPieceRaw); } - collectPieceArray.Add(collectPieceRaw); + return collectPieceArray; } - return collectPieceArray; + } } } - -} diff --git a/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.AssemblyInfo.cs b/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.AssemblyInfo.cs index 1bdc141..7d745bf 100644 --- a/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.AssemblyInfo.cs +++ b/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.AssemblyInfo.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // -// このコードはツールによって生成されました。 -// ランタイム バージョン:4.0.30319.42000 +// This code was generated by a tool. // -// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 -// コードが再生成されるときに損失したりします。 +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ diff --git a/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.csproj.CoreCompileInputs.cache b/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.csproj.CoreCompileInputs.cache index 681ae9d..4f3d8e4 100644 --- a/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.csproj.CoreCompileInputs.cache +++ b/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -e8b85a71484f2233c12c0b97b98ff5b5584342a5327d5e918c0cd2b5d576fe1c +65fde75b732fc4326b8a29efb2405bde2d7405fc0d991bccd1ccf2210000cf2a diff --git a/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.sourcelink.json b/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.sourcelink.json index 74c5d5b..4d0fa09 100644 --- a/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.sourcelink.json +++ b/2024ProconTemporary/obj/Debug/net8.0/2024ProconTemporary.sourcelink.json @@ -1 +1 @@ -{"documents":{"C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\*":"https://raw.githubusercontent.com/Sofken-natori/Procon2024/8e39abc5301e11852af6386d1bb73ba886a2602a/*"}} \ No newline at end of file +{"documents":{"C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\*":"https://raw.githubusercontent.com/Sofken-natori/Procon2024/8e39abc5301e11852af6386d1bb73ba886a2602a/*"}}