-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathbots.rb
More file actions
executable file
·137 lines (132 loc) · 5.12 KB
/
bots.rb
File metadata and controls
executable file
·137 lines (132 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# To add bots, please see ApplicationDefs::STATIC_GAME_DEFINITIONS
# below and add your script or class appropriately as the examples
# describe for every game definition your bot plays.
require_relative 'all_bot_runner_classes'
require_relative '../app/models/user'
require 'acpc_dealer'
# Assortment of constant definitions.
module Bots
DEFAULT_BOT_NAME = 'Tester' unless const_defined? :DEFAULT_BOT_NAME
BOT_DIR = File.expand_path('../', __FILE__)
STATIC_GAME_DEFINITIONS = {
two_player_fcpa: {
file: AcpcDealer::GAME_DEFINITION_FILE_PATHS[2][:nolimit],
text: '2-player FCPA',
opponents: {
# ADD BOTS HERE LIKE SO:
# 'YourAgentNameForDropdownAndLogs' => RunYourAgent
# OR:
# 'YourAgentNameForDropdownAndLogs' => '/absolute/path/to/my/agent'
# OR:
# 'YourAgentNameForDropdownAndLogs' => File.join(BOT_DIR, 'path/relative/to/bots/directory')
DEFAULT_BOT_NAME => RunTestingBot,
'ExamplePlayer' => AcpcDealer::EXAMPLE_PLAYERS[2][:nolimit]
},
num_players: 2
},
two_player_nolimit: {
file: AcpcDealer::GAME_DEFINITION_FILE_PATHS[2][:nolimit],
text: '2-player no-limit',
opponents: {
# ADD BOTS HERE LIKE SO:
# 'YourAgentNameForDropdownAndLogs' => RunYourAgent
# OR:
# 'YourAgentNameForDropdownAndLogs' => '/absolute/path/to/my/agent'
# OR:
# 'YourAgentNameForDropdownAndLogs' => File.join(BOT_DIR, 'path/relative/to/bots/directory')
DEFAULT_BOT_NAME => RunTestingBot,
'ExamplePlayer' => AcpcDealer::EXAMPLE_PLAYERS[2][:nolimit]
},
num_players: 2
},
two_player_limit: {
file: AcpcDealer::GAME_DEFINITION_FILE_PATHS[2][:limit],
text: '2-player limit',
opponents: {
# ADD BOTS HERE LIKE SO:
# 'YourAgentNameForDropdownAndLogs' => RunYourAgent
# OR:
# 'YourAgentNameForDropdownAndLogs' => '/absolute/path/to/my/agent'
# OR:
# 'YourAgentNameForDropdownAndLogs' => File.join(BOT_DIR, 'path/relative/to/bots/directory')
DEFAULT_BOT_NAME => RunTestingBot,
'ExamplePlayer' => AcpcDealer::EXAMPLE_PLAYERS[2][:limit]
},
num_players: 2
},
two_player_royal: {
file: File.expand_path('../../game_defs/royal.limit.2p.reverse_blinds.game', __FILE__),
text: '2-player limit royal',
opponents: {
# ADD BOTS HERE LIKE SO:
# 'YourAgentNameForDropdownAndLogs' => RunYourAgent
# OR:
# 'YourAgentNameForDropdownAndLogs' => '/absolute/path/to/my/agent'
# OR:
# 'YourAgentNameForDropdownAndLogs' => File.join(BOT_DIR, 'path/relative/to/bots/directory')
DEFAULT_BOT_NAME => RunTestingBot
},
num_players: 2
},
three_player_nolimit: {
file: AcpcDealer::GAME_DEFINITION_FILE_PATHS[3][:nolimit],
text: '3-player no-limit',
opponents: {
# ADD BOTS HERE LIKE SO:
# 'YourAgentNameForDropdownAndLogs' => RunYourAgent
# OR:
# 'YourAgentNameForDropdownAndLogs' => '/absolute/path/to/my/agent'
# OR:
# 'YourAgentNameForDropdownAndLogs' => File.join(BOT_DIR, 'path/relative/to/bots/directory')
DEFAULT_BOT_NAME => RunTestingBot,
'ExamplePlayer' => AcpcDealer::EXAMPLE_PLAYERS[3][:nolimit],
'Tester2' => File.join(BOT_DIR, 'agent_scripts/testing_bot'),
},
num_players: 3
},
three_player_limit: {
file: AcpcDealer::GAME_DEFINITION_FILE_PATHS[3][:limit],
text: '3-player limit',
opponents: {
# ADD BOTS HERE LIKE SO:
# 'YourAgentNameForDropdownAndLogs' => RunYourAgent
# OR:
# 'YourAgentNameForDropdownAndLogs' => '/absolute/path/to/my/agent'
# OR:
# 'YourAgentNameForDropdownAndLogs' => File.join(BOT_DIR, 'path/relative/to/bots/directory')
DEFAULT_BOT_NAME => RunTestingBot,
'ExamplePlayer' => AcpcDealer::EXAMPLE_PLAYERS[3][:limit],
'Tester2' => File.join(BOT_DIR, 'agent_scripts/testing_bot')
},
num_players: 3
},
three_player_kuhn: {
file: AcpcDealer::GAME_DEFINITION_FILE_PATHS[3][:kuhn],
text: '3-player kuhn',
opponents: {
# ADD BOTS HERE LIKE SO:
# 'YourAgentNameForDropdownAndLogs' => RunYourAgent
# OR:
# 'YourAgentNameForDropdownAndLogs' => '/absolute/path/to/my/agent'
# OR:
# 'YourAgentNameForDropdownAndLogs' => File.join(BOT_DIR, 'path/relative/to/bots/directory')
'SF1Equilibrium' => AcpcDealer::EXAMPLE_PLAYERS[3][:kuhn_sf1],
'SF2Equilibrium' => AcpcDealer::EXAMPLE_PLAYERS[3][:kuhn_sf2],
'SF3Equilibrium' => AcpcDealer::EXAMPLE_PLAYERS[3][:kuhn_sf3],
DEFAULT_BOT_NAME => RunTestingBot,
'Tester2' => File.join(BOT_DIR, 'agent_scripts/testing_bot'),
},
num_players: 3
}
} unless const_defined? :STATIC_GAME_DEFINITIONS
# Human opponent names map to nil
def self.game_definitions
lcl_game_defs = STATIC_GAME_DEFINITIONS.dup
# @todo Code duplication
#lcl_game_defs.each do |type, prop|
# User.each do |user|
# prop[:opponents].merge! user.name => nil
# end
#end
end
end