Open Side Menu Go to the Top
Register
Will Tipton Video Pack 2 - Solving Poker Will Tipton Video Pack 2 - Solving Poker

07-25-2014 , 11:55 AM
If i make a lot of possible Turns cards possible (lets say all of them) in the decision tree do i have to make some card removal effects when i define ranges on the flop?
Will Tipton Video Pack 2 - Solving Poker Quote
07-25-2014 , 07:37 PM
Quote:
Originally Posted by minotaurs
If i make a lot of possible Turns cards possible (lets say all of them) in the decision tree do i have to make some card removal effects when i define ranges on the flop?
Yes, because card removal effects on the range of a player on some street result from the board cards on that street as well as the opponent player's range on that street. Future streets only are relevant inasmuch as stipulated restrictions on the frequencies of future cards affect overall strategies and hence the opponent's range on the current street (as was the case with the T tree).
Will Tipton Video Pack 2 - Solving Poker Quote
07-26-2014 , 01:11 AM
I've implemented a work-around to my memory problem (I am unable to load back big objects saved with pickle). Rather than save and load whole StrategyPair objects, I've added the two following methods to the class in order to save and retrieve only the real meat of a solution -- that is, the range arrays:

Code:
# Input: fileName - name of the file, excluding the extension (.npz).
def saveRanges(self, fileName):
    np.savez(fileName, *[self.ranges[i].r for i in range(self.size)])
    
# Input: fileName - name of the file, excluding the extension (.npz).
def loadRanges(self, fileName):
    npzTmpFile = np.load(fileName+'.npz')
    for i in range(self.size):
        self.ranges[i].r = npzTmpFile['arr_'+str(i)]
The saved files only are about 640KB in size, compared to 675MB for pickled StrategyPair objects!

This works well with my modified doFP() function. I can now run X iterations, save the ranges to a file, close the Notebook, and at a later time load back the ranges in a StrategyPair object (defined on the same tree) and go on iterating from X+1.

Last edited by Sevendeuceo; 07-26-2014 at 01:19 AM.
Will Tipton Video Pack 2 - Solving Poker Quote
07-26-2014 , 06:25 AM
Quote:
Originally Posted by Sevendeuceo
Code:
np.savez(fileName, *[self.ranges[i].r for i in range(self.size)])
This part of code cant be corrent can it?
Will Tipton Video Pack 2 - Solving Poker Quote
07-26-2014 , 11:04 AM
Quote:
Originally Posted by minotaurs
This part of code cant be corrent can it?
Yes, and it works.

See the first answer to the question asked here:

How-to-use-numpy-savez-in-a-loop-for-saving-more-than-one-array
Will Tipton Video Pack 2 - Solving Poker Quote
07-26-2014 , 03:18 PM
Quote:
Originally Posted by Sevendeuceo
Yes, and it works.

See the first answer to the question asked here:

How-to-use-numpy-savez-in-a-loop-for-saving-more-than-one-array
Ohh cool. It was just looking strange
Will Tipton Video Pack 2 - Solving Poker Quote
07-28-2014 , 10:46 AM
Just purchased the pack and I'm super excited! Lets solve the game of pokers!

Edit: Not incredibly impressed by the download speed though. How about you put it on googles main server?
Will Tipton Video Pack 2 - Solving Poker Quote
07-29-2014 , 12:10 PM
Hi,

I'm having a similar problem as minotaurs had, with displaying a gametree.

Made my own tree for flop-play analysis and I get this error when I run the cell: <__main__.Tree instance at 0x08F01C88>

I'm a complete newbie with programing so please forgive me if I can't provide the relevant info but let me try.

-I have checked that "_repr_png_" and "_repr_svg_" are spelled correctly in the code.
-I ran the gametree we made for the two possible river cards scenario and it displays fine, no errors. Since my new tree is basically a copy of the tree in the video(though a bit more complicated) I'm thinking that a typing error while I made the tree, or the format of my tree, is more likly than an error in the previous code?!

My tree looks like this:
Quote:
S = 20.25

flopEArray = EquityArray(pe.string2card(['Ah','Kd','Qs','__','__'])); # replace first 3 cards with chosen flop
turnEArray = EquityArray(pe.string2card(['Ah','Kd','Qs','__','__'])); # replace first 3 cards with chosen flop
riverEArray = EquityArray(pe.string2card(['Ah','Kd','Qs','__','__'])); # replace first 3 cards with chosen flop

