Skip to content

Commit 2e68e4b

Browse files
committed
CS404 Coursework Auction Games
0 parents  commit 2e68e4b

File tree

9 files changed

+634
-0
lines changed

9 files changed

+634
-0
lines changed
131 KB
Binary file not shown.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# CS404 Coursework Auction Games
2+
# 加微信 powcoder
3+
4+
# QQ 1823890830
5+
6+
# Programming Help Add Wechat powcoder
7+
8+
# Email: powcoder@163.com
9+

arena.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
https://powcoder.com
2+
代写代考加微信 powcoder
3+
Assignment Project Exam Help
4+
Add WeChat powcoder
5+
https://powcoder.com
6+
代写代考加微信 powcoder
7+
Assignment Project Exam Help
8+
Add WeChat powcoder
9+
10+
# Import the auctioneer, to run your auctions
11+
from auctioneer import Auctioneer
12+
13+
# Import some bots to play with
14+
# We have given you some basic bots to start with in the bots folder
15+
# You can also add your own bots to test against
16+
from bots import flat_bot_10
17+
from bots import random_bot
18+
from bots import u1234321
19+
20+
21+
def run_basic_auction():
22+
"""
23+
An example function that runs a basic auction with 3 bots
24+
"""
25+
# Setup a room of bots to play against each other, imported above from the bots folder
26+
room = [u1234321, flat_bot_10, random_bot]
27+
28+
# Set the game type between "value" or "collection"
29+
game_type = "collection"
30+
# Setup the auction
31+
my_auction = Auctioneer(room=room, game_type=game_type)
32+
# Play the auction
33+
my_auction.run_auction()
34+
35+
36+
def run_lots_of_auctions():
37+
"""
38+
An example if you want to run alot of auctions at once
39+
"""
40+
# A large room with a few bots of the same type
41+
room = [random_bot, random_bot, random_bot, u1234321]
42+
# Set the game type between "value" or "collection"
43+
game_type = "value"
44+
45+
win_count = 0
46+
run_count = 50
47+
for i in range(run_count):
48+
# Setup the auction
49+
# slowdown = 0 makes it fast
50+
my_auction = Auctioneer(room=room, game_type=game_type, slowdown=0)
51+
# run_auction() returns a list of winners, sometimes there are more than one winner if there is a tie
52+
winners = my_auction.run_auction()
53+
# Check if the bot's name, "my_bot", was a winner
54+
if "1234321" in winners:
55+
win_count +=1
56+
print("My bot won {} of {} games".format(win_count, run_count))
57+
58+
59+
if __name__=="__main__":
60+
run_basic_auction()

0 commit comments

Comments
 (0)