Merge branch 'master' of git://git.assembla.com/fpdboz.git
This commit is contained in:
		
						commit
						3a2a6709b5
					
				
							
								
								
									
										
											BIN
										
									
								
								gfx/Table.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gfx/Table.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 9.3 KiB | 
							
								
								
									
										68
									
								
								pyfpdb/HHReplayer.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								pyfpdb/HHReplayer.py
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,68 @@ | |||
| #!/usr/bin/env python | ||||
| 
 | ||||
| import os, pygame | ||||
| import time | ||||
| from pygame.locals import * | ||||
| from pygame.compat import geterror | ||||
| 
 | ||||
| main_dir = os.path.split(os.path.abspath(__file__))[0] | ||||
| data_dir = os.path.join(main_dir, '.') | ||||
| 
 | ||||
| def load_image(name, colorkey=None): | ||||
|     fullname = os.path.join(data_dir, name) | ||||
|     try: | ||||
|         image = pygame.image.load(fullname) | ||||
|     except pygame.error: | ||||
|         print ('Cannot load image:', fullname) | ||||
|         print "data_dir: '%s' name: '%s'" %( data_dir, name) | ||||
|         raise SystemExit(str(geterror())) | ||||
|     image = image.convert() | ||||
|     if colorkey is not None: | ||||
|         if colorkey is -1: | ||||
|             colorkey = image.get_at((0,0)) | ||||
|         image.set_colorkey(colorkey, RLEACCEL) | ||||
|     return image, image.get_rect() | ||||
| 
 | ||||
| 
 | ||||
| def main(): | ||||
|     #Initialize Everything | ||||
|     pygame.init() | ||||
|     clock = pygame.time.Clock() | ||||
|     screen = pygame.display.set_mode((640, 480)) | ||||
|     table_string = "Tournament 2010090009 Table %s - Blinds $600/$1200 Anto $150" | ||||
|     table_no = 1 | ||||
|     table_title = "Nongoma V - $200/$400 USD - Limit Holdem" | ||||
|     pygame.display.set_caption(table_title) | ||||
|     pygame.mouse.set_visible(0) | ||||
| 
 | ||||
|     # Load background image | ||||
|     bgimage, rect = load_image('../gfx/Table.png') | ||||
|     background = pygame.Surface(screen.get_size()) | ||||
|     background.blit(bgimage, (0, 0)) | ||||
| 
 | ||||
|     #Put Text On The Background, Centered | ||||
|     if pygame.font: | ||||
|         font = pygame.font.Font(None, 24) | ||||
|         text = font.render("FPDB Replayer Table", 1, (10, 10, 10)) | ||||
|         textpos = text.get_rect(centerx=background.get_width()/2) | ||||
|         background.blit(text, textpos) | ||||
| 
 | ||||
|     #Display The Background | ||||
|     screen.blit(background, (0, 0)) | ||||
|     pygame.display.flip() | ||||
| 
 | ||||
|     going = True | ||||
|     while going: | ||||
|         clock.tick(6000) | ||||
|         # Draw  | ||||
|         screen.blit(background, (0, 0)) | ||||
|         # Change table # | ||||
|         #table_no += 1 | ||||
|         #table_title = "Tournament 2010090009 Table %s - Blinds $600/$1200 Anto $150" % table_no | ||||
|         #pygame.display.set_caption(table_title) | ||||
|         time.sleep(10) | ||||
| 
 | ||||
|      | ||||
| if __name__ == '__main__': | ||||
|     main() | ||||
| 
 | ||||
|  | @ -1224,7 +1224,8 @@ class StudHand(Hand): | |||
|             self.addHoleCards('FOURTH',  player, open=[cards[3]], closed=[cards[2]],  shown=shown, mucked=mucked) | ||||
|             self.addHoleCards('FIFTH',   player, open=[cards[4]], closed=cards[2:4], shown=shown, mucked=mucked) | ||||
|             self.addHoleCards('SIXTH',   player, open=[cards[5]], closed=cards[2:5], shown=shown, mucked=mucked) | ||||
|             self.addHoleCards('SEVENTH', player, open=[],         closed=[cards[6]], shown=shown, mucked=mucked) | ||||
|             if len(cards) > 6: | ||||
|                 self.addHoleCards('SEVENTH', player, open=[],         closed=[cards[6]], shown=shown, mucked=mucked) | ||||
| 
 | ||||
| 
 | ||||
|     def addPlayerCards(self, player,  street,  open=[],  closed=[]): | ||||
|  |  | |||
|  | @ -289,6 +289,7 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py. | |||
|             base = gametype['base'] | ||||
|             limit = gametype['limitType'] | ||||
|             l = [type] + [base] + [limit] | ||||
| 
 | ||||
|         if l in self.readSupportedGames(): | ||||
|             if gametype['base'] == 'hold': | ||||
|                 log.debug("hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handtext)") | ||||
|  | @ -299,14 +300,14 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py. | |||
|                 hand = Hand.DrawHand(self.config, self, self.sitename, gametype, handText) | ||||
|         else: | ||||
|             log.info(_("Unsupported game type: %s" % gametype)) | ||||
|             raise FpdbParseError(_("Unsupported game type: %s" % gametype)) | ||||
| 
 | ||||
|         if hand: | ||||
|             #hand.writeHand(self.out_fh) | ||||
|             return hand | ||||
|         else: | ||||
|             log.info(_("Unsupported game type: %s" % gametype)) | ||||
|             log.error(_("Unsupported game type: %s" % gametype)) | ||||
|             # TODO: pity we don't know the HID at this stage. Log the entire hand? | ||||
|             # From the log we can deduce that it is the hand after the one before :) | ||||
| 
 | ||||
| 
 | ||||
|     # These functions are parse actions that may be overridden by the inheriting class | ||||
|  |  | |||
|  | @ -111,7 +111,7 @@ class OnGame(HandHistoryConverter): | |||
|     re_DateTime = re.compile(""" | ||||
|             [a-zA-Z]{3}\s | ||||
|             (?P<M>[a-zA-Z]{3})\s | ||||
|             (?P<D>[0-9]{2})\s | ||||
|             (?P<D>[0-9]+)\s | ||||
|             (?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s | ||||
|             (?P<OFFSET>\w+[-+]\d+)\s | ||||
|             (?P<Y>[0-9]{4}) | ||||
|  | @ -216,15 +216,22 @@ class OnGame(HandHistoryConverter): | |||
|                 #hand.startTime = time.strptime(m.group('DATETIME'), "%a %b %d %H:%M:%S GMT%z %Y") | ||||
|                 # Stupid library doesn't seem to support %z (http://docs.python.org/library/time.html?highlight=strptime#time.strptime) | ||||
|                 # So we need to re-interpret te string to be useful | ||||
|                 m1 = self.re_DateTime.finditer(info[key]) | ||||
|                 for a in m1: | ||||
|                 a = self.re_DateTime.search(info[key]) | ||||
|                 if a: | ||||
|                     datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'),a.group('M'), a.group('D'), a.group('H'),a.group('MIN'),a.group('S')) | ||||
|                     tzoffset = a.group('OFFSET') | ||||
|                     # TODO: Manually adjust time against OFFSET | ||||
|                 else: | ||||
|                     datetimestr = "2010/Jan/01 01:01:01" | ||||
|                     log.error(_("readHandInfo: DATETIME not matched: '%s'" % info[key])) | ||||
|                     print "DEBUG: readHandInfo: DATETIME not matched: '%s'" % info[key] | ||||
|                 # TODO: Manually adjust time against OFFSET | ||||
|                 hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%b/%d %H:%M:%S") # also timezone at end, e.g. " ET" | ||||
|                 hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, tzoffset, "UTC") | ||||
|             if key == 'HID': | ||||
|                 hand.handid = info[key] | ||||
|                 # Need to remove non-alphanumerics for MySQL | ||||
|                 hand.handid = hand.handid.replace('R','') | ||||
|                 hand.handid = hand.handid.replace('-','') | ||||
|             if key == 'TABLE': | ||||
|                 hand.tablename = info[key] | ||||
| 
 | ||||
|  |  | |||
|  | @ -454,6 +454,7 @@ class PokerStars(HandHistoryConverter): | |||
|                 if m.group('SHOWED') == "showed": shown = True | ||||
|                 elif m.group('SHOWED') == "mucked": mucked = True | ||||
| 
 | ||||
|                 #print "DEBUG: hand.addShownCards(%s, %s, %s, %s)" %(cards, m.group('PNAME'), shown, mucked) | ||||
|                 hand.addShownCards(cards=cards, player=m.group('PNAME'), shown=shown, mucked=mucked) | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|  |  | |||
|  | @ -0,0 +1,117 @@ | |||
| PokerStars Game #30506593746:  7 Card Stud Limit ($0.04/$0.08) - 2009/07/16 2:36:31 CET [2009/07/15 20:36:31 ET] | ||||
| Table 'Laomedon' 8-max | ||||
| Seat 1: Player1 ($1.81 in chips)  | ||||
| Seat 2: Player2 ($2.46 in chips)  | ||||
| Seat 3: Player3 ($1.67 in chips)  | ||||
| Seat 4: Player4 ($0.35 in chips)  | ||||
| Seat 5: Player5 ($1.75 in chips)  | ||||
| Seat 6: Player6 ($2.92 in chips)  | ||||
| Seat 7: Player7 ($1.54 in chips)  | ||||
| Seat 8: Player8 ($0.71 in chips)  | ||||
| Player1: posts the ante $0.01 | ||||
| Player2: posts the ante $0.01 | ||||
| Player3: posts the ante $0.01 | ||||
| Player4: posts the ante $0.01 | ||||
| Player5: posts the ante $0.01 | ||||
| Player6: posts the ante $0.01 | ||||
| Player7: posts the ante $0.01 | ||||
| Player8: posts the ante $0.01 | ||||
| *** 3rd STREET *** | ||||
| Dealt to Player1 [Ac Kc 8c] | ||||
| Dealt to Player2 [Tc] | ||||
| Dealt to Player3 [6c] | ||||
| Dealt to Player4 [Js] | ||||
| Dealt to Player5 [Jd] | ||||
| Dealt to Player6 [2d] | ||||
| Dealt to Player7 [Jh] | ||||
| Dealt to Player8 [Kh] | ||||
| Player6: brings in for $0.02 | ||||
| Player7: calls $0.02 | ||||
| Player8: calls $0.02 | ||||
| Player1: calls $0.02 | ||||
| Player2: calls $0.02 | ||||
| Player3: calls $0.02 | ||||
| Player4: calls $0.02 | ||||
| Player5: calls $0.02 | ||||
| *** 4th STREET *** | ||||
| Dealt to Player1 [Ac Kc 8c] [9c] | ||||
| Dealt to Player2 [Tc] [7d] | ||||
| Dealt to Player3 [6c] [7h] | ||||
| Dealt to Player4 [Js] [2c] | ||||
| Dealt to Player5 [Jd] [4h] | ||||
| Dealt to Player6 [2d] [7c] | ||||
| Dealt to Player7 [Jh] [4c] | ||||
| Dealt to Player8 [Kh] [3d] | ||||
| Player8: checks  | ||||
| Player1: checks  | ||||
| Player2: checks  | ||||
| Player3: checks  | ||||
| Player4: checks  | ||||
| Player5: checks  | ||||
| Player6: checks  | ||||
| Player7: checks  | ||||
| *** 5th STREET *** | ||||
| Dealt to Player1 [Ac Kc 8c 9c] [9d] | ||||
| Dealt to Player2 [Tc 7d] [8d] | ||||
| Dealt to Player3 [6c 7h] [3s] | ||||
| Dealt to Player4 [Js 2c] [9s] | ||||
| Dealt to Player5 [Jd 4h] [9h] | ||||
| Dealt to Player6 [2d 7c] [6d] | ||||
| Dealt to Player7 [Jh 4c] [5d] | ||||
| Dealt to Player8 [Kh 3d] [8s] | ||||
| Player1: checks  | ||||
| Player2: checks  | ||||
| Player3: checks  | ||||
| Player4: checks  | ||||
| Player5: checks  | ||||
| Player6: checks  | ||||
| Player7: checks  | ||||
| Player8: checks  | ||||
| *** 6th STREET *** | ||||
| Dealt to Player1 [Ac Kc 8c 9c 9d] [Th] | ||||
| Dealt to Player2 [Tc 7d 8d] [3c] | ||||
| Dealt to Player3 [6c 7h 3s] [Qh] | ||||
| Dealt to Player4 [Js 2c 9s] [8h] | ||||
| Dealt to Player5 [Jd 4h 9h] [2s] | ||||
| Dealt to Player6 [2d 7c 6d] [5h] | ||||
| Dealt to Player7 [Jh 4c 5d] [Td] | ||||
| Dealt to Player8 [Kh 3d 8s] [6s] | ||||
| Player1: checks  | ||||
| Player2: checks  | ||||
| Player3: checks  | ||||
| Player4: checks  | ||||
| Player5: checks  | ||||
| Player6: checks  | ||||
| Player7: checks  | ||||
| Player8: checks  | ||||
| *** RIVER *** [6h] | ||||
| Player1: checks  | ||||
| Player2: checks  | ||||
| Player3: bets $0.08 | ||||
| Player4: folds  | ||||
| Player5: calls $0.08 | ||||
| Player6: calls $0.08 | ||||
| Player7: folds  | ||||
| Player8: calls $0.08 | ||||
| Player1: folds  | ||||
| Player2: folds  | ||||
| *** SHOW DOWN *** | ||||
| Player3: shows [7s Qs 6c 7h 3s Qh] (two pair, Queens and Sevens) | ||||
| Player5: mucks hand  | ||||
| Player6: mucks hand  | ||||
| Player8: mucks hand  | ||||
| Player3 collected $0.54 from pot | ||||
| *** SUMMARY *** | ||||
| Total pot $0.56 | Rake $0.02  | ||||
| Board [6h] | ||||
| Seat 1: Player1 folded on the River | ||||
| Seat 2: Player2 folded on the River | ||||
| Seat 3: Player3 showed [7s Qs 6c 7h 3s Qh] and won ($0.54) with two pair, Queens and Sevens | ||||
| Seat 4: Player4 folded on the River | ||||
| Seat 5: Player5 mucked [Kd Ks Jd 4h 9h 2s] | ||||
| Seat 6: Player6 mucked [5s Ah 2d 7c 6d 5h] | ||||
| Seat 7: Player7 folded on the River | ||||
| Seat 8: Player8 mucked [Jc 3h Kh 3d 8s 6s] | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user