point0 = DecPt('BB', 2.25, 2.25, flopEArray, "")
point1 = DecPt('SB', 2.25, 2.25, flopEArray, "check")
point2 = DecPt('Nature', 2.25, 2.25, flopEArray, "check")
point3 = DecPt('BB', 2.25, 2.25, turnEArray, "TurnCard")
point4 = DecPt('SB', 2.25, 2.25, turnEArray, "check")
....then a bunch more treepoints....then
Quote:
point269 = DecPt('Leaf', 20.25, 20.25, flopEArray, "call")


T = Tree(S, point0)
T.addDecPt(point1, point0)
T.addDecPt(point2, point1)
T.addDecPt(point3, point2)
T.addDecPt(point4, point3)
......
Quote:
T.addDecPt(point269, point267)

T
And that's basically the whole cell.

Any ideas?
Will Tipton Video Pack 2 - Solving Poker Quote
07-29-2014 , 05:08 PM
Hey guys,

I get following error: index out of range. This results from the setToTop function. I have been looking through the full code but i can't find where i runs out.

any advice on how to solve this? how should i post code in this topic?

thanks a lot!

[34]:

bob = Range()
bob.setToTop(0.2, board)
display(bob)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-34-ea78bf5c2d36> in <module>()
1 bob = Range()
----> 2 bob.setToTop(0.2, board)
3 display(bob)

<ipython-input-24-f9c1fd3ff2b2> in setToTop(self, fraction, board)
177 self.setAllFracs(0)
178 for i in range(int(fraction * scipy.misc.comb(numCardsLeft, 2))):
--> 179 self.setFrac(handsSorted[i][0],1.0)
180

IndexError: list index out of range
Will Tipton Video Pack 2 - Solving Poker Quote
07-29-2014 , 08:38 PM
@NC82
Not sure if this helps but
Quote:
bob = Range()
bob.setToTop(0.2, board)
display(bob)
in my code it looks like this
Quote:
print(pe.card2string(hand))
bob = Range()
bob.setRangeString( "AK,44,QJs", 1.0)
display(bob)
Will Tipton Video Pack 2 - Solving Poker Quote
07-30-2014 , 03:38 AM
Quote:
Originally Posted by jesjesjo
Hi,

I'm having a similar problem as minotaurs had, with displaying a gametree.

Made my own tree for flop-play analysis and I get this error when I run the cell: <__main__.Tree instance at 0x08F01C88>

I'm a complete newbie with programing so please forgive me if I can't provide the relevant info but let me try.

-I have checked that "_repr_png_" and "_repr_svg_" are spelled correctly in the code.
-I ran the gametree we made for the two possible river cards scenario and it displays fine, no errors. Since my new tree is basically a copy of the tree in the video(though a bit more complicated) I'm thinking that a typing error while I made the tree, or the format of my tree, is more likly than an error in the previous code?!

My tree looks like this:

....then a bunch more treepoints....then

......

And that's basically the whole cell.

Any ideas?
Check if all the spacings are right in this functon -- def _repr_png_(self):
As you saw before my problem was there
Will Tipton Video Pack 2 - Solving Poker Quote
07-30-2014 , 10:20 AM
Hi, I finished the video pack and my program seems to be working without any problems. Now I want to do a calculation for GTO play in a realgame situation - specifically play on a turn, where all 48 possible boardrunouts are included in the game tree.

Is it possible to do this with the program we have on a laptop? I was thinking I'd have to write a function to help generate the game tree, and I think I could do that with some work, but even assuming I can get it to do that, will there be other problems I haven't thought of popping up?
Will Tipton Video Pack 2 - Solving Poker Quote
07-30-2014 , 04:15 PM
if i make really big tree do i really have to do any "remove hands with conflicts"?
For example i make big tree where decision point 0 is preflop. Than i have like 100's of flops, even more turns and milion rivers.
Will Tipton Video Pack 2 - Solving Poker Quote
07-31-2014 , 01:10 PM
Quote:
Originally Posted by minotaurs
Check if all the spacings are right in this functon -- def _repr_png_(self):
As you saw before my problem was there
IDK in which video we made that function so can't compare it to that, I don't think I made mistakes

Made a screenshot of the 2 functions since the forum seems to ignore spaces at the beginning of a line
http://i.imgur.com/DmRJZlG.png

Does it look different than yours?
Will Tipton Video Pack 2 - Solving Poker Quote
07-31-2014 , 03:02 PM
Quote:
Originally Posted by jesjesjo
the forum seems to ignore spaces at the beginning of a line
use [code][/code] tags in your post to preserve formatting.

