Skip to content

Commit

Permalink
Added somethings that I can't remember and I am not with patience to …
Browse files Browse the repository at this point in the history
…look at the diff :)
  • Loading branch information
hugomaiavieira committed Jul 16, 2010
1 parent 1f5b259 commit eaa84d6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
8 changes: 6 additions & 2 deletions player.py
Expand Up @@ -28,6 +28,10 @@ def draws_card(self, pile):
self.hand.append(card)

def discard(self, card):
self.hand.remove(card)
self.game.discard_pile.append(card)
try:
self.hand.remove(card)
except:
raise CardNotInHandError
else:
self.game.discard_pile.append(card)

6 changes: 5 additions & 1 deletion specs/buraco_spec.py
Expand Up @@ -45,7 +45,11 @@ def it_should_pop_card_from_the_stock(self):
len(self.buraco.stock) |should| equal_to(stock_length - 1)

def it_should_return_the_player_of_the_current_turn(self):
self.hugo.hand = []
self.buraco.current_player() |should| be(self.hugo)
self.hugo.make_shot(STOCK)
# shot
self.hugo.draws_card(STOCK)
self.hugo.discard(self.hugo.hand[0])
# after his move, the turn goes to the next player in the table
self.buraco.current_player() |should| be(self.pedro)

6 changes: 6 additions & 0 deletions specs/player_spec.py
Expand Up @@ -53,5 +53,11 @@ def it_should_discard_the_given_card(self):
self.pedro.hand |should_not| contain(card)
self.game.discard_pile |should| contain(card)

def it_should_not_allow_user_to_discard_a_card_if_he_doesnt_have_it(self):
self.pedro.hand = []
card = Card('J', 'spades')
(lambda: self.pedro.discard(card)) |should| throw(CardNotInHandError)

def after_discarding_the_player_should_notify_the_game_he_is_done(self):
pass

2 changes: 1 addition & 1 deletion stories.md
Expand Up @@ -16,7 +16,7 @@ Buraco
* Se tiver apenas uma carta na mesa, esta não poderá ser a carta descartada

* Descartar:
* Jogar uma carta da sua mão na mesa.
* Jogar uma carta da sua mão na mesa.(OK)

* Fazer jogada:

Expand Down

0 comments on commit eaa84d6

Please sign in to comment.