Beispiel #1
0
    def tile(self, offset):

        # sanity check
        if (offset < 0 or offset > 31):
            return None

        # return the appropriate number
        return PGTile.with_char(self.deck[offset])
Beispiel #2
0
 def tile( self, offset ):
   
   # sanity check
   if ( offset < 0 or offset > 31 ):
     return None
   
   # return the appropriate number
   return PGTile.with_char( self.deck[offset] )
Beispiel #3
0
 def deal_tiles( self ):
   
   from pgtile import PGTile
   from pgdeal import PGDeal
   
   # We had better be about to deal
   if ( self.game_state != PGGame.ABOUT_TO_DEAL ):
     raise Exception( 'Trying to deal in wrong state!' )
   
   # get a shuffled set of tiles
   tiles = PGTile.get_shuffled_tiles()
   
   # it's a new deal number
   self.current_deal_number += 1
   
   # remember this deal
   deal = PGDeal.create( tiles, self, self.current_deal_number )
   deal.save()
   
   # game is not about to deal anymore
   self.game_state = PGGame.SETTING_TILES
   self.save()
Beispiel #4
0
    def deal_tiles(self):

        from pgtile import PGTile
        from pgdeal import PGDeal

        # We had better be about to deal
        if (self.game_state != PGGame.ABOUT_TO_DEAL):
            raise Exception('Trying to deal in wrong state!')

        # get a shuffled set of tiles
        tiles = PGTile.get_shuffled_tiles()

        # it's a new deal number
        self.current_deal_number += 1

        # remember this deal
        deal = PGDeal.create(tiles, self, self.current_deal_number)
        deal.save()

        # game is not about to deal anymore
        self.game_state = PGGame.SETTING_TILES
        self.save()