Like this:

Code:
asdf
  qwerty
    zxcvbn
Will Tipton Video Pack 2 - Solving Poker Quote
07-31-2014 , 05:45 PM
Quote:
Originally Posted by jesjesjo
@NC82
Not sure if this helps but

in my code it looks like this
thank you for the help but that code works fine for me.
It is really the setToTop() function that doesn't work. I do get an index error. so
i'm running somewhere out of range and i don't know how to solve this.

Can somebody please help me out with this? I have spent more then one day on solving this problem and I have no clue how to get it done anymore...

thanks a lot

This is my function

Code:
  def setToTop(self, fraction, board):
        rangeAllHands = Range()
        rangeAllHands.setAllFracs(1.0)  #ATC range
        handsSorted = self.getHandsSortedAndEquities(rangeAllHands, board)
        
        numCardsLeft = numCards
        for c in board:
            if c < numCards:
                numCardsLeft -= 1
        
        self.setAllFracs(0)
        for i in range(int(fraction * scipy.misc.comb(numCardsLeft, 2))):
            self.setFrac(handsSorted[i][0],1.0)
this is the error:

Code:
IndexError                                Traceback (most recent call last)
<ipython-input-29-070bff305ad8> in <module>()
      1 bob = Range()
      2 bob.setAllFracs(1.0)
----> 3 bob.setToTop(0.20, board)
      4 display(bob)

<ipython-input-25-fc78bc9a7697> in setToTop(self, fraction, board)
    178         self.setAllFracs(0)
    179         for i in range(int(fraction * scipy.misc.comb(numCardsLeft, 2))):
--> 180             self.setFrac(handsSorted[i][0],1.0)
    181 

IndexError: list index out of range
Pms are welcome!

tnx guys
Will Tipton Video Pack 2 - Solving Poker Quote
08-01-2014 , 03:59 AM
Hello,

When I run the
Code:
DoShoveFoldGame()
function, the following SB/BB ranges appear and stay the same for the 5 iterations:



Just to make sure, here's my code again:
Code:
# Solving the shove/fold:
# SB can either shove or fold at his first decision 
# SB's strategy is defined by his jamming range, and the BB's by his calling range

# Fictitious play 

# Input: N/A
# Output: N/A
# Side-effects: display SB shoving range and the BB calling range
def doShoveFoldGame():
    nIter = 5   # number of iterations
    S = 10   # stack size in BBs
    ea = EquityArray(pe.string2card(['__','__','__','__','__']))
    
    # guess some initial ranges
    sbJamRange = Range()
    sbJamRange.setAllFracs(0.5)
    bbCallRange = Range()
    bbCallRange.setAllFracs(0.5)
    
    for n in range(nIter):
        # solve for the SB max expl strat
        bestSBJamRange = Range()
        for i in range(numCards):
            for j in range(i+1, numCards):
                hand = [i,j]
                bb_call_freq = bbCallRange.getNumHandsWithoutConflicts(hand) / numVillainHands
                equity = getEquityVsRange(hand, bbCallRange, ea)
                evJam = (1 - bb_call_freq) * (S+1) + (bb_call_freq) * equity * 2*S
                evFold = S - 0.5
                if(evJam > evFold):
                    bestSBJamRange.setFrac(hand, 1)
                else:
                    bestSBJamRange.setFrac(hand, 0)
                    
        # update SB strategy
        updateRange(sbJamRange, bestSBJamRange, n)
        
        
        # solve for the BB max expl strat
        bestBBCallRange = Range()
        for i in range(numCards):
            for j in range(i+1, numCards):
                hand = [i,j]
                equity = getEquityVsRange(hand, sbJamRange, ea)
                evCall = 2 * S * equity
                evFold = S - 1
                if (evCall > evFold):
                    bestBBCallRange.setFrac(hand, 1)
                else:
                    bestBBCallRange.setFrac(hand, 0)
        # update SB strategy
        updateRange(sbJamRange, bestBBCallRange, n)
                    
        display(sbJamRange)
        display(bbCallRange)
                
    display(sbJamRange)
    display(bbCallRange)
I went over the code a couple times to check for typos but didn't find any. Thanks for advice in advance!
Will Tipton Video Pack 2 - Solving Poker Quote
08-01-2014 , 05:10 AM
Knut it looks like you've got a typo here:

# update SB strategy
updateRange(sbJamRange, bestBBCallRange, n)

that should be:

# update BB strategy
updateRange(bbCallRange, bestBBCallRange, n)

