[Tutor] Reversi Game Logic

Dave Angel davea at davea.name
Sat Mar 21 02:23:56 CET 2015


On 03/20/2015 06:20 PM, niyanaxx95 at gmail.com wrote:
>
> Thank you Danny Yoo for replying.
>
> I figured out what to do for the isLegalMove but I ran into another problem. I now get a traceback error every chip is black.
>
> This is the traceback:
>
> Traceback (most recent call last):
>    File "C:\Python34\lib\tkinter\__init__.py", line 1487, in __call__
>      return self.func(*args)
>    File "u:\code\reversiguiapp.py", line 83, in _cbMouseClick
> TypeError: makeMove() takes 2 positional arguments but 3 were given
> Exception in Tkinter callback
>
>
>
>
>
>
>
>    # Performs an actual move in the game. That is the current player places
>    # one of his chips in the square at position (row, col).
>    def makeMove( row, col ):

Don't you need a 'self' parameter to this method, like all the others?

>      if isALineOfAttack(row, col, 1, 1) is True :
>        if self._currentPlayer == 1 :
>          self._gameBoard[row, col] = BLACK
>        else :
>          self._gameBoard[row, col] = WHITE
>
>



-- 
DaveA


More information about the Tutor mailing list