Skip to content

Instantly share code, notes, and snippets.

@withs
Last active May 14, 2021 15:15
Show Gist options
  • Save withs/bb663ed9d4054056aca62348d92e7cba to your computer and use it in GitHub Desktop.
Save withs/bb663ed9d4054056aca62348d92e7cba to your computer and use it in GitHub Desktop.
Simple script wich make the suite of conway
/*
Simple script wich make the suite of conway with a give limit (100 on this file)
with some info about the time :)
made on ipad pro in swift playground ^^
*/
import Foundation
let startTime = Date().timeIntervalSinceReferenceDate
var suite: String = "1"
var highest: Int = 0
for r in 1...100{
var tempList: [[String]] = [[]]
suite.map{
if (Int(String($0))! > highest){
highest = Int(String($0))!
print("New highest found : \(Int(String($0))!) in -> \(Date().timeIntervalSinceReferenceDate - startTime) at \(r)th iteration")
}
if (String($0) != tempList.last!.last) {
if tempList.last!.count != 0 {
tempList.append([String]())
}
}
tempList[tempList.count - 1].append(String($0))
}
suite = tempList.map{ "(String($0.count))(String($0.last!))" }.joined()
}
let endTime = Date().timeIntervalSinceReferenceDate
print("Found highest : \(highest) in -> \(endTime - startTime) seconds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment