C
C#5mo ago
Grimson

✅ Use of Unassigned local variable?

Hi, I am solving the advent of coding challenges for practice for uni and I have already finished the problem and now I am trying to optimize code. However, I I can't seem to figure out why I am getting use of unassigned local variable when I try to cache the results in a dictionary. I have already initialized the dictionary, so I don't know what the issue is. Can anyone help please? The problem is in program.cs file. URL : https://github.com/AnmolSinha1201/Orbit
GitHub
GitHub - AnmolSinha1201/Orbit
Contribute to AnmolSinha1201/Orbit development by creating an account on GitHub.
5 Replies
Grimson
GrimsonOP5mo ago
Also, I believe I was wrong, my caching strategy doesn't work. Do you guys have any opinions?
Angius
Angius5mo ago
Where are you getting this error?
Grimson
GrimsonOP5mo ago
It said line 6. Specifially var total = TotalNumberOfOrbits(root);. But since then, I have realized that class files work very different from the top level program.cs. Moving the dictionary declaration fixed the issue Also, my optimization idea was wrong. So I'm trying new ways to optimize the solution
Grimson
GrimsonOP5mo ago
Observable
Day 6: Universal Orbit Map
You've landed at the Universal Orbit Map facility on Mercury. Because navigation in space often involves transferring between orbits, the orbit maps here are useful for finding efficient routes between, for example, you and Santa. You download a map of the local orbits (your puzzle input). Except for the universal Center of Mass (COM), every obj...
Grimson
GrimsonOP5mo ago
But our professor said that it can be optimized and I'm trying to think of a solution to do that
Want results from more Discord servers?
Add your server