Skip to content

Commit

Permalink
Bug fix: Validity check
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaykgupta committed Sep 29, 2016
1 parent 779fca9 commit 93a948f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Game.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ def execute_move(self,move_string):
else:
return 0
elif move_string[0].isdigit():
if self.moves <= 1:
return 0
count = int(move_string[0])
if count <= 0 or count > self.max_movable:
return 0
Expand Down
2 changes: 1 addition & 1 deletion RandomPlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def generate_all_moves(self, player):
if self.moves != player and self.players[player].capstones > 0:
all_moves.append('C' + self.all_squares[i])
for i in xrange(len(self.board)):
if len(self.board[i]) > 0 and self.board[i][-1][0] == player:
if len(self.board[i]) > 0 and self.board[i][-1][0] == player and self.moves != player:
all_moves += self.generate_stack_moves(i)
return all_moves

Expand Down

0 comments on commit 93a948f

Please sign in to comment.