Hi,
since this thread is for discussion, while other thread (
https://bitcointalk.org/index.php?topic=134799.0;all ) is for announcements I am posting here. Even though it's a reply to kakobrekla's post in other thread.
I've written a small python program for analyzing possible outcomes:(is there syntax coloring on this forum?)
#!/usr/bin/python
# bitbets.py
# GPL v3 license
# send bug reports to cosurgi@gmail.com
# send donations to: 1MtpRjRUNXhPUY89Ah9vZ3jcdSVwS7oXGn
import copy
import readline
global text
global won_weight_bet
global added_bets
text=[]
won_weight_bet=[]
added_bets=[]
def start():
print("==================== bitbet analyzer ====================")
print("Welcome!")
print("If you find this small program useful or win something, please")
print("send donations to: 1MtpRjRUNXhPUY89Ah9vZ3jcdSVwS7oXGn\n")
print("Paste raw data as seen on http://bitbet.us/")
print("in the table just under \"CONFIRMED BETS\"")
print("(enter blank line twice to finish)")
line="start"
global text
global won_weight_bet
global added_bets
text=[]
won_weight_bet=[]
added_bets=[]
errors=0
while(line!="\n"):
try:
import sys
sys.stdout.write("["+str(len(text)-errors)+"] ")
line = sys.stdin.readline()
if(line!="\n"):
text.append(line)
if(len(line.split()) >= 5):
won_weight_bet.append((
line.split()[2],
int(line.split()[3].replace("`","")),
float(line.split()[4])))
else:
sys.stdout.write("something is wrong, please paste carefully\n")
errors = errors+1
except:
sys.stdout.write("something is wrong, please paste carefully\n")
errors = errors+1
print("data enetered correctly, type 'help' for help")
def str8(arg):
res=str('%.8f'%arg)
res=" "*(13 - len(res))+res
return res
def str5(arg): return str('%5i'%arg)
def str3(arg): return str('%3i'%arg)
def inp():
for a in range(len(text)):
print("["+str(a)+"] "+text[a])
def wwb():
global text
global won_weight_bet
print("[ ] won weight bet")
for a in range(len(won_weight_bet)):
won = won_weight_bet[a][0]
weight= won_weight_bet[a][1]
bet = won_weight_bet[a][2]
print("["+str3(a+1)+"] "+("No " if won=="No" else "Yes")+" "
+ str5(weight) + " "+str8(bet))
def win(res,N=0):
global text
global won_weight_bet
global added_bets
print("[ ] won weight bet winning net win net loss")
losers=0
bet_weight_sum=0
for a in range(len(won_weight_bet)):
won = ((True if won_weight_bet[a][0]=="Yes" else False) == res)
weight= won_weight_bet[a][1]
bet = won_weight_bet[a][2]
if(not won):
losers = losers + bet
else:
bet_weight_sum = bet_weight_sum + bet*weight
if(N<0): N=len(won_weight_bet)+N
net=0
for a in range(len(won_weight_bet)):
won_ = won_weight_bet[a][0]
won = ((True if won_weight_bet[a][0]=="Yes" else False) == res)
weight = won_weight_bet[a][1]
bet = won_weight_bet[a][2]
winning = ( (bet+losers*bet*weight/bet_weight_sum)*0.99 if won else 0 )
if(a>=N):
net = net + winning - bet
print("["+str3(a+1)+"] "+("No " if won_=="No" else "Yes")+" "
+ str5(weight) + " "+str8(bet) + " "
+ ( str8(winning) if (winning!=0) else (" ") ) + " "
+ ((str8(winning - bet ) + " ") if ((winning - bet)>0) else (" " + str8(winning - bet )))
+ " "
+ ( ( "total:"+str8(net) ) if ((N == len(won_weight_bet)-2) and (a == len(won_weight_bet)-1) ) else " ")
+ ((" (*)") if (a in added_bets) else ( ((" (+)") if ((-1*a) in added_bets) else ( " " )) )) )
def help():
print("help|h - help")
print("reset|res|r - start working on a new bet")
print("inp - print raw input data")
print("bets - show current bets")
print("win yes|no - see what happens when bet is resolved to yes|no")
print("bet yes|no weight BTC - see what you can win if you place a new bet")
print("bett yes|no weight BTC - same as above, but print everyone's results - marked with (+)")
print("bet yes weight BTC no BTC - place double bet on both sides, see what happens")
print("add bet yes|no weight BTC - permanently add a bet to table - marked with (*)")
print("quit|q CTRL-\ - quit")
cmd=""
start()
#global text
#global won_weight_bet
#global added_bets
while(cmd!="quit" and cmd!="q"):
try:
cmd = raw_input("> ")
if(cmd!=""):
if(cmd.split()[0] == "help" or cmd.split()[0] == "h"): help()
if(cmd.split()[0] == "res" or cmd.split()[0] == "reset" or cmd.split()[0] == "r"): start()
if(cmd.split()[0] == "inp"): inp()
if(cmd.split()[0] == "bets"): wwb()
if(cmd.split()[0] == "win"):
if(len(cmd.split())==2):
if(cmd.split()[1] == "yes"): win(True)
if(cmd.split()[1] == "no"): win(False)
else:
print("win yes|no")
if(cmd.split()[0] == "bet" or cmd.split()[0] == "bett"):
if(len(cmd.split())==4):
if(cmd.split()[1] == "yes"):
tmp = ( copy.deepcopy(won_weight_bet) , copy.deepcopy(added_bets) )
won_weight_bet.append(( "Yes",
int(cmd.split()[2]),
float(cmd.split()[3])))
if(cmd.split()[0] == "bett"):
added_bets.append( -1*(len(won_weight_bet)-1) )
win(True)
else:
win(True,-1)
won_weight_bet , added_bets = copy.deepcopy(tmp)
if(cmd.split()[1] == "no"):
tmp = ( copy.deepcopy(won_weight_bet) , copy.deepcopy(added_bets) )
won_weight_bet.append(( "No",
int(cmd.split()[2]),
float(cmd.split()[3])))
if(cmd.split()[0] == "bett"):
added_bets.append( -1*(len(won_weight_bet)-1) )
win(False)
else:
win(False,-1)
won_weight_bet , added_bets = copy.deepcopy(tmp)
elif(len(cmd.split())==6 and cmd.split()[1] == "yes"):
tmp = copy.deepcopy(won_weight_bet)
won_weight_bet.append(( "Yes",
int(cmd.split()[2]),
float(cmd.split()[3])))
won_weight_bet.append(( "No",
int(cmd.split()[2]),
float(cmd.split()[5])))
print("result: YES")
win(True,-2)
print("result: NO")
win(False,-2)
won_weight_bet=copy.deepcopy(tmp)
else:
print("bet yes|no weight sum\nbet yes weight sum no sum")
if(cmd.split()[0] == "add" and len(cmd.split())==5 and cmd.split()[1] == "bet"):
if(cmd.split()[2] == "yes"):
won_weight_bet.append(( "Yes",
int(cmd.split()[3]),
float(cmd.split()[4])))
added_bets.append(len(won_weight_bet)-1)
win(True)
if(cmd.split()[2] == "no"):
won_weight_bet.append(( "No",
int(cmd.split()[3]),
float(cmd.split()[4])))
added_bets.append(len(won_weight_bet)-1)
win(False)
except:
print("wrong command, check 'help'")
And I was looking for possible bet outcomes.
(BetAmount + (LosersBtcSum / WinnersWeightedBtcSum) * ( BetAmount * BetWeight ) )*0.99
I have found that it is possible to abuse rewards if someone is rich and don't mind losing few bitcoins. The method is simple, bet so much, that the 1% fee is larger than total LosersBtcSum.
For example take this one:
http://bitbet.us/bet/40/network-difficulty-under-4-5-million/Now lets say, that someone places a bet of 42 BTC with weight 25000 (that would happen today). His net winning would be quite nice: 1.02 BTC:
[ ] won weight bet winning net winning
[ 1] No 99994 0.04000000 0.04509385 0.00509385
[ 2] Yes 99994 0.06000000 -0.06000000
[ 3] Yes 99989 2.00000000 -2.00000000
[ 4] No 81542 0.50000000 0.55100084 0.05100084
[ 5] No 81534 2.00000000 2.20398140 0.20398140
[ 6] No 67299 1.00012340 1.08257185 0.08244845
[ 7] No 44635 0.60000000 0.63078494 0.03078494
[ 8] No 43427 1.00000000 1.04964898 0.04964898
[ 9] No 35777 0.01000000 0.01039141 0.00039141
[ 10] No 35613 2.00000000 2.07783219 0.07783219
[ 11] Yes 28527 0.00008000 -0.00008000
[ 12] No 25557 0.70000000 0.71757260 0.01757260
[ 13] No 25000 42.00000000 43.02222330 1.02222330 (*)
The (*) marks freshly placed bet.
Next someone rich decides, that he doesn't want anybody to win this bet, and decides to lose 6 BTC on that, he places a bet of 770 BTC with weight 20000, and here's what we get:
[ ] won weight bet winning net winning
[ 1] No 99994 0.04000000 0.04008891 0.00008891
[ 2] Yes 99994 0.06000000 -0.06000000
[ 3] Yes 99989 2.00000000 -2.00000000
[ 4] No 81542 0.50000000 0.49998367 -0.00001633
[ 5] No 81534 2.00000000 1.99993271 -0.00006729
[ 6] No 67299 1.00012340 0.99834951 -0.00177389
[ 7] No 44635 0.60000000 0.59727359 -0.00272641
[ 8] No 43427 1.00000000 0.99530832 -0.00469168
[ 9] No 35777 0.01000000 0.00994373 -0.00005627
[ 10] No 35613 2.00000000 1.98870635 -0.01129365
[ 11] Yes 28527 0.00008000 -0.00008000
[ 12] No 25557 0.70000000 0.69518678 -0.00481322
[ 13] No 25000 42.00000000 41.70834733 -0.29165267 (*)
[ 14] No 20000 760.00000000 754.25798046 -5.74201954 (+)
If you take 2% fee from losers only, instead of 1% from everyone, this problem would not occur.
Moreover, you are welcome to use my small python program and send me some donations if you like it!
Or if you win something
Very nicely done. Please select a bet, a side, and post your address, we'll place a 1 BTC bet for you.