Talk:Solve hanging lantern problem

From Rosetta Code
(Redirected from Talk:Lantern Problem)

Rename Task

The task should be renamed to begin with a verb and leave subsequent words uncapitalized. Perhaps Solve_hanging_lantern_problem? --Markjreed (talk) 21:43, 22 May 2022 (UTC)

Good idea. You can do this as you wish. -- Fzh2003 (talk) 15:38, 23 May 2022 (UTC)

Duplicate Column Sizes

The Julia solution considered two columns with the same number of lanterns indistinguishable, and therefore output a total of only 7 sequences when given 3 columns of 1, 3, and 3 lanterns. Since the problem statement gives an example in which each lantern is individually numbered, I infer that columns with the same number of lanterns should not be interchangeable and 3 columns [1,3,3] should yield 140 distinct sequences. I have edited the Julia solution to match this interpretation, and based a Raku solution on it. But perhaps some more clarity and/or some examples in the problem statement are called for. -- Markjreed (talk) 21:24, 22 May 2022 (UTC)

Ah, that case I did not consider. Fixed by making the numbers in the columns different with duplicate length columns. -- Wherrera (talk) 22:17, 22 May 2022 (UTC)
Hm. My solution was just to use the index of the column instead of its value as the number to repeat ([fill(i,m) for (i, m) in enumerate(inputs)]. Not sure I understand what your new solution is doing instead. -- Markjreed (talk) 22:24, 22 May 2022 (UTC)
I was trying to make it better fit the original specifications, but that did not work at first, sorry. --Wherrera (talk) 23:22, 22 May 2022 (UTC)

Duplicate of Permutations with some identical elements?

I believe this task is essentially equivalent to Permutations with some identical elements. You can see this in the solutions to this task that output "Sequence as column numbers". They basically treat the different columns as different elements 1..n, and the number of lanterns in each column as the repetitions of the same element. And what they are calculating is basically all the distinct ways to permute all those elements (which represents all the distinct orders you can choose column numbers to pick lanterns from). This can easily be translated into "lantern numbers" if desired, because it is always the case that the first lantern picked from a particular column is the bottommost lantern in that column, the second is the second bottommost, etc.

If you take the given example in this task (a column of 1, a column of 2, a column of 3), and translate it to Permutations with some identical elements, with 1 element of A, 2 elements of B, 3 elements of C, you see that you will get 60 results, just like the result here. -- Spoon! (talk) 23:42, 18 June 2022 (UTC)

There are several tasks on RC which are very similar to each other. With more than 1500 (draft) tasks, it can be difficult for a new task author to check whether a similar task has been posted before.
I even created a task myself (Own digits power sum) which later turned out to be a duplicate of Narcissistic decimal number. I hadn't realized this at the time because of the completely different title and I think one could probably say the same about the current task.
If it's realized more or less straightaway that it's a duplicate, then the administrator (Thundergnat) can delete it but once the task is bedded in and there are a lot of solutions it becomes much more difficult for him to do so as the solution authors aren't going to be too happy if they've put a lot of time and thought into their solutions.
Attempting to merging the two tasks is also not usually a good idea because, if the context is different, it tends to mess up the original one.
For these reasons I believe the task should be allowed to stand even though it is arguably a duplicate as you say. --PureFox (talk) 09:55, 19 June 2022 (UTC)
I've added a related link, which should help a bit. --Pete Lomax (talk) 10:12, 19 June 2022 (UTC)
Good idea. I've just done the same for my own 'duplicate'. --PureFox (talk) 10:26, 19 June 2022 (UTC)