diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-03-07 13:09:18 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-03-07 13:09:18 (GMT) |
commit | d5a4e5c5d52f49742078c570f68b4a5a83a801c2 (patch) | |
tree | c2a3b01bb920b6784898054ed913d18e73eb431f /grid.py | |
parent | a7ac7f05a197e26e8a04d3439b15b1024eb303f9 (diff) |
fixed problem with early redeal on robot play; fixed problem with robot card flashing
Diffstat (limited to 'grid.py')
-rw-r--r-- | grid.py | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -66,9 +66,11 @@ class Grid: for i in range(COL): self.hand[i] = deck.deal_next_card() self.place_a_card(self.hand[i], self.hand_to_xy(i)[0], - self.hand_to_xy(i)[1]) + self.hand_to_xy(i)[1]) if self.robot_status: self.robot_hand[i] = deck.deal_next_card() + self.place_a_card(self.robot_hand[i], self.robot_hand_to_xy(i)[0], + self.robot_hand_to_xy(i)[1]) # ...and empty the grid. for i in range(ROW * COL): @@ -79,9 +81,12 @@ class Grid: for i in range(COL): self.hand[i] = deck.deal_next_card() self.place_a_card(self.hand[i], self.hand_to_xy(i)[0], - self.hand_to_xy(i)[1]) + self.hand_to_xy(i)[1]) if self.robot_status: self.robot_hand[i] = deck.deal_next_card() + self.place_a_card(self.robot_hand[i], + self.robot_hand_to_xy(i)[0], + self.robot_hand_to_xy(i)[1]) def find_empty_slot(self): ''' Is there an empty slot in the hand? ''' @@ -139,6 +144,10 @@ class Grid: ''' Convert from hand index to sprite x,y. ''' return ((self.left_hand, (self.top + i * self.yinc))) + def robot_hand_to_xy(self, i): + ''' Convert from hand index to sprite x,y. ''' + return ((-self.xinc, (self.top + i * self.yinc))) + def grid_to_spr(self, i): ''' Return the sprite in grid-position i. ''' return self.grid[i].spr |