Skip to content

Commit

Permalink
型探索開発中
Browse files Browse the repository at this point in the history
  • Loading branch information
suzukitasuku committed Oct 16, 2024
2 parents 0f224c5 + f4af867 commit 64337f3
Show file tree
Hide file tree
Showing 34 changed files with 2,811 additions and 85 deletions.
Binary file modified .vs/2024ProconTemporary/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/2024ProconTemporary/v17/.futdcache.v2
Binary file not shown.
Binary file modified .vs/2024ProconTemporary/v17/.suo
Binary file not shown.
53 changes: 34 additions & 19 deletions .vs/2024ProconTemporary/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@
"AbsoluteMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|c:\\users\\suzuk\\downloads\\2024procontemporary\\2024procontemporary\\mainalgorithm.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|solutionrelative:2024procontemporary\\mainalgorithm.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|c:\\users\\suzuk\\downloads\\2024procontemporary\\2024procontemporary\\com\\networking.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|solutionrelative:2024procontemporary\\com\\networking.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|c:\\users\\suzuk\\downloads\\2024procontemporary\\2024procontemporary\\case.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|solutionrelative:2024procontemporary\\case.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|c:\\users\\suzuk\\downloads\\2024procontemporary\\2024procontemporary\\command-line\\convert-data-class\\readableproblemdata.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|solutionrelative:2024procontemporary\\command-line\\convert-data-class\\readableproblemdata.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|c:\\users\\suzuk\\downloads\\2024procontemporary\\2024procontemporary\\pattern.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|solutionrelative:2024procontemporary\\pattern.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|c:\\users\\suzuk\\downloads\\2024procontemporary\\2024procontemporary\\practice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|solutionrelative:2024procontemporary\\practice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|c:\\users\\suzuk\\downloads\\2024procontemporary\\2024procontemporary\\com\\answerdata.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{69920A19-40B1-4F34-84CF-9EAA752754C8}|2024ProconTemporary\\2024ProconTemporary.csproj|solutionrelative:2024procontemporary\\com\\answerdata.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
Expand All @@ -40,7 +44,7 @@
"RelativeDocumentMoniker": "2024ProconTemporary\\MainAlgorithm.cs",
"ToolTip": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\MainAlgorithm.cs",
"RelativeToolTip": "2024ProconTemporary\\MainAlgorithm.cs",
"ViewState": "AQIAAFgCAAAAAAAAAAAAwGkCAAARAAAA",
"ViewState": "AQIAABEAAAAAAAAAAADwvyUAAAAJAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-06T11:13:35.538Z",
"IsPinned": true,
Expand All @@ -52,46 +56,57 @@
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "AnswerData.cs",
"DocumentMoniker": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Com\\AnswerData.cs",
"RelativeDocumentMoniker": "2024ProconTemporary\\Com\\AnswerData.cs",
"ToolTip": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Com\\AnswerData.cs",
"RelativeToolTip": "2024ProconTemporary\\Com\\AnswerData.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"DocumentIndex": 1,
"Title": "Networking.cs",
"DocumentMoniker": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Com\\Networking.cs",
"RelativeDocumentMoniker": "2024ProconTemporary\\Com\\Networking.cs",
"ToolTip": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Com\\Networking.cs",
"RelativeToolTip": "2024ProconTemporary\\Com\\Networking.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAoAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-16T00:48:45.749Z",
"WhenOpened": "2024-10-16T15:52:35.535Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "ReadableProblemData.cs",
"DocumentMoniker": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Command-Line\\Convert-Data-Class\\ReadableProblemData.cs",
"RelativeDocumentMoniker": "2024ProconTemporary\\Command-Line\\Convert-Data-Class\\ReadableProblemData.cs",
"ToolTip": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Command-Line\\Convert-Data-Class\\ReadableProblemData.cs",
"RelativeToolTip": "2024ProconTemporary\\Command-Line\\Convert-Data-Class\\ReadableProblemData.cs",
"ViewState": "AQIAADYAAAAAAAAAAAAiwAAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-16T15:51:53.134Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "Practice.cs",
"DocumentMoniker": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Practice.cs",
"RelativeDocumentMoniker": "2024ProconTemporary\\Practice.cs",
"ToolTip": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Practice.cs",
"RelativeToolTip": "2024ProconTemporary\\Practice.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAwAAAAkAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-06T13:03:07.023Z",
"EditorCaption": ""
"WhenOpened": "2024-08-06T13:03:07.023Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 4,
"Title": "Pattern.cs",
"DocumentMoniker": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Pattern.cs",
"RelativeDocumentMoniker": "2024ProconTemporary\\Pattern.cs",
"ToolTip": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Pattern.cs",
"RelativeToolTip": "2024ProconTemporary\\Pattern.cs",
"ViewState": "AQIAACIAAAAAAAAAAAAAwCoAAAAUAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-06T13:01:58.599Z",
"EditorCaption": ""
"WhenOpened": "2024-08-06T13:01:58.599Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 2,
"Title": "Case.cs",
"DocumentMoniker": "C:\\Users\\suzuk\\Downloads\\2024ProconTemporary\\2024ProconTemporary\\Case.cs",
"RelativeDocumentMoniker": "2024ProconTemporary\\Case.cs",
Expand Down
Binary file modified .vs/ProjectEvaluation/2024procontemporary.metadata.v8.bin
Binary file not shown.
Binary file modified .vs/ProjectEvaluation/2024procontemporary.projects.v8.bin
Binary file not shown.
Binary file modified .vs/ProjectEvaluation/2024procontemporary.strings.v8.bin
Binary file not shown.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"Procon"
]
}
3 changes: 2 additions & 1 deletion 2024ProconTemporary/2024ProconTemporary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

