Stack Remove method bug?
Monkey Programming Forums/Monkey Programming/Stack Remove method bug?
| ||
| I was thinking of 'Remove' as a sort of opposite to the 'Insert' method, which similarly operates on an index value. It's no big deal, I just wondered if Remove should return the removed 'object' or not. I had planned on using it for my stack shuffling method like so:
For Local n:Int = 1 To pack.Length()
Local i:Int = Floor(Rnd(pack.Length()))
Local c:Card = pack.Remove(i)
i = Floor(Rnd(pack.Length()))
pack.Insert(i, c)
Next
But there are other ways:
For Local n:Int = 1 To (pack.Length() * 2)
Local c:Card = pack.Pop()
Local i:Int = Floor(Rnd(pack.Length()))
pack.Insert(i, c)
Next
|







