Need a unique gift idea?
A Pastebin account makes a great Christmas gift


a guest Dec 7th, 2017 322 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. #----------------------SPACE WASTING SNAKE------------------------------------------
  2. ###infinite snake in n-dim room which includes all existing vectors
  3. ###in an enumerable-infinity-order, useful for autoproving n-dimensional expressions
  4. ###by Patrick Hammer. Email:
  5. def existing_vectors_positive(dim, upper_limit=-1): #can be infinite too
  6.     r=1; inv=1; rev=false; step=0
  7.     while upper_limit==-1 or step<upper_limit:
  8.         V=[0 for x in range(dim)]; V[0]=r
  9.         for x in range(1,len(V)):
  10.             Break=false
  11.             for y in range(r):
  12.                 W=list(reversed(V)) if rev else V
  13.                 yield W; V[x]+=1*inv
  14.         inv=inv*(-1);
  15.         for x in range(0,len(V)):
  16.             Break=false
  17.             for y in range(r+1):
  18.                 W=list(reversed(V)) if rev else V
  19.                 yield W; V[x]+=1*inv
  20.                 if(V[x]==0): Break=true
  21.             if Break: break
  22.         r=r+1; inv=inv*(-1); step+=1; rev=not rev
  23. #------------------------------------------------------------------------------------
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand