Skip to content

Instantly share code, notes, and snippets.

@wizard1066
Created April 2, 2020 07:40
Show Gist options
  • Save wizard1066/9a5fcf2100f39b8c8e63b327abd434c4 to your computer and use it in GitHub Desktop.
Save wizard1066/9a5fcf2100f39b8c8e63b327abd434c4 to your computer and use it in GitHub Desktop.
abpwtpF
func confirmColours(textColors:[Color],figures:Int) -> Bool? {
for loop in 0 ..< figures {
if textColors[loop] == Color.clear {
return false
}
}
var tfigures = figures - 1
let rfigure = Int(Double(figures).squareRoot())
for _ in 0..<rfigure {
var superSet = Set<String>()
for loop in stride(from: tfigures, to: tfigures - rfigure, by: -1) {
superSet.insert(textColors[loop].description)
print("loop ",loop)
}
tfigures = tfigures - rfigure
print("superSet ",superSet,superSet.count)
if superSet.count != rfigure {
alertPublisher.send()
}
}
tfigures = figures - 1
for _ in 0..<rfigure {
var superSet = Set<String>()
for loop in stride(from: tfigures, to: -1, by: -rfigure) {
superSet.insert(textColors[loop].description)
print("loop2 ",loop)
}
tfigures = tfigures - 1
print("superSet ",superSet,superSet.count)
if superSet.count != rfigure {
alertPublisher.send()
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment