catanatron_gym.envs package

Submodules

catanatron_gym.envs.catanatron_env module

class catanatron_gym.envs.catanatron_env.CatanatronEnv(config=None)

Bases: Generic[gym.core.ObsType, gym.core.ActType]

1v1 environment against a random player

reward_range

-1 if player lost, 1 if player won, 0 otherwise.

action_space

Integers from the [0, 289] interval. See Action Space table below.

Type

spaces.Space[ActType]

observation_space

Numeric Feature Vector. See Observation Space table below for quantities. They appear in vector in alphabetical order, from the perspective of “current” player (hiding/showing information accordingly). P0 is “current” player. P1 is next in line.

We use the following nomenclature for Tile ids and Node ids. Edge ids are self-describing (node-id, node-id) tuples. We also use Cube coordinates for tiles (see https://www.redblobgames.com/grids/hexagons/#coordinates)

Type

spaces.Space[ObsType]

Tile Ids Node Ids
Action Space

Integer

Catanatron Action

0

(ActionType.ROLL, None)

1

(ActionType.MOVE_ROBBER, (0, 0, 0))

2

(ActionType.MOVE_ROBBER, (1, -1, 0))

3

(ActionType.MOVE_ROBBER, (0, -1, 1))

4

(ActionType.MOVE_ROBBER, (-1, 0, 1))

5

(ActionType.MOVE_ROBBER, (-1, 1, 0))

6

(ActionType.MOVE_ROBBER, (0, 1, -1))

7

(ActionType.MOVE_ROBBER, (1, 0, -1))

8

(ActionType.MOVE_ROBBER, (2, -2, 0))

9

(ActionType.MOVE_ROBBER, (1, -2, 1))

10

(ActionType.MOVE_ROBBER, (0, -2, 2))

11

(ActionType.MOVE_ROBBER, (-1, -1, 2))

12

(ActionType.MOVE_ROBBER, (-2, 0, 2))

13

(ActionType.MOVE_ROBBER, (-2, 1, 1))

14

(ActionType.MOVE_ROBBER, (-2, 2, 0))

15

(ActionType.MOVE_ROBBER, (-1, 2, -1))

16

(ActionType.MOVE_ROBBER, (0, 2, -2))

17

(ActionType.MOVE_ROBBER, (1, 1, -2))

18

(ActionType.MOVE_ROBBER, (2, 0, -2))

19

(ActionType.MOVE_ROBBER, (2, -1, -1))

20

(ActionType.DISCARD, None)

21

(ActionType.BUILD_ROAD, (0, 5))

22

(ActionType.BUILD_ROAD, (0, 1))

23

(ActionType.BUILD_ROAD, (0, 20))

24

(ActionType.BUILD_ROAD, (1, 2))

25

(ActionType.BUILD_ROAD, (1, 6))

26

(ActionType.BUILD_ROAD, (2, 3))

27

(ActionType.BUILD_ROAD, (2, 9))

28

(ActionType.BUILD_ROAD, (3, 4))

29

(ActionType.BUILD_ROAD, (3, 12))

30

(ActionType.BUILD_ROAD, (4, 5))

31

(ActionType.BUILD_ROAD, (4, 15))

32

(ActionType.BUILD_ROAD, (5, 16))

33

(ActionType.BUILD_ROAD, (6, 7))

34

(ActionType.BUILD_ROAD, (6, 23))

35

(ActionType.BUILD_ROAD, (7, 8))

36

(ActionType.BUILD_ROAD, (7, 24))

37

(ActionType.BUILD_ROAD, (8, 9))

38

(ActionType.BUILD_ROAD, (8, 27))

39

(ActionType.BUILD_ROAD, (9, 10))

40

(ActionType.BUILD_ROAD, (10, 11))

41

(ActionType.BUILD_ROAD, (10, 29))

42

(ActionType.BUILD_ROAD, (11, 12))

43

(ActionType.BUILD_ROAD, (11, 32))

44

(ActionType.BUILD_ROAD, (12, 13))

45

(ActionType.BUILD_ROAD, (13, 14))

46

(ActionType.BUILD_ROAD, (13, 34))

47

(ActionType.BUILD_ROAD, (14, 15))

48

(ActionType.BUILD_ROAD, (14, 37))

49

(ActionType.BUILD_ROAD, (15, 17))

50

(ActionType.BUILD_ROAD, (16, 18))

51

(ActionType.BUILD_ROAD, (16, 21))

52

(ActionType.BUILD_ROAD, (17, 18))

53

(ActionType.BUILD_ROAD, (17, 39))

54

(ActionType.BUILD_ROAD, (18, 40))

55

(ActionType.BUILD_ROAD, (19, 21))

56

(ActionType.BUILD_ROAD, (19, 20))

57

(ActionType.BUILD_ROAD, (19, 46))

58

(ActionType.BUILD_ROAD, (20, 22))

59

(ActionType.BUILD_ROAD, (21, 43))

60

(ActionType.BUILD_ROAD, (22, 23))

61

(ActionType.BUILD_ROAD, (22, 49))

62

(ActionType.BUILD_ROAD, (23, 52))

63

(ActionType.BUILD_ROAD, (24, 25))

64

(ActionType.BUILD_ROAD, (24, 53))

65

(ActionType.BUILD_ROAD, (25, 26))

66

(ActionType.BUILD_ROAD, (26, 27))

67

(ActionType.BUILD_ROAD, (27, 28))

68

(ActionType.BUILD_ROAD, (28, 29))

69

(ActionType.BUILD_ROAD, (29, 30))

70

(ActionType.BUILD_ROAD, (30, 31))

71

(ActionType.BUILD_ROAD, (31, 32))

72

(ActionType.BUILD_ROAD, (32, 33))

73

(ActionType.BUILD_ROAD, (33, 34))

74

(ActionType.BUILD_ROAD, (34, 35))

75

(ActionType.BUILD_ROAD, (35, 36))

76

(ActionType.BUILD_ROAD, (36, 37))

77

(ActionType.BUILD_ROAD, (37, 38))

78

(ActionType.BUILD_ROAD, (38, 39))

79

(ActionType.BUILD_ROAD, (39, 41))

80

(ActionType.BUILD_ROAD, (40, 42))

81

(ActionType.BUILD_ROAD, (40, 44))

82

(ActionType.BUILD_ROAD, (41, 42))

83

(ActionType.BUILD_ROAD, (43, 44))

84

(ActionType.BUILD_ROAD, (43, 47))

85

(ActionType.BUILD_ROAD, (45, 47))

86

(ActionType.BUILD_ROAD, (45, 46))

87

(ActionType.BUILD_ROAD, (46, 48))

88

(ActionType.BUILD_ROAD, (48, 49))

89

(ActionType.BUILD_ROAD, (49, 50))

90

(ActionType.BUILD_ROAD, (50, 51))

91

(ActionType.BUILD_ROAD, (51, 52))

92

(ActionType.BUILD_ROAD, (52, 53))

93

(ActionType.BUILD_SETTLEMENT, 0)

94

(ActionType.BUILD_SETTLEMENT, 1)

95

(ActionType.BUILD_SETTLEMENT, 2)

96

(ActionType.BUILD_SETTLEMENT, 3)

97

(ActionType.BUILD_SETTLEMENT, 4)

98

(ActionType.BUILD_SETTLEMENT, 5)

99

(ActionType.BUILD_SETTLEMENT, 6)

100

(ActionType.BUILD_SETTLEMENT, 7)

101

(ActionType.BUILD_SETTLEMENT, 8)

102

(ActionType.BUILD_SETTLEMENT, 9)

103

(ActionType.BUILD_SETTLEMENT, 10)

104

(ActionType.BUILD_SETTLEMENT, 11)

105

(ActionType.BUILD_SETTLEMENT, 12)

106

(ActionType.BUILD_SETTLEMENT, 13)

107

(ActionType.BUILD_SETTLEMENT, 14)

108

(ActionType.BUILD_SETTLEMENT, 15)

109

(ActionType.BUILD_SETTLEMENT, 16)

110

(ActionType.BUILD_SETTLEMENT, 17)

111

(ActionType.BUILD_SETTLEMENT, 18)

112

(ActionType.BUILD_SETTLEMENT, 19)

113

(ActionType.BUILD_SETTLEMENT, 20)

114

(ActionType.BUILD_SETTLEMENT, 21)

115

(ActionType.BUILD_SETTLEMENT, 22)

116

(ActionType.BUILD_SETTLEMENT, 23)

117

(ActionType.BUILD_SETTLEMENT, 24)

118

(ActionType.BUILD_SETTLEMENT, 25)

119

(ActionType.BUILD_SETTLEMENT, 26)

120

(ActionType.BUILD_SETTLEMENT, 27)

121

(ActionType.BUILD_SETTLEMENT, 28)

122

(ActionType.BUILD_SETTLEMENT, 29)

123

(ActionType.BUILD_SETTLEMENT, 30)

124

(ActionType.BUILD_SETTLEMENT, 31)

125

(ActionType.BUILD_SETTLEMENT, 32)

126

(ActionType.BUILD_SETTLEMENT, 33)

127

(ActionType.BUILD_SETTLEMENT, 34)

128

(ActionType.BUILD_SETTLEMENT, 35)

129

(ActionType.BUILD_SETTLEMENT, 36)

130

(ActionType.BUILD_SETTLEMENT, 37)

131

(ActionType.BUILD_SETTLEMENT, 38)

132

(ActionType.BUILD_SETTLEMENT, 39)

133

(ActionType.BUILD_SETTLEMENT, 40)

134

(ActionType.BUILD_SETTLEMENT, 41)

135

(ActionType.BUILD_SETTLEMENT, 42)

136

(ActionType.BUILD_SETTLEMENT, 43)

137

(ActionType.BUILD_SETTLEMENT, 44)

138

(ActionType.BUILD_SETTLEMENT, 45)

139

(ActionType.BUILD_SETTLEMENT, 46)

140

(ActionType.BUILD_SETTLEMENT, 47)

141

(ActionType.BUILD_SETTLEMENT, 48)

142

(ActionType.BUILD_SETTLEMENT, 49)

143

(ActionType.BUILD_SETTLEMENT, 50)

144

(ActionType.BUILD_SETTLEMENT, 51)

145

(ActionType.BUILD_SETTLEMENT, 52)

146

(ActionType.BUILD_SETTLEMENT, 53)

147

(ActionType.BUILD_CITY, 0)

148

(ActionType.BUILD_CITY, 1)

149

(ActionType.BUILD_CITY, 2)

150

(ActionType.BUILD_CITY, 3)

151

(ActionType.BUILD_CITY, 4)

152

(ActionType.BUILD_CITY, 5)

153

(ActionType.BUILD_CITY, 6)

154

(ActionType.BUILD_CITY, 7)

155

(ActionType.BUILD_CITY, 8)

156

(ActionType.BUILD_CITY, 9)

157

(ActionType.BUILD_CITY, 10)

158

(ActionType.BUILD_CITY, 11)

159

(ActionType.BUILD_CITY, 12)

160

(ActionType.BUILD_CITY, 13)

161

(ActionType.BUILD_CITY, 14)

162

(ActionType.BUILD_CITY, 15)

163

(ActionType.BUILD_CITY, 16)

164

(ActionType.BUILD_CITY, 17)

165

(ActionType.BUILD_CITY, 18)

166

(ActionType.BUILD_CITY, 19)

167

(ActionType.BUILD_CITY, 20)

168

(ActionType.BUILD_CITY, 21)

169

(ActionType.BUILD_CITY, 22)

170

(ActionType.BUILD_CITY, 23)

171

(ActionType.BUILD_CITY, 24)

172

(ActionType.BUILD_CITY, 25)

173

(ActionType.BUILD_CITY, 26)

174

(ActionType.BUILD_CITY, 27)

175

(ActionType.BUILD_CITY, 28)

176

(ActionType.BUILD_CITY, 29)

177

(ActionType.BUILD_CITY, 30)

178

(ActionType.BUILD_CITY, 31)

179

(ActionType.BUILD_CITY, 32)

180

(ActionType.BUILD_CITY, 33)

181

(ActionType.BUILD_CITY, 34)

182

(ActionType.BUILD_CITY, 35)

183

(ActionType.BUILD_CITY, 36)

184

(ActionType.BUILD_CITY, 37)

185

(ActionType.BUILD_CITY, 38)

186

(ActionType.BUILD_CITY, 39)

187

(ActionType.BUILD_CITY, 40)

188

(ActionType.BUILD_CITY, 41)

189

(ActionType.BUILD_CITY, 42)

190

(ActionType.BUILD_CITY, 43)

191

(ActionType.BUILD_CITY, 44)

192

(ActionType.BUILD_CITY, 45)

193

(ActionType.BUILD_CITY, 46)

194

(ActionType.BUILD_CITY, 47)

195

(ActionType.BUILD_CITY, 48)

196

(ActionType.BUILD_CITY, 49)

197

(ActionType.BUILD_CITY, 50)

198

(ActionType.BUILD_CITY, 51)

199

(ActionType.BUILD_CITY, 52)

200

(ActionType.BUILD_CITY, 53)

201

(ActionType.BUY_DEVELOPMENT_CARD, None)

202

(ActionType.PLAY_KNIGHT_CARD, None)

203

(ActionType.PLAY_YEAR_OF_PLENTY, (‘WOOD’, ‘WOOD’))

204

(ActionType.PLAY_YEAR_OF_PLENTY, (‘WOOD’, ‘BRICK’))

205

(ActionType.PLAY_YEAR_OF_PLENTY, (‘WOOD’, ‘SHEEP’))

206

(ActionType.PLAY_YEAR_OF_PLENTY, (‘WOOD’, ‘WHEAT’))

207

(ActionType.PLAY_YEAR_OF_PLENTY, (‘WOOD’, ‘ORE’))

208

(ActionType.PLAY_YEAR_OF_PLENTY, (‘BRICK’, ‘BRICK’))

209

(ActionType.PLAY_YEAR_OF_PLENTY, (‘BRICK’, ‘SHEEP’))

210

(ActionType.PLAY_YEAR_OF_PLENTY, (‘BRICK’, ‘WHEAT’))

211

(ActionType.PLAY_YEAR_OF_PLENTY, (‘BRICK’, ‘ORE’))

212

(ActionType.PLAY_YEAR_OF_PLENTY, (‘SHEEP’, ‘SHEEP’))

213

(ActionType.PLAY_YEAR_OF_PLENTY, (‘SHEEP’, ‘WHEAT’))

214

(ActionType.PLAY_YEAR_OF_PLENTY, (‘SHEEP’, ‘ORE’))

215

(ActionType.PLAY_YEAR_OF_PLENTY, (‘WHEAT’, ‘WHEAT’))

216

(ActionType.PLAY_YEAR_OF_PLENTY, (‘WHEAT’, ‘ORE’))

217

(ActionType.PLAY_YEAR_OF_PLENTY, (‘ORE’, ‘ORE’))

218

(ActionType.PLAY_YEAR_OF_PLENTY, (‘WOOD’,))

219

(ActionType.PLAY_YEAR_OF_PLENTY, (‘BRICK’,))

220

(ActionType.PLAY_YEAR_OF_PLENTY, (‘SHEEP’,))

221

(ActionType.PLAY_YEAR_OF_PLENTY, (‘WHEAT’,))

222

(ActionType.PLAY_YEAR_OF_PLENTY, (‘ORE’,))

223

(ActionType.PLAY_ROAD_BUILDING, None)

224

(ActionType.PLAY_MONOPOLY, ‘WOOD’)

225

(ActionType.PLAY_MONOPOLY, ‘BRICK’)

226

(ActionType.PLAY_MONOPOLY, ‘SHEEP’)

227

(ActionType.PLAY_MONOPOLY, ‘WHEAT’)

228

(ActionType.PLAY_MONOPOLY, ‘ORE’)

229

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, ‘WOOD’, ‘WOOD’, ‘BRICK’))

230

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, ‘WOOD’, ‘WOOD’, ‘SHEEP’))

231

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, ‘WOOD’, ‘WOOD’, ‘WHEAT’))

232

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, ‘WOOD’, ‘WOOD’, ‘ORE’))

233

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, ‘BRICK’, ‘BRICK’, ‘WOOD’))

234

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, ‘BRICK’, ‘BRICK’, ‘SHEEP’))

235

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, ‘BRICK’, ‘BRICK’, ‘WHEAT’))

236

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, ‘BRICK’, ‘BRICK’, ‘ORE’))

237

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, ‘SHEEP’, ‘SHEEP’, ‘WOOD’))

238

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, ‘SHEEP’, ‘SHEEP’, ‘BRICK’))

239

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, ‘SHEEP’, ‘SHEEP’, ‘WHEAT’))

240

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, ‘SHEEP’, ‘SHEEP’, ‘ORE’))

241

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, ‘WHEAT’, ‘WHEAT’, ‘WOOD’))

242

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, ‘WHEAT’, ‘WHEAT’, ‘BRICK’))

243

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, ‘WHEAT’, ‘WHEAT’, ‘SHEEP’))

244

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, ‘WHEAT’, ‘WHEAT’, ‘ORE’))

245

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, ‘ORE’, ‘ORE’, ‘WOOD’))

246

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, ‘ORE’, ‘ORE’, ‘BRICK’))

247

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, ‘ORE’, ‘ORE’, ‘SHEEP’))

248

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, ‘ORE’, ‘ORE’, ‘WHEAT’))

249

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, ‘WOOD’, None, ‘BRICK’))

250

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, ‘WOOD’, None, ‘SHEEP’))

251

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, ‘WOOD’, None, ‘WHEAT’))

252

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, ‘WOOD’, None, ‘ORE’))

253

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, ‘BRICK’, None, ‘WOOD’))

254

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, ‘BRICK’, None, ‘SHEEP’))

255

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, ‘BRICK’, None, ‘WHEAT’))

256

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, ‘BRICK’, None, ‘ORE’))

257

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, ‘SHEEP’, None, ‘WOOD’))

258

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, ‘SHEEP’, None, ‘BRICK’))

259

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, ‘SHEEP’, None, ‘WHEAT’))

260

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, ‘SHEEP’, None, ‘ORE’))

261

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, ‘WHEAT’, None, ‘WOOD’))

262

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, ‘WHEAT’, None, ‘BRICK’))

263

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, ‘WHEAT’, None, ‘SHEEP’))

264

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, ‘WHEAT’, None, ‘ORE’))

265

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, ‘ORE’, None, ‘WOOD’))

266

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, ‘ORE’, None, ‘BRICK’))

267

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, ‘ORE’, None, ‘SHEEP’))

268

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, ‘ORE’, None, ‘WHEAT’))

269

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, None, None, ‘BRICK’))

270

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, None, None, ‘SHEEP’))

271

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, None, None, ‘WHEAT’))

272

(ActionType.MARITIME_TRADE, (‘WOOD’, ‘WOOD’, None, None, ‘ORE’))

273

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, None, None, ‘WOOD’))

274

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, None, None, ‘SHEEP’))

275

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, None, None, ‘WHEAT’))

276

(ActionType.MARITIME_TRADE, (‘BRICK’, ‘BRICK’, None, None, ‘ORE’))

277

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, None, None, ‘WOOD’))

278

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, None, None, ‘BRICK’))

279

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, None, None, ‘WHEAT’))

280

(ActionType.MARITIME_TRADE, (‘SHEEP’, ‘SHEEP’, None, None, ‘ORE’))

281

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, None, None, ‘WOOD’))

282

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, None, None, ‘BRICK’))

283

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, None, None, ‘SHEEP’))

284

(ActionType.MARITIME_TRADE, (‘WHEAT’, ‘WHEAT’, None, None, ‘ORE’))

285

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, None, None, ‘WOOD’))

286

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, None, None, ‘BRICK’))

287

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, None, None, ‘SHEEP’))

288

(ActionType.MARITIME_TRADE, (‘ORE’, ‘ORE’, None, None, ‘WHEAT’))

289

(ActionType.END_TURN, None)

Observation Space (Raw)

Feature Name

Description

Number of Features (N=number of players)

Type

BANK_<resource>

Number of cards of that resource in bank

5

Integer

BANK_DEV_CARDS

Number of development cards in bank

1

Integer

EDGE<i>_P<j>_ROAD

Whether edge i is owned by player j

72 * N

Boolean

NODE<i>_P<j>_SETTLEMENT

Whether player j has a city in node i

54 * N

Boolean

NODE<i>_P<j>_CITY

Whether player j has a city in node i

54 * N

Boolean

PORT<i>_IS_<resource>

Whether node i is port of resource (or THREE_TO_ONE).

9 * 6

Boolean

TILE<i>_HAS_ROBBER

Whether robber is on tile i.

19

Boolean

TILE<i>_IS_<resource>

Whether tile i yields resource (or DESERT).

19 * 6

Boolean

TILE<i>_PROBA

Tile i’s probability of being rolled.

19

Float

IS_DISCARDING

Whether current player must discard. For now, there is only 1 discarding action (at random), since otherwise action space would explode in size.

1

Boolean

IS_MOVING_ROBBER

Whether current player must move robber (because played knight or because rolled a 7).

1

Boolean

P<i>_HAS_ROLLED

Whether player i already rolled dice.

N

Boolean

P0_HAS_PLAYED _DEVELOPMENT_CARD _IN_TURN

Whether current player already played a development card

1

Boolean

P0_ACTUAL_VPS

Total Victory Points (including Victory Point Development Cards)

1

Integer

P0_<resource>_IN_HAND

Number of resource cards in hand

5

Integer

P0_<dev-card>_IN_HAND

Number of dev-card cards in hand

5

Integer

P<i>_NUM_DEVS_IN_HAND

Number of hidden development cards player i has

N

Integer

P<i>_NUM_RESOURCES _IN_HAND

Number of hidden resource cards player i has

N

Integer

P<i>_HAS_ARMY

Whether player <i> has Largest Army

N

Boolean

P<i>_HAS_ROAD

Whether player <i> has Longest Road

N

Boolean

P<i>_ROADS_LEFT

Number of roads pieces player i has outside of board (left to build)

N

Integer

P<i>_SETTLEMENTS_LEFT

Number of settlements player i has outside of board (left to build)

N

Integer

P<i>_CITIES_LEFT

Number of cities player i has outside of board (left to build)

N

Integer

P<i>_LONGEST_ROAD _LENGTH

Length of longest road by player i

N

Integer

P<i>_PUBLIC_VPS

Amount of visible victory points for player i (i.e. doesn’t include hidden victory point cards; only army, road and settlements/cities).

N

Integer

P<i>_<dev-card>_PLAYED

Amount of dev-card cards player i has played in game (VICTORY_POINT not included).

4 * N

Integer

194 * N + 226

get_valid_actions()
Returns

valid actions

Return type

List[int]

reset()

Resets the environment to an initial state and returns an initial observation.

This method should also reset the environment’s random number generator(s) if seed is an integer or if the environment has not yet initialized a random number generator. If the environment already has a random number generator and reset is called with seed=None, the RNG should not be reset. Moreover, reset should (in the typical use case) be called with an integer seed right after initialization and then never again.

Returns

the initial observation. info (optional dictionary): a dictionary containing extra information, this is only returned if return_info is set to true

Return type

observation (object)

step(action)

Run one timestep of the environment’s dynamics. When end of episode is reached, you are responsible for calling reset() to reset this environment’s state.

Accepts an action and returns a tuple (observation, reward, done, info).

Parameters

action (object) – an action provided by the agent

Returns

agent’s observation of the current environment reward (float) : amount of reward returned after previous action done (bool): whether the episode has ended, in which case further step() calls will return undefined results info (dict): contains auxiliary diagnostic information (helpful for debugging, logging, and sometimes learning)

Return type

observation (object)

catanatron_gym.envs.catanatron_env.from_action_space(action_int, playable_actions)

maps action_int to catantron.models.actions.Action

catanatron_gym.envs.catanatron_env.to_action_space(action)

maps action to space_action equivalent integer

Module contents