Vesnog
Vesnog

Reputation: 785

Python3 tkinter for game board

I have written a chess code that is text based in Python 3.4.3. I print NumPy array consisting of chess piece identifications to the command line(standard output). However, I would like to designate a GUI for it, is it easy to do so in tkinter? My chessboard output is as follows:

['Rb' '0 ' 'Bb' 'Qb' 'Kb' 'Bb' 'Nb' 'Rb']
['Pb' 'Pb' 'Pb' 'Pb' '0 ' 'Pb' 'Pb' 'Pb']
['0 ' '0 ' 'Nb' '0 ' '0 ' '0 ' '0 ' '0 ']
['0 ' '0 ' '0 ' '0 ' 'Pb' '0 ' '0 ' '0 ']
['0 ' '0 ' '0 ' '0 ' 'Pw' '0 ' '0 ' '0 ']
['0 ' '0 ' '0 ' '0 ' '0 ' 'Qw' '0 ' '0 ']
['Pw' 'Pw' 'Pw' 'Pw' '0 ' 'Pw' 'Pw' 'Pw']
['Rw' 'Nw' 'Bw' '0 ' 'Kw' 'Bw' 'Nw' 'Rw']

Where R:Rook, N:Knight, B:Bishop, Q:Queen, K:King, P:Pawn and the lower case letters denote the corresponding color. I virtually have no experience with designing a GUI and open to try other packages than tkinter?

The code was too long so I pasted all of them on pastebin.com here is the link http://pastebin.com/Lt03PWkN

Upvotes: 0

Views: 844

Answers (1)

CookieM
CookieM

Reputation: 59

I would set it up the chess board and give each little square on the board a value or variable to go along with it like

sq1="empty"

give each square on the board a value like that going up 1

once a pice on the board moves up the appropriate amount than take away the value of the tile and move it to the new tile the piece is on

to figure out what the piece is able to do make a new variable called x and y for each piece add to y and x to figure out what it can do.

so yes it is possible but hard

Upvotes: 1

Related Questions