PowerShell Programming Praxis: Josephus’ Circle

by Jul 30, 2009

And another PowerShell excersise from the WTF (Worse than Failure) contest Programming Praxis: Josephus' Circle . (for more info see original contest post)

Function get-SafeSpot ($count,$Skip) { $q = [Collections.queue](1..$count) while ($q.count -gt 1){ 1..($skip-1) |% {$q.enqueue($q.dequeue())} [void]$q.dequeue() } $q }
By using a Queue (that works on a FIFO (First In First Out) base, I… Read the full text.