public static void Roll(IStackList <object> stack) { if (stack.HasA <int>()) { var i = stack.Pop <int>(); if (i <= stack.Count) { for (var j = 0; j < i; j++) { var obj = stack.Pop(); stack.Add(obj); } } else { stack.Push(i); } } }