avi9526

Untitled

Aug 30th, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. def func1(Pos1, Pos2, Length):
  3.     Delta = Pos2 - Pos1;
  4.     j = Pos2;
  5.     p1 = Pos1;
  6.     p2 = Pos2;
  7.     Step = 0;
  8.     SubStep = 0;
  9.     while (Step < Delta + Length):
  10.         Step = Step + 1;
  11.         SubStep = SubStep + 1;
  12.         print(" %d → Buffer"%j);
  13.         print(" %d → %d"%(p1,j));
  14.         while 1:
  15.             Step = Step + 1;
  16.             if (j + Delta < Pos2 + Length):
  17.                 j = j + Delta;
  18.             else:
  19.                 j = j - Length;
  20.             print(" Buffer ↔ %d"%(j));
  21.             if (j == p1):
  22.                 p1 = p1 + 1;
  23.                 p2 = p2 + 1;
  24.                 j = p2;
  25.                 break;
  26.     return SubStep;
Advertisement
Add Comment
Please, Sign In to add comment