Looking at the code one option you have is to manually time-slice your script. Since this is a suspends function you could try sleeping inside the for
loop after N iterations.
For example:
for (I->Piece : Board.Pieces):
# do some computation
# If index I perfectly divides by 100 sleep for a frame
if (Mod[I, 100] = 0):
Sleep(0.0)