I think I will probably start with all the quotes and their corresponding ratings.
val quotes = Map( "quote this" -> 10 , "no quote" -> 20 , "quoteless" -> 10 )
Then combine them in as many ways as possible.
Turn this into a Map using the appropriate point scores.
Now you call the search for all quotes, which, when combined, are summed with the specified amount.
// get all the quote combinations that have this score total scoreSum(20) //res0: IndexedSeq[List[String]] = Vector(List(no quote), List(quote this, quoteless))
As for presenting the results in random order, since you already asked about it twice already , and received good answers, I assume that this will not be a problem.
source share