Maybe I should compile the list at different times so it doesn't load all at once?
Everything worked until I added row 4 and 5, so I'm not sure it's a coding issue. Seems more like a noobie issue, not knowing what tools are my disposal.
The overall goal is to generate a combination of numbers (0-100) in 5 rows. Without any duplicates. 1,2,3,4,5 to 1,2,3,4,6 ect ect until all combinations are completed.
I've attached the code below ::
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val startButton = findViewById<Button>(R.id.startButton)
val possibilities = findViewById<TextView>(R.id.possibilities)
val rowOne = listOf("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70")
val rowTwo = listOf("2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70")
val rowThree = listOf("3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70")
val rowFour = listOf("4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70")
val rowFive = listOf("5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70")
val combinations =
rowOne.flatMap { rowOne ->
rowTwo.flatMap { rowTwo ->
rowThree.flatMap { rowThree ->
rowFour.flatMap { rowFour ->
rowFive.map { rowFive -> "$rowFour $rowFive" }
}.map { resultThree -> "$resultThree $rowThree" }
}.map { resultTwo -> "$resultTwo $rowTwo" }
}.map { resultOne -> "$resultOne $rowOne" }
}.toList()
startButton.setOnClickListener {
possibilities.text = ("${(combinations).size} Possibilities")}