First you have to split your function in two functions.
One for creation the board, the second for displaying.
or you do it with classes (this is the better and easier way).
You could study this games:
http://inventwithpython.com/chapter10.html
http://www.practicepython.org/exercise/2...-game.html
One for creation the board, the second for displaying.
import pprint doska = [ ] def create_sachovnica(n): global doska doska=[[' 'for i in range(n) ] for j in range(n)] npul=n//2 for i in range(n): doska[npul-1][i]='*';doska[npul+1][i]='*' doska[i][npul-1]='*';doska[i][npul+1]='*' doska[npul][0]='*';doska[npul][n-1]='*' doska[0][npul]='*';doska[n-1][npul]='*' for i in range(1,npul): doska[npul][i]="D";doska[npul][n-i-1]="D" doska[i][npul]="D";doska[n-i-1][npul]="D" doska[npul][npul]="X" doska[n-1][npul-1]='A' def print_sachovnica(n): for n in doska: print (' '.join(n)) print() # main create_sachovnica(9) print_sachovnica(9)Either you work a lot with global variables for board, positions for 4 players, ...
or you do it with classes (this is the better and easier way).
You could study this games:
http://inventwithpython.com/chapter10.html
http://www.practicepython.org/exercise/2...-game.html