Skip to content
This repository was archived by the owner on Aug 11, 2023. It is now read-only.

Commit 08c17a3

Browse files
committed
minor improvement
1 parent b43b510 commit 08c17a3

File tree

3 files changed

+29
-164
lines changed

3 files changed

+29
-164
lines changed

src/base.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,23 @@ function test_interfaces!(env)
190190

191191
reset!(env)
192192
end
193+
194+
function test_runnable!(env, n = 1000;rng=Random.GLOBAL_RNG)
195+
@testset "random policy with $(nameof(env))" begin
196+
reset!(env)
197+
for _ in 1:n
198+
A = legal_action_space(env)
199+
a = rand(rng, A)
200+
@test a in A
201+
202+
S = state_space(env)
203+
s = state(env)
204+
@test s in S
205+
env(a)
206+
if is_terminated(env)
207+
reset!(env)
208+
end
209+
end
210+
reset!(env)
211+
end
212+
end

src/examples/TicTacToeEnv.jl

Lines changed: 0 additions & 155 deletions
This file was deleted.

src/interface.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -377,17 +377,17 @@ DefaultStateStyle(ss::Tuple{Vararg{<:AbstractStateStyle}}) = first(ss)
377377
# General
378378
#####
379379

380-
struct DefaultPlayer end
381-
const DEFAULT_PLAYER = DefaultPlayer()
380+
@api struct DefaultPlayer end
381+
@api const DEFAULT_PLAYER = DefaultPlayer()
382382

383-
struct ChancePlayer end
384-
const CHANCE_PLAYER = ChancePlayer()
383+
@api struct ChancePlayer end
384+
@api const CHANCE_PLAYER = ChancePlayer()
385385

386-
struct SimultaneousPlayer end
387-
const SIMULTANEOUS_PLAYER = SimultaneousPlayer()
386+
@api struct SimultaneousPlayer end
387+
@api const SIMULTANEOUS_PLAYER = SimultaneousPlayer()
388388

389-
struct Spector end
390-
const SPECTOR = Spector()
389+
@api struct Spector end
390+
@api const SPECTOR = Spector()
391391

392392
@api (env::AbstractEnv)(action, player = current_player(env))
393393

@@ -400,7 +400,7 @@ Make an independent copy of `env`,
400400
@api copy(env::AbstractEnv) = deepcopy(env)
401401
@api copyto!(dest::AbstractEnv, src::AbstractEnv)
402402

403-
@env_api nameof(env::AbstractEnv) = nameof(typeof(env))
403+
@api nameof(env::AbstractEnv) = nameof(typeof(env))
404404

405405
"""
406406
Get the action distribution of chance player.

0 commit comments

Comments
 (0)