X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fscripts%2Ffen2ascii.py;h=74087440e20ed8890bca120435c9fe23b8279086;hb=642b4acca1900c55662030ffc5162e9504881764;hp=473515ccc7b68551a5b7d0c0a368c35d8b0f27e7;hpb=f9de88c53cfa0e11da1b48337606ccb25d8549bf;p=lyx.git diff --git a/lib/scripts/fen2ascii.py b/lib/scripts/fen2ascii.py index 473515ccc7..74087440e2 100644 --- a/lib/scripts/fen2ascii.py +++ b/lib/scripts/fen2ascii.py @@ -9,6 +9,7 @@ # This script will convert a chess position in the FEN # format to an ascii representation of the position. +from __future__ import print_function import sys,string,os os.close(0) @@ -26,24 +27,23 @@ comp=string.split(line,'/') cont=1 margin= " "*6 -print margin+' +'+"-"*15+'+' +print (margin+' +'+"-"*15+'+') for i in range(8): - cont = cont + 1 tmp="" for j in comp[i]: - if j>='0' and j <= '9': - for k in range(int(j)): - cont = cont + 1 - x, mod = divmod(cont,2) - if mod : tmp = tmp + '| ' - else : tmp = tmp + '|*' - else : - tmp = tmp + '|' + j - cont = cont + 1 + if j>='0' and j <= '9': + for k in range(int(j)): + cont = cont + 1 + x, mod = divmod(cont,2) + if mod : tmp = tmp + '| ' + else : tmp = tmp + '|*' + else : + tmp = tmp + '|' + j + cont = cont + 1 row = 8 - i - print margin, row, tmp+"|" + print (margin, row, tmp+"|") -print margin+' +'+"-"*15+'+' -print margin+' a b c d e f g h ' +print (margin+' +'+"-"*15+'+') +print (margin+' a b c d e f g h ')