Programmer Bedtime Stories: The Recursed Army

Pisher's Gambit in Python
In the guild of Gonifs, they memorialize the greatest exploits by their greatest members. And because they are considered to be as wily as serpents, they write them down in code, using a language they call Python. Here is the code for Pisher’s exploit.

Just to have some data to work with, we create a set of 10,000 values with random strengths. When we run the “remove_below_average” function on them, if it has to remove any, before it completes, it runs itself again. It is only ever complete when an iteration of it returns a result that meets the condition of not having to remove a soldier.

Try this code at repl.it

© Copyright 2017 – Gregory L. Bulmash. For use/Licensing inquiries, please email info@Yiddish.Ninja

Pages ( 19 of 20 ): « Back1 ... 18 19 20Next »

Leave a Reply

Your email address will not be published. Required fields are marked *

*