Talk:Non-transitive dice

From Rosetta Code
Revision as of 10:11, 8 September 2020 by rosettacode>Paddy3118 (→‎Exclude rotations?: Cache info)

Exclude rotations?

If we have S < T, T < U and yet S > U then it follows we
also have T < U, U < S and yet T > S
as well as U < S, S < T and yet U > T - and that will be every single time, for every set, without fail.
Should we not just keep the one that starts numerically smallest? --Pete Lomax (talk) 23:27, 7 September 2020 (UTC)

As an aside, is it always the case that there is only one solution? Or is that just a coincidence? It would be nice to stop searching permutations early. --Chunes (talk) 00:59, 8 September 2020 (UTC)
It is a coincidence of the 1..4 limit. While I didn't search for them, there are at least two triplets of 6 dice with 1..9 faces, as shown at the end of the Phix output. I have also just added two optimisations: First, when checking a set if any k/k+1 fail then I set [k+2..$] to l ensuring k+1 is incremented next, a 3-fold speedup. Second, I cached the cmpd() results, a 10-fold speedup. So it is now 30 times faster than it was before. --Pete Lomax (talk) 03:05, 8 September 2020 (UTC)
Those are great optimisations, Pete. I'd like to apply them to the Python solution.
On rotations of solutions: I do have somewhere a version with rotations, but I can't remember why I dropped it - I probably flitted over to another "shiny" part of learning about non-transitive dice that caught my attention. The task wording seems to be consistent with the shown results, I think, if not then I'd need to change it.
P.S. I am floored by the maths aspect - reals and then quaternions loosing commutativity in higher dimensions compared to dice with one face/ "ints" and then dice with more faces loosing transitivity?!
--Paddy3118 (talk) 09:52, 8 September 2020 (UTC)
Thanks again, that's a lot of cache hits:
Out[45]: CacheInfo(hits=2148761, misses=1190, maxsize=None, currsize=1190)
--Paddy3118 (talk) 10:11, 8 September 2020 (UTC)