Finding a number from list QUIZ

Hello All,

I have a small question/quiz for you which is as follows,

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.

Kindly give me a solution using gh components or python or both. I tried hoopsnake for loop but there is small problem in the quiz because the numbers are in circles so cant remove alternate alone.

Here are two solutions found through a Google search leading to here: (7.4 KB)


Thank you very much for the python code…is there a way to solve using gh components?

Probably not using vanilla components, since the problem appears to require an iterative logic/algorithm/solution (or at least it lends itself well to it). You’d probably be jumping through hoops to solve it using a declarative logic I imagine (i.e. using Anemone, Hoopsnake etc).

1 Like