Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 3b32dae

Browse files
authored
Fix129 (#130)
* fix 129 * add tests * fix tests
1 parent 84f9812 commit 3b32dae

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/environments/wrappers/DefaultStateStyle.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ Reset the result of `DefaultStateStyle` without changing the original behavior.
1212
DefaultStateStyleEnv{S}(env::E) where {S,E} = DefaultStateStyleEnv{S,E}(env)
1313

1414
RLBase.DefaultStateStyle(::DefaultStateStyleEnv{S}) where {S} = S
15+
16+
RLBase.state(env::DefaultStateStyleEnv{S}) where S = state(env.env, S)
17+
RLBase.state(env::DefaultStateStyleEnv, ss::RLBase.AbstractStateStyle) = state(env.env, ss)
18+
RLBase.state(env::DefaultStateStyleEnv{S}, player) where S = state(env.env, S, player)
19+
20+
RLBase.state_space(env::DefaultStateStyleEnv{S}) where S = state_space(env.env, S)
21+
RLBase.state_space(env::DefaultStateStyleEnv, ss::RLBase.AbstractStateStyle) = state_space(env.env, ss)

test/environments/wrappers/wrappers.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121

2222
RLBase.test_interfaces!(env′)
2323
RLBase.test_runnable!(env′)
24+
25+
# fix #129
26+
env = TicTacToeEnv()
27+
s_env = state(env)
28+
@test s_env state_space(env)
29+
30+
E = DefaultStateStyleEnv{Observation{Int}()}(env) # error probably somewhere here
31+
s = state(E)
32+
@test s isa Int
33+
@test s state_space(E)
2434
end
2535

2636
@testset "MaxTimeoutEnv" begin

0 commit comments

Comments
 (0)