adventofcode2023/day2/part1/Program.cs
2023-12-06 12:57:05 -05:00

50 lines
1.4 KiB
C#

namespace part1;
class Program
{
struct Draw_Results
{
public int Red, Green, Blue;
}
static void Main(string[] args)
{
Dictionary<int, List<Draw_Results>> GameData = new();
// Load the list with game data
StreamReader sr = new StreamReader("input");
string line = sr.ReadLine();
while (line != null)
{
string gameStartString = "Game ";
string gameStopString = ":";
int gameStart = line.IndexOf(gameStartString) + gameStartString.Length;
int gameStop = line.IndexOf(":");
int gameNumber = Int32.Parse(line.Substring(gameStart, gameStop - gameStart));
List<Draw_Results> results = [];
string[] colors = ["red,", "green,", "blue,"];
int oldDelimiterLocation = 0;
List<string> games = [];
string processedLine = line.Substring(gameStop + 1);
int delimiterLocation = processedLine.IndexOf(";");
while(delimiterLocation != -1) {
games.Add(processedLine[..delimiterLocation]);
processedLine = processedLine.Substring(delimiterLocation + 2);
delimiterLocation = processedLine.IndexOf(";");
}
line = sr.ReadLine();
}
//close the file
sr.Close();
}
}