100 people standing in a circle in an order 1 to 100. No. 1 has a sword. He kills the next person (i.e. No. 2) and gives the sword to the next (i.e. No. 3). All people do the same until only 1 survives. Which number survives at the last? There are 100 people starting from 1 to 100.
can anyone please tell me how can i do it?
Discussion posts and replies are publicly visible
Here is the solution to your challenge. We have also added a feather so that the user may choose the number of players and who should start the game.
reduce( rule!EI_subEliminateTask(list: _, value: _), { ldrop( enumerate(ri!players) + 1, ri!startPlayer - 1 ), if( ri!startPlayer = 1, {}, enumerate(ri!startPlayer - 1) + 1 ) }, repeat(ri!players - 1, 0) ) subrule: rule!EI_subEliminateTask(list: _, value: _), code: { ldrop(ri!list, 2), ri!list[1] }