GuiStove: Actually kinda make work for holdem
This commit is contained in:
parent
d5430b6bb5
commit
8f9552e778
|
@ -25,13 +25,19 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import Charset
|
import Charset
|
||||||
|
import Stove
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
class GuiStove():
|
class GuiStove():
|
||||||
|
|
||||||
def __init__(self, config, parent, debug=True):
|
def __init__(self, config, parent, debug=True):
|
||||||
"""Constructor for GraphViewer"""
|
"""Constructor for GuiStove"""
|
||||||
|
self.stove = Stove.Stove()
|
||||||
|
self.ev = None
|
||||||
|
self.boardtext = ""
|
||||||
|
self.herorange = ""
|
||||||
|
self.villainrange = ""
|
||||||
self.conf = config
|
self.conf = config
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
||||||
|
@ -140,7 +146,7 @@ class GuiStove():
|
||||||
gamehbox.add(in_frame)
|
gamehbox.add(in_frame)
|
||||||
gamehbox.add(out_frame)
|
gamehbox.add(out_frame)
|
||||||
|
|
||||||
outstring = """
|
self.outstring = """
|
||||||
No board given. Using Monte-Carlo simulation...
|
No board given. Using Monte-Carlo simulation...
|
||||||
Enumerated 2053443 possible plays.
|
Enumerated 2053443 possible plays.
|
||||||
Your hand: (Ad Ac)
|
Your hand: (Ad Ac)
|
||||||
|
@ -156,11 +162,11 @@ Against the range: {
|
||||||
69.91% 15.83% 14.26%
|
69.91% 15.83% 14.26%
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.outputlabel = gtk.Label(outstring)
|
self.outputlabel = gtk.Label(self.outstring)
|
||||||
out_frame.add(self.outputlabel)
|
out_frame.add(self.outputlabel)
|
||||||
|
|
||||||
# Input Frame
|
# Input Frame
|
||||||
table = gtk.Table(4, 4, True)
|
table = gtk.Table(4, 5, True)
|
||||||
label = gtk.Label("Board:")
|
label = gtk.Label("Board:")
|
||||||
board = gtk.Entry()
|
board = gtk.Entry()
|
||||||
board.connect("changed", self.set_board_flop, board)
|
board.connect("changed", self.set_board_flop, board)
|
||||||
|
@ -202,17 +208,36 @@ Against the range: {
|
||||||
table.attach(btn4, 2, 3, 2, 3, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
|
table.attach(btn4, 2, 3, 2, 3, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
|
||||||
table.attach(btn5, 3, 4, 2, 3, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
|
table.attach(btn5, 3, 4, 2, 3, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
|
||||||
|
|
||||||
#table.attach(label, i, i+1, j, j+1,)
|
btn6 = gtk.Button("Results")
|
||||||
|
btn6.connect("pressed", self.update_flop_output_pane, btn6)
|
||||||
|
table.attach(btn6, 0, 1, 3, 4, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
|
||||||
|
|
||||||
in_frame.add(table)
|
in_frame.add(table)
|
||||||
|
|
||||||
def set_board_flop(self, caller, string):
|
def set_output_label(self, string):
|
||||||
print "DEBUG: called set_board_flop: '%s' '%s'" %(caller ,string)
|
self.outputlabel.set_text(string)
|
||||||
|
|
||||||
def set_hero_cards_flop(self, caller, string):
|
def set_board_flop(self, caller, widget):
|
||||||
|
print "DEBUG: called set_board_flop: '%s' '%s'" %(caller ,widget)
|
||||||
|
self.boardtext = widget.get_text()
|
||||||
|
|
||||||
|
def set_hero_cards_flop(self, caller, widget):
|
||||||
print "DEBUG: called set_hero_cards_flop"
|
print "DEBUG: called set_hero_cards_flop"
|
||||||
|
self.herorange = widget.get_text()
|
||||||
|
|
||||||
def set_villain_cards_flop(self, caller, string):
|
def set_villain_cards_flop(self, caller, widget):
|
||||||
print "DEBUG: called set_villain_cards_flop"
|
print "DEBUG: called set_villain_cards_flop"
|
||||||
|
self.villainrange = widget.get_text()
|
||||||
|
|
||||||
|
def update_flop_output_pane(self, caller, widget):
|
||||||
|
print "DEBUG: called update_flop_output_pane"
|
||||||
|
self.stove.set_board_string(self.boardtext)
|
||||||
|
self.stove.set_hero_cards_string(self.herorange)
|
||||||
|
self.stove.set_villain_range_string(self.villainrange)
|
||||||
|
print "DEBUG: odds_for_range"
|
||||||
|
self.ev = Stove.odds_for_range(self.stove)
|
||||||
|
print "DEBUG: set_output_label"
|
||||||
|
self.set_output_label(self.ev.output)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user