#NEWLINE# def move( self , d , add_tile = True ) : #NEWLINE# #INDENT# '\n        move and return the move score\n        ' #NEWLINE# if ( ( d == Board . LEFT ) or ( d == Board . RIGHT ) ) : #NEWLINE# #INDENT# ( chg , get ) = ( self . setLine , self . getLine ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( d == Board . UP ) or ( d == Board . DOWN ) ) : #NEWLINE# #INDENT# ( chg , get ) = ( self . setCol , self . getCol ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# #UNINDENT# moved = False #NEWLINE# score = 0 #NEWLINE# for i in self . __size_range : #NEWLINE# #INDENT# origin = get ( i ) #NEWLINE# line = self . __moveLineOrCol ( origin , d ) #NEWLINE# ( collapsed , pts ) = self . __collapseLineOrCol ( line , d ) #NEWLINE# new = self . __moveLineOrCol ( collapsed , d ) #NEWLINE# chg ( i , new ) #NEWLINE# if ( origin != new ) : #NEWLINE# #INDENT# moved = True #NEWLINE# #UNINDENT# score += pts #NEWLINE# #UNINDENT# if ( moved and add_tile ) : #NEWLINE# #INDENT# self . addTile ( ) #NEWLINE# #UNINDENT# return score