<ItemGroup>
<PackageReference Include="DotNetEnv" Version="3.1.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4"/>
<PackageReference Include="EntryPoint" Version="1.3.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions 2024ProconTemporary/Com/Networking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ public static class Networking
static Networking()
{
Env.Load();
ServerIp = Env.GetString("SERVER_IP", "127.0.0.1:3000");
Token = Env.GetString("PROCON_TOKEN");
}


public static HttpClient CreateClient()
{
return new HttpClient();
Expand Down
147 changes: 147 additions & 0 deletions 2024ProconTemporary/Command-Line/BootCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
using EntryPoint;
using System;
using _2024ProconTemporary.ReadableData;
using _2024ProconTemporary.Com;
using _2024ProconTemporary;
using System.Linq;


namespace _2024ProconTemporary.CommandLine.Commands
{
public class BootCommandClient : BaseCliArguments
{
public BootCommandClient() : base("Initialize Command") { }

[OptionParameter(ShortName: 'v', LongName: "view")]
[Help("問題データを表示します")]
public bool isView { get; set; }

[OptionParameter(ShortName: 'm', LongName: "manual")]
[Help("手動で回答を作成するモードに移行します")]
public bool isManual { get; set; }
}

public class BootCommand
{
public void Handle(BootCommandClient args)
{
Console.WriteLine("Booting...");
// 問題データを取得する
Console.WriteLine("Getting Problem Data...");
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.");
return;
}
Console.WriteLine("Done!");

Console.WriteLine("Converting Problem Data...");
// 問題データ、回答データをstringの配列からintの2次元配列に変換する
ReadableProblemData convertedProblemData = new ReadableProblemData(problemData);
Console.WriteLine("Done!");
Console.WriteLine("View Problem Data:");
convertedProblemData.Print();
// 問題データを表示する
if (args.isView)
{
Console.WriteLine("View Problem Data:");
convertedProblemData.Print();
}

AnswerData answerData = Answer.Create();

// 手動で回答を作成するモードに移行する
if (args.isManual)
{
Console.WriteLine("Manual Mode");
Console.WriteLine("Please input answer.");
ManualMode(problemData);
}

else
{
// 自動回答モードに移行する
Console.WriteLine("Automatic Mode");
Console.WriteLine("Calculating Answer...");
// ここで問題データをMainAlgorithmに渡して、回答を計算する(引数はReadableProblemData型)
// Mainalgorithm.MatchCalculate();

Console.WriteLine("Done!");

// 回答結果を表示する(間違っている場所、かかった手数など) 未実装



// これで提出するか聞く
Console.WriteLine("Do you want to submit this answer? (Y/n)");
string input = Console.ReadLine() ?? "";

if (input == "N" || input == "n")
{
// 手動で回答を作成するモードに移行する
Console.WriteLine("transit to Manual Mode");
answerData = ManualMode(problemData);
}

// 回答を提出する
Console.WriteLine("Submitting Answer...");
Networking.SendAnswerData(client, answerData);
Console.WriteLine("Done!");

}
}


/// <summary>
/// 手動で回答を作成するモードに移行する 未実装
/// </summary>
/// <param name="problemData">使用する問題データ</param>
/// <returns></returns>
AnswerData ManualMode(ProblemData problemData)
{
AnswerData answerData = Answer.Create();
Console.WriteLine("Manual Mode");
Console.WriteLine("Please input answer.");

// キー入力を受付、回答を作成する
while (true)
{
Console.WriteLine("Please press key...");

ConsoleKeyInfo key = Console.ReadKey();

if (key.Key == ConsoleKey.Escape)
{
// 終了
Console.WriteLine("Exit Manual Mode");
break;
}

else if (key.Key == ConsoleKey.H)
{
// ヘルプを表示
Console.WriteLine("Help");
}

else if (key.Key == ConsoleKey.Enter)
{

}

}
return answerData;

}

void CompareAnswers(ReadableProblemData problemData, ReadableProblemData answerData)
{

}
}


}
15 changes: 15 additions & 0 deletions 2024ProconTemporary/Command-Line/BootProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using EntryPoint;
using System;
using _2024ProconTemporary.CommandLine.Commands;
using _2024ProconTemporary.Base;
using _2024ProconTemporary.Com;
using System.Security.Cryptography.X509Certificates;

class BootProgram
{

// static void Main(string[] args)
// {
// Cli.Execute<CommandClient>(args);
// }
}
21 changes: 21 additions & 0 deletions 2024ProconTemporary/Command-Line/CommandClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using EntryPoint;
using _2024ProconTemporary.CommandLine.Commands;


namespace _2024ProconTemporary.Base
{
public class CommandClient : BaseCliCommands
{
[DefaultCommand]
[Command("Boot")]
[Help("受け取った問題を解くコマンド")]
public void Boot(string[] args)
{
var options = Cli.Parse<BootCommandClient>(args);
var command = new BootCommand();
command.Handle(options);
}


}
}
Loading

0 comments on commit 64337f3

Please sign in to comment.