Created
April 2, 2020 07:40
Revisions
-
wizard1066 created this gist
Apr 2, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ 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 }