MCPcopy Create free account
hub / github.com/ActiveState/code / pileOver

Method pileOver

recipes/Python/361168_Vpython_example/recipe-361168.py:89–103  ·  view source on GitHub ↗

Pile a over b Where a and b are block numbers, puts the pile of blocks consisting of block a, and any blocks that are stacked above block a, onto the top of the stack containing block b. The blocks stacked above block a retain their original order when move

(self, a, b)

Source from the content-addressed store, hash-verified

87 ## block.moveTo(b.position)
88
89 def pileOver(self, a, b):
90 """
91 Pile a over b
92
93 Where a and b are block numbers, puts the pile of blocks consisting of
94 block a, and any blocks that are stacked above block a, onto the top of
95 the stack containing block b. The blocks stacked above block a retain
96 their original order when moved.
97 """
98 a, b = self._getBlocks(a, b)
99 if not a: return # Ignore bad indexes
100 # Remove all the blocks on top of a and including onto b's stack
101 blocksToMove = [a] + a.above
102 for bl in blocksToMove:
103 bl.moveTo(b.position)
104
105 def quit(self):
106 """

Callers 1

test1Function · 0.95

Calls 2

_getBlocksMethod · 0.95
moveToMethod · 0.45

Tested by

no test coverage detected