mirror of
https://github.com/Xevion/advent-of-code.git
synced 2025-12-10 00:06:28 -06:00
day4 guard_best_minute duplicate
This commit is contained in:
@@ -24,6 +24,7 @@ class GuardData:
|
|||||||
guard = max(self.guards.items(), key=lambda item : self.guard_best_minute(item[0])[1])
|
guard = max(self.guards.items(), key=lambda item : self.guard_best_minute(item[0])[1])
|
||||||
return guard[0], (self.guard_best_minute(guard[0]))
|
return guard[0], (self.guard_best_minute(guard[0]))
|
||||||
|
|
||||||
|
# Returns the minute the guard selected was asleep the most, along with how much
|
||||||
def guard_best_minute(self, id):
|
def guard_best_minute(self, id):
|
||||||
return max(enumerate(self.guards[id]['minutes']), key=lambda i : i[1])
|
return max(enumerate(self.guards[id]['minutes']), key=lambda i : i[1])
|
||||||
|
|
||||||
@@ -32,10 +33,6 @@ class GuardData:
|
|||||||
best = max(self.guards.items(), key=lambda item : item[1]['total'])
|
best = max(self.guards.items(), key=lambda item : item[1]['total'])
|
||||||
return best[0], best[1]['total']
|
return best[0], best[1]['total']
|
||||||
|
|
||||||
# Returns the minute the guard selected was asleep the most, along with how much
|
|
||||||
def guard_best_minute(self, id):
|
|
||||||
return max(enumerate(self.guards[id]['minutes']), key=lambda item : item[1])
|
|
||||||
|
|
||||||
# Simply ensures the guard exists.
|
# Simply ensures the guard exists.
|
||||||
# Otherwise, it will initalize a guard with the id.
|
# Otherwise, it will initalize a guard with the id.
|
||||||
def ensure_exists(self, id):
|
def ensure_exists(self, id):
|
||||||
|
|||||||
Reference in New Issue
Block a user