Posted By

Hollgam on 05/26/09


Tagged


Versions (?)

showBoard


 / Published in: Python
 

  1. def showBoard(coord = 0):
  2. """ prints function in console.
  3. coord = TRUE : prints coordinates
  4. coord = FALSE: prints without coordinates
  5. """
  6. print
  7. if not coord:
  8. for i in range(8):
  9. for j in range(8):
  10. if board[i][j] == "em":
  11. print "..",
  12. else:
  13. print board[i][j],
  14. print
  15. else:
  16. coord = ['1','2','3','4','5','6','7','8']
  17. for i in range(8):
  18. print coord[7-i], "|",
  19. for j in range(8):
  20. if board[i][j] == "em":
  21. print "..",
  22. else:
  23. print board[i][j],
  24. print
  25. print " -----------------------"
  26. print " a b c d e f g h"

Report this snippet  

You need to login to post a comment.