Skip to content

Commit

Permalink
Merge pull request #31 from JuliaReinforcementLearning/findmyway-patch-1
Browse files Browse the repository at this point in the history
Support Julia of a lower version
  • Loading branch information
zsunberg authored Aug 3, 2020
2 parents d7e482d + 6f1799d commit 4bd6259
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ notifications:
email: false
julia:
- 1
- 1.0
os:
- linux
- osx
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name = "CommonRLInterface"
uuid = "d842c3ba-07a1-494f-bbec-f5741b0a3e98"
authors = ["Zachary Sunberg <[email protected]> and contributors"]
version = "0.2.0"
version = "0.2.1"

[deps]
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"

[compat]
MacroTools = "0.5"
julia = "1.4"
julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
19 changes: 11 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
using CommonRLInterface
using Test

mutable struct LQREnv <: AbstractEnv
s::Float64
end

@testset "from README" begin
mutable struct LQREnv <: AbstractEnv
s::Float64
end

function CommonRLInterface.reset!(m::LQREnv)
m.s = 0.0
end

CommonRLInterface.actions(m::LQREnv) = (-1.0, 0.0, 1.0)
CommonRLInterface.actions(m::LQREnv) = [-1.0, 0.0, 1.0]
CommonRLInterface.observe(m::LQREnv) = m.s
CommonRLInterface.terminated(m::LQREnv) = false

Expand Down Expand Up @@ -40,7 +41,7 @@ MyEnv() = MyEnv(1)
function CommonRLInterface.reset!(env::MyEnv)
env.state = 1
end
CommonRLInterface.actions(env::MyEnv) = (-1, 0, 1)
CommonRLInterface.actions(env::MyEnv) = [-1, 0, 1]
CommonRLInterface.observe(env::MyEnv) = env.state
CommonRLInterface.terminated(env::MyEnv) = false
function CommonRLInterface.act!(env::MyEnv, a)
Expand All @@ -57,7 +58,7 @@ MyGame() = MyGame(1)
function CommonRLInterface.reset!(env::MyGame)
env.state = 1
end
CommonRLInterface.actions(env::MyGame) = (-1, 1)
CommonRLInterface.actions(env::MyGame) = [-1, 1]
CommonRLInterface.observe(env::MyGame) = env.state
CommonRLInterface.terminated(env::MyGame) = false
function CommonRLInterface.act!(env::MyGame, a)
Expand Down Expand Up @@ -140,7 +141,7 @@ end
end

@testset "spaces" begin
@provide CommonRLInterface.valid_actions(env::MyEnv) = (0, 1)
@provide CommonRLInterface.valid_actions(env::MyEnv) = [0, 1]
@test provided(valid_actions, env)
@test issubset(valid_actions(env), actions(env))

Expand All @@ -156,4 +157,6 @@ end
@test observations(env) == 1:10
end

include("examples/gridworld.jl")
if VERSION >= v"1.4" # not sure if this is the actual minimal version, but I know it will work
include("examples/gridworld.jl")
end

2 comments on commit 4bd6259

@findmyway
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/18848

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" 4bd6259dc5666fddd79cad34924b927970ed48e6
git push origin v0.2.1

Please sign in to comment.