Open Side Menu Go to the Top

04-02-2013 , 08:07 PM
Hi all.

I'm very new to programming and picked up python fairly recently as a way to gently introduce myself to programming on the advice of the internet. Whenever I see a something which has the potential to be automated I try and automate the process myself with a python script and have found this to be a good way to learn.

Saw a thread in the BQ forum where someone was describing as scenario between himself and another friend where they are going 50% on takings from MTT's and they had come to a disagreement on the owed amounts. They had encountered extra confusion because they had different buy-in amounts. I posted what I thought the totals were (probably not a great idea considering my maths has the potential to be pretty awful a lot of the time) and upon reflection I've realized my numbers were wrong.

Anyway blog over, this prompted me to create a python script to automate the process (not that it's a difficult process for most people, just I thought it would be a good task to set myself).

Would somebody with a better understanding of maths and python than me mind running the script a few times with different numbers and checking they're coming out accurately? It all looks good to me but I've found with previous projects that getting somebody else to look over them is the best way to find mistakes I may have missed. It works with python 2.7.3.

Thankyou very much.

Pokershare.py
'Winnings Splitter' Python script Quote
'Winnings Splitter' Python script
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
'Winnings Splitter' Python script
04-02-2013 , 10:32 PM
Hey I looked over the code and I think the numbers are right, but unless I misunderstood something this should work:

a = a_buyins
b = b_buyins
c = a_winnings
d = b_winnings

Player A takes (c+d)/2 + a/2 - b/2 and Player B takes (c+d)/2 + b/2 - a/2

So for Player A: (c+d)/2 is half the total winnings, + a/2 is half his own buyins that he's owed from Player B, and -b/2 is half Player B's buyins that Player A owes Player B.

Some other thoughts, you could add some validation in case the input isn't a number. Also the extra raw_inputs and exit function don't really seem to do anything.
'Winnings Splitter' Python script Quote
04-03-2013 , 05:40 AM
Quote:
Originally Posted by WeAreSamurai
Hey I looked over the code and I think the numbers are right, but unless I misunderstood something this should work:

a = a_buyins
b = b_buyins
c = a_winnings
d = b_winnings

Player A takes (c+d)/2 + a/2 - b/2 and Player B takes (c+d)/2 + b/2 - a/2

So for Player A: (c+d)/2 is half the total winnings, + a/2 is half his own buyins that he's owed from Player B, and -b/2 is half Player B's buyins that Player A owes Player B.

Some other thoughts, you could add some validation in case the input isn't a number. Also the extra raw_inputs and exit function don't really seem to do anything.
Thanks very much. I agree your way of doing it looks a lot more elegant than mine. The exit function is used to stop it from moving straight to the 'else' statement - probably something I'm doing wrong is causing this

I added the raw_input()'s below the moretoa, moretob and equalbi just as a way of padding to stop the code from just exiting and giving no time to view the numbers. Again, I'm probably doing something horrendously wrong to cause this to happen.
'Winnings Splitter' Python script Quote
04-06-2013 , 06:11 PM
Use else if instead of the exits.
'Winnings Splitter' Python script Quote
'Winnings Splitter' Python script
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
'Winnings Splitter' Python script

      
m