示例#1
0
 def create_with_tile_names(cls, tile_names):
     return PGSet.create([
         PGTile.with_name(tile_names[0]),
         PGTile.with_name(tile_names[1]),
         PGTile.with_name(tile_names[2]),
         PGTile.with_name(tile_names[3])
     ])
示例#2
0
 def create_with_tile_chars(cls, tile_chars):
     return PGSet.create([
         PGTile.with_char(tile_chars[0]),
         PGTile.with_char(tile_chars[1]),
         PGTile.with_char(tile_chars[2]),
         PGTile.with_char(tile_chars[3])
     ])
示例#3
0
 def test_num_tiles(self):
     set = PGSet.create([
         PGTile.with_name("teen", True),
         PGTile.with_name("day", True),
         PGTile.with_name("high ten", True),
         PGTile.with_name("eleven", True)
     ])
     self.assertIsNotNone(set)
示例#4
0
 def test_tile_ranking( self ):
   '''Test that the tile ranking is correctly parsed on creation'''
   gee_joon = PGTile.with_name( "gee joon" )
   low_four = PGTile.with_name( "low four" )
   hand1 = PGHand.create( gee_joon, low_four )
   self.assertEqual( hand1.low_tile, gee_joon )
   self.assertEqual( hand1.high_tile, low_four )
   hand2 = PGHand.create( low_four, gee_joon )
   self.assertEqual( hand2.low_tile, gee_joon )
   self.assertEqual( hand2.high_tile, low_four )
示例#5
0
 def test_comparison2( self ):
   hand11 = PGHand.create( PGTile.with_name( "day", True ),
                           PGTile.with_name( "mixed nine", True ) )
   hand12 = PGHand.create( PGTile.with_name( "teen", True ),
                           PGTile.with_name( "mixed seven", True ) )
   hand21 = PGHand.create( PGTile.with_name( "low four", True ),
                           PGTile.with_name( "mixed five", True ) )
   hand22 = PGHand.create( PGTile.with_name( "long six", True ),
                           PGTile.with_name( "low ten", True ) ) 
   self.assertTrue( hand11.beats( hand21 ) )
   self.assertTrue( hand21.is_beaten_by( hand11 ) )
   self.assertTrue( hand12.beats( hand22 ) )
   self.assertTrue( hand22.is_beaten_by( hand12 ) )
示例#6
0
 def test_comparison( self ):
   gee_joon = PGTile.with_name( "gee joon" )
   low_four = PGTile.with_name( "low four" )
   teen = PGTile.with_name( "teen" )
   mixed_five = PGTile.with_name( "mixed five" )
   day = PGTile.with_name( "day" )
   hand1 = PGHand.create( gee_joon, low_four )
   hand2 = PGHand.create( teen, mixed_five )
   hand3 = PGHand.create( day, mixed_five )
   hand4 = PGHand.create( teen, day )
   self.assertTrue( hand2.beats(hand1) )
   self.assertFalse( hand2.copies(hand1) )
   self.assertFalse( hand2.is_beaten_by(hand1) )
   self.assertTrue( hand2.beats(hand3) )
   self.assertTrue( hand2.beats(hand4) )
   mixed_seven = PGTile.with_name( "mixed seven" )
   hand1 = PGHand.create( teen, mixed_five )
   hand2 = PGHand.create( teen, mixed_seven )
   self.assertTrue( hand2.beats(hand1) )
   self.assertTrue( hand1.is_beaten_by(hand2) )
示例#7
0
 def test_name( self ):
   teen1 = PGTile.with_name( "teen", True )
   teen2 = PGTile.with_name( "teen", False )
   hand1 = PGHand.create( teen1, teen2 )
   self.assertEqual( hand1.label(), "teen bo" )
示例#8
0
 def create_with_tile_names( cls, tile1_name, tile2_name ):
   return PGHand.create( PGTile.with_name( tile1_name ), PGTile.with_name( tile2_name ) )
示例#9
0
 def create_with_tile_chars( cls, tile1_char, tile2_char ):
   return PGHand.create( PGTile.with_char( tile1_char ), PGTile.with_char( tile2_char ) )
示例#10
0
 def test_num_tiles( self ):
   set = PGSet.create( [ PGTile.with_name( "teen", True ),
                         PGTile.with_name( "day", True ),
                         PGTile.with_name( "high ten", True ),
                         PGTile.with_name( "eleven", True ) ] )
   self.assertIsNotNone( set )
示例#11
0
 def create_with_tile_names( cls, tile_names ):
   return PGSet.create( [
                   PGTile.with_name(tile_names[0]),
                   PGTile.with_name(tile_names[1]),
                   PGTile.with_name(tile_names[2]),
                   PGTile.with_name(tile_names[3]) ] )
示例#12
0
 def create_with_tile_chars( cls, tile_chars ):
   return PGSet.create( [ 
                   PGTile.with_char(tile_chars[0]),
                   PGTile.with_char(tile_chars[1]),
                   PGTile.with_char(tile_chars[2]),
                   PGTile.with_char(tile_chars[3]) ] )