CORRECT!! Well done!
The answer is [((n^2 + n) / 2) - n] which is 28.
Why? Because a Whiskey-Cola is the same as a Cola-Whiskey.
It was based on this kind of logic that I built my new collision detector.
Old code:
B4X:
Dim number_of_characters = 256 as Int 'Originally as Boolean (ahahah, thx Informatix)
Dim Collision(256, 256) as Boolean
For host = 0 to (number_of_characters - 1)
For guest = 0 to (number_of_characters - 1)
Collision(host, guest) = CheckCollision(host, guest)
Next
Next
'Number of Collision Checks: 65536
My new method:
B4X:
Dim number_of_characters = 256 as Int 'Originally as Boolean (ahahah, thx Informatix)
Dim Collision(256, 256) as Boolean
For host = 0 to (number_of_characters - 1)
For guest = host + 1 to (number_of_characters - 1)
Collision(host, guest) = CheckCollision(host, guest)
Collision(guest, host) = Collision(host, guest)
Next
Next
'Number of Collision Checks: 32640
For more on this subject, Google: Triangular Numbers
actually it's not always the case, some drinks are forbidden to be shaken because the stuff isn't supposed to mix and are floating on top of each other.
so if you have whiskey-cola it will taste different than cola-whiskey because you get the other stuff in your mouth first
Probably I'm wrong, but I reached the same correct result applying [n! / (n-k)!] /2 that derives from what in Italian is called "Disposizioni semplici", where "n" are the objects and "k" are the elements put together. Final division accounts for couples like Gin-Rum / Rum-Gin.
Probably I'm wrong, but I reached the same correct result applying [n! / (n-k)!] /2 that derives from what in Italian is called "Disposizioni semplici", where "n" are the objects and "k" are the elements put together. Final division accounts for couples like Gin-Rum / Rum-Gin.
Where the k! plays the same role as the "2" but with k elements (for k=3 --> k!=3.2=6 --> Gin-Rum-Vodka , Gin-Vodka-Rum, Rum-Gin-Vodka, Rum-Vodka-Gin, Vodka-Rum-Gin, Vodka-Gin-Rum )
actually it's not always the case, some drinks are forbidden to be shaken because the stuff isn't supposed to mix and are floating on top of each other.
so if you have whiskey-cola it will taste different than cola-whiskey because you get the other stuff in your mouth first