hopefully that fixes it.
Will Tipton Video Pack 2 - Solving Poker Quote
08-01-2014 , 03:02 PM
Made it to the end of the series, but my soln2.dump() to the two street 'T' game gets off to a weird start:

In my (wrong) solution:

At Decision Point 1 (after BB checks) BB has checked zero% of his range
At Decision Point 15 (after BB bets) BB has bet 100% of his range

I checked the result of display(bbStartingRange) and this is definitely correct.

So something is going wrong with the way that BB initially divides his range between checking and betting. I'd be grateful if someone could point to a place in the code where I can solve this. Thanks!
Will Tipton Video Pack 2 - Solving Poker Quote
08-01-2014 , 03:08 PM
I'm getting to solve my setToTop error. however not completely. I'm breaking down the process and apparently i only sort hands up to 46 rather than the full range of possibilities. if i set fraction to 0.20 handsSorted[i] will result iinto handsSorted[265] however handsSorted only contains 47 elements... can somebody help me with this?

Code:
In [79]:

bob = Range()
bob.setAllFracs(1.0)
handsSorted= bob.getHandsSortedAndEquities(bob, board)
display(bob)
print handsSorted
test = int(0.2 * scipy.misc.comb(52, 2))
print test
jdoe = bob.setFrac(handsSorted[46][0],1.0)
print jdoe
print size(handsSorted)

[([0, 11], 0.82426438296003313), ([0, 37], 0.82426438296003213), ([0, 50], 0.82426438296003213), ([0, 6], 0.69224857268335438), ([0, 32], 0.69224857268335427), ([0, 45], 0.69224857268335427), ([0, 17], 0.60314009661835788), ([0, 4], 0.60160298638559584), ([0, 30], 0.60160298638559584), ([0, 14], 0.49883618796662665), ([0, 27], 0.49728809837505888), ([0, 40], 0.49728809837505888), ([0, 13], 0.43432147562582601), ([0, 26], 0.4318181818181851), ([0, 39], 0.4318181818181851), ([0, 25], 0.38315766359244535), ([0, 38], 0.38175230566534812), ([0, 51], 0.38175230566534812), ([0, 12], 0.38175230566534801), ([0, 23], 0.30026350461132972), ([0, 10], 0.29885814668423255), ([0, 36], 0.2988581466842325), ([0, 49], 0.2988581466842325), ([0, 22], 0.23458498023715291), ([0, 35], 0.23317962231005585), ([0, 48], 0.23317962231005585), ([0, 9], 0.23317962231005582), ([0, 21], 0.18309178743961174), ([0, 34], 0.18170838823012578), ([0, 47], 0.18170838823012578), ([0, 8], 0.18170838823012575), ([0, 16], 0.16024374176548112), ([0, 29], 0.15905797101449276), ([0, 42], 0.15905797101449276), ([0, 3], 0.15905797101449273), ([0, 15], 0.14715634606938982), ([0, 2], 0.14601449275362333), ([0, 28], 0.14601449275362327), ([0, 41], 0.14601449275362322), ([0, 20], 0.14216073781291019), ([0, 7], 0.14081027667984075), ([0, 46], 0.14081027667984064), ([0, 33], 0.14081027667984061), ([0, 18], 0.10540184453227885), ([0, 5], 0.10410628019323646), ([0, 31], 0.10410628019323633), ([0, 44], 0.10410628019323633)]
225
None
94
Code:
IndexError                                Traceback (most recent call last)
<ipython-input-80-f58816340bad> in <module>()
      6 test = int(0.2 * scipy.misc.comb(52, 2))
      7 print test
----> 8 jdoe = bob.setFrac(handsSorted[47][0],1.0)
      9 print jdoe
     10 print size(handsSorted)

IndexError: list index out of range
here is the handsSorted function

Code:
 def getHandsSortedAndEquities(self, villainRange, board):
        ea = EquityArray(board)
        result = []
        for i in range(numCards):
            for j in range(i+1, numCards):
                hand = [i,j]
                if not conflicts(board, hand):                    
                    result.append((hand, getEquityVsRange(hand, villainRange, ea)))
            result.sort(key = lambda x: x[1], reverse = 1)
            return result
tips on how to further break the problem down and fix my bug?
Will Tipton Video Pack 2 - Solving Poker Quote
08-01-2014 , 10:02 PM
no error messages in the code but the solution to T has gone wrong:

Code:

soln2 = doFP(T, 300, sbStartingRange, bbStartingRange)
1
SB average EV: 9.0
BB average EV: 14.6661891117
2
SB average EV: 12.0
BB average EV: 16.4996418338
3
SB average EV: 13.5
BB average EV: 17.599713467
4
SB average EV: 14.4
BB average EV: 18.3330945559
5
SB average EV: 15.0
BB average EV: 18.8569381907
and somehow BB seems to have no checking range...

Thanks in advance for any ideas on how to solve this!
Will Tipton Video Pack 2 - Solving Poker Quote
08-02-2014 , 04:07 AM
Quote:
Originally Posted by 307th
Knut it looks like you've got a typo here:

# update SB strategy
updateRange(sbJamRange, bestBBCallRange, n)

that should be:

# update BB strategy
updateRange(bbCallRange, bestBBCallRange, n)

hopefully that fixes it.
that fixed it. sometimes it's hard to find typos yourself so very thankful you helped me out!
Will Tipton Video Pack 2 - Solving Poker Quote
08-03-2014 , 08:20 PM
Quote:
Originally Posted by stevepa
I did something! Solid blue line is EV, dashed blue line is if both players just turned over their hands and collected their equity in the pot with no betting, red line is capture factor for which I've used (solid blue line - player chips in pot) / (dashed blue line - player chips in pot). It's late and I don't have the book handy, I believe this is how it's defined the book? (although it's a bit awkward for a preflop situation I suppose)

Anyways, this one is for the minraise/jam game from the sb's perspective:


From the bb's perspective:


Does this look reasonable?
Cool stuff. I like how you show equity in the pot in terms of BBs rather than a fraction.

Regarding CFs, it's the fraction of the pot a hand figures to capture. So, I think you want (solid blue line - player chips in stack) / (player chips in pot). The curve should essentially be parallel to the EV curve, just shifted and rescaled.
Will Tipton Video Pack 2 - Solving Poker Quote
08-03-2014 , 08:20 PM
Quote:
Originally Posted by minotaurs
Hey Will whats the biggest game you tryed to make with this program. Also whats your CPU and how much time it took for that tree?
The python code was developed from scratch for the sake of this video series, and the largest game I used it on was in the video -- I guess it took a couple minutes.

Quote:
I saw that you wrote on husng.com that the biggest issue was always the RAM and that every board takes 57MB and every action takes 3 * 21 kB. This memory takes place into RAM and only after that those board files are stored in the HDD?Sry i just dont realy know how it works.
Yes.

So, RAM and harddrive are both "memory", but RAM is much faster to access, so we usually keep data there when doing computations. (RAM is also more expensive, so we usually don't have as much of it, and also it's volatile in the sense that it loses its data if it's unpowered.)

Quote:

And also if i get computer with 4 cores does IPython is using them all when calculating "stuff" in this program or just 1?
No, programs are generally not able to take advantage of multiple cores without some extra work. Basically, when we want a computer to solve a problem, we give it a list of instructions that it executes in order, one after another. A program that uses multiple cores is executing multiple lists of instructions, simultaneously. It isn't always obvious how to break a problem into parts that you can make progress on independently...
Will Tipton Video Pack 2 - Solving Poker Quote
08-03-2014 , 08:23 PM
Quote:
Originally Posted by klondi
I also bought this series.

Havent had time to do them all yet, so far im only at video 5.

I really enjoy it. Although the sound quality could have been a litle better but that is a minor isue.

I have no prior programing expirience, but I was always a bit facinated about computer programming it so I thought this was a good chance for me to get into programing while I can also learn something about poker.

I will say you dont need any programing expirience to follow the series, but if you are interested there are a ton off free videos and other material on the internet. about python.

I started to do and online course in computer science MITx6,0 on edx.org

https://courses.edx.org/courses/MITx...0.1_3x.2T2014/

Its free and they use python 2.7 in all the examples. Its the same version of python that commes with the anaconda pack that will uses in the video's ( although will uses Ipython wich is slightly diferent) So for anyone interested to learn a litle more about python i will highly recommend it as it will also make it more easy to understand what will is doing in the video's.
Quote:
Originally Posted by Sevendeuceo
This course looks quite interesting. Unfortunately registration is closed.
Hey klondi,

Thanks for the review. I'm glad to hear you've found it accessible without having a programming background.

I wasn't able to find the course you link to, but here's something that looks similar. I haven't watched these videos, but I've seen a lot of other stuff on MIT's OCW site, and it's generally very good.

http://ocw.mit.edu/courses/electrica...ction-to-6.00/

Will
Will Tipton Video Pack 2 - Solving Poker Quote

      
m