copy code from listener to repaint function
delete code about makeMove from listener