This commit is contained in:
parent
14928230b8
commit
00815609cb
@ -81,12 +81,11 @@ func findMinimumSet(mySet map[string]int, m *minimumSet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PossibleGamesSum(s string, gn int, gt *int) {
|
func PossibleGamesSum(s string, gn int, gt *int) {
|
||||||
var isPossible possibleGame
|
|
||||||
// Initialize everything to true. If everything was set to false,
|
// Initialize everything to true. If everything was set to false,
|
||||||
// we would have to check in both directions for every pass
|
// we would have to check in both directions for every pass
|
||||||
isPossible.redIsPossible = true
|
isPossible := possibleGame{redIsPossible: true,
|
||||||
isPossible.greenIsPossible = true
|
greenIsPossible: true,
|
||||||
isPossible.blueIsPossible = true
|
blueIsPossible: true}
|
||||||
// We will pass a pointer so we can go one map at a time and
|
// We will pass a pointer so we can go one map at a time and
|
||||||
// still maintain the results
|
// still maintain the results
|
||||||
var isPossiblePoint *possibleGame
|
var isPossiblePoint *possibleGame
|
||||||
@ -129,8 +128,8 @@ func PowerSetsSum(s string, pt *int) {
|
|||||||
for i := 0; i < numSets; i++ {
|
for i := 0; i < numSets; i++ {
|
||||||
// We create a map
|
// We create a map
|
||||||
mySet = newGameSet(sets[i])
|
mySet = newGameSet(sets[i])
|
||||||
// We check if the game is possible
|
// We find the minimum set
|
||||||
findMinimumSet(mySet, minSetPoint)
|
findMinimumSet(mySet, minSetPoint)
|
||||||
}
|
}
|
||||||
*pt += (minSet.red * minSet.green * minSet.blue)
|
*pt += (minSet.red * minSet.green * minSet.blue)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user