mirror of
https://github.com/pezkuwichain/consensus.git
synced 2026-06-19 04:11:14 +00:00
Auction: Made it so we can bid on contigous ranges. just not ones with a gap
This commit is contained in:
@@ -9,7 +9,7 @@ class auction:
|
|||||||
print(bidid," bids ",amount," on [",start,",",end,"]")
|
print(bidid," bids ",amount," on [",start,",",end,"]")
|
||||||
#Bid should intersect with all winning bids by same bidder
|
#Bid should intersect with all winning bids by same bidder
|
||||||
for rangeotherbid in [i for i,w in zip(self.ranges,self.winningbidsonranges) if w[0]==bidid]:
|
for rangeotherbid in [i for i,w in zip(self.ranges,self.winningbidsonranges) if w[0]==bidid]:
|
||||||
if rangeotherbid[0] > end or rangeotherbid[1] < start:
|
if rangeotherbid[0] > end + 1 or rangeotherbid[1] + 1 < start:
|
||||||
if verbose:
|
if verbose:
|
||||||
print("Invalid bid as winning on [",rangeotherbid[0],",",rangeotherbid[1],"]")
|
print("Invalid bid as winning on [",rangeotherbid[0],",",rangeotherbid[1],"]")
|
||||||
return
|
return
|
||||||
@@ -36,7 +36,7 @@ def example1():
|
|||||||
a=auction()
|
a=auction()
|
||||||
a.bid("x",0,3,1,True)
|
a.bid("x",0,3,1,True)
|
||||||
a.bid("a",0,0,2,True)
|
a.bid("a",0,0,2,True)
|
||||||
a.bid("a",1,1,53,True)
|
a.bid("a",2,2,53,True)
|
||||||
a.bid("b",1,1,1,True)
|
a.bid("b",1,1,1,True)
|
||||||
a.bid("c",2,2,1,True)
|
a.bid("c",2,2,1,True)
|
||||||
a.bid("d",3,3,1,True)
|
a.bid("d",3,3,1,True)
|
||||||
|
|||||||
Reference in New Issue
Block a user