Add triangle on last move, to make long-running games easier to keep track of.

This commit is contained in:
Anna Rose 2012-04-14 01:57:20 -04:00
parent 21b5930431
commit 9a78f2918a

View File

@ -23,6 +23,7 @@ class Goban:
self.to_move = Goban.BLACK self.to_move = Goban.BLACK
self.black_captures = 0 self.black_captures = 0
self.white_captures = 0 self.white_captures = 0
self.last_move = None
self.ko = None self.ko = None
self.hover = None self.hover = None
self.elapsed_time = 0 self.elapsed_time = 0
@ -54,6 +55,7 @@ class Goban:
self.board[rpos] = self.to_move self.board[rpos] = self.to_move
self._capture(rpos) self._capture(rpos)
self.last_move = rpos
self.to_move = self._other_color(self.to_move) self.to_move = self._other_color(self.to_move)
self.clear_hover() self.clear_hover()
@ -194,12 +196,16 @@ class Goban:
point = self.board[pos] point = self.board[pos]
if point == Goban.EMPTY: if point == Goban.EMPTY:
s = img_res[self.def_draw_codes[pos]] code = self.def_draw_codes[pos]
elif point == Goban.BLACK: elif point == Goban.BLACK:
s = img_res['b'] code = 'b'
elif point == Goban.WHITE: elif point == Goban.WHITE:
s = img_res['w'] code = 'w'
if pos == self.last_move:
code = code + 'T'
s = img_res[code]
s = pygame.transform.scale(s, (inc, inc)) s = pygame.transform.scale(s, (inc, inc))
ret.blit(s, ((pos % self.board_size) *inc, (pos / self.board_size) *inc)) ret.blit(s, ((pos % self.board_size) *inc, (pos / self.board_size) *inc))