Advertisement
Transformator

python005

Oct 21st, 2014
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. def print_field(field):
  5.   print "".join(field[0:8])
  6.   print "".join(field[8:16])
  7.   print "".join(field[16:24])
  8.   print "".join(field[24:32])
  9.   print "".join(field[32:40])
  10.   print "".join(field[40:48])
  11.   print "".join(field[48:56])
  12.   print "".join(field[56:64])
  13.  
  14. field = list("TSLDKLSTBBBBBBBB00000000000000000000000000000000BBBBBBBBTSLKDLST")
  15. fieldnames = []
  16. pos = 0
  17.  
  18. for letter in list("abcdefgh"):
  19.   for number in list("12345678"):
  20.     fieldnames += [str(letter+number), pos]
  21.     pos += 1
  22.  
  23. do = "b4-c6"
  24.  
  25. if "-" in do:
  26.   pos1 = do[0:2]
  27.   pos2 = do[3:5]
  28.   for f in fieldnames:
  29.     if f[0] == pos2:
  30.       if field[f[1]] not "0":
  31.         for f1 in fieldnames:
  32.           if f1[0] == pos1:
  33.             pos1 = f1[1]
  34.         for f2 in fieldnames:
  35.           if f2[0] == pos2:
  36.             pos2 = f2[1]
  37.   field[pos2] = field[pos1]
  38.   field[pos1] = "0"
  39.  
  40. print_field(field)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement