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

Commit

Permalink
Format .jl files (#69)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] authored Jun 10, 2020
1 parent 8cc3edc commit 2359850
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/environments/classic_control/cartpole.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ function RLBase.render(env::CartPoleEnv)
clearws()
setviewport(0, 1, 0, 1)
xthreshold = env.params.xthreshold
setwindow(-xthreshold, xthreshold, -.1, l + .1)
fillarea([x-.5, x-.5, x+.5, x+.5], [-.05, 0, 0, -.05])
setwindow(-xthreshold, xthreshold, -.1, l + 0.1)
fillarea([x - 0.5, x - 0.5, x + 0.5, x + 0.5], [-.05, 0, 0, -.05])
setlinecolorind(4)
setlinewidth(3)
polyline([x, x + l * sin(theta)], [0, l * cos(theta)])
setlinecolorind(2)
drawarrow(x + (a == 1) - .5, -.025, x + 1.4 * (a==1) - .7, -.025)
plotendofepisode(xthreshold - .2, l, d)
drawarrow(x + (a == 1) - 0.5, -.025, x + 1.4 * (a == 1) - 0.7, -.025)
plotendofepisode(xthreshold - 0.2, l, d)
updatews()
end
5 changes: 3 additions & 2 deletions src/environments/gym.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ function GymEnv(name::String)
error("Cannot import module 'gym'.\n\nIf you did not yet install it, try running\n`ReinforcementLearningEnvironments.install_gym()`\n")
end
gym = pyimport("gym")
pyenv = try gym.make(name)
pyenv = try
gym.make(name)
catch e
error("Gym environment $name not found.\n\nRun `ReinforcementLearningEnvironments.list_gym_env_names()` to find supported environments.\n")
end
Expand Down Expand Up @@ -113,7 +114,7 @@ end
"""
function install_gym(; packages = ["gym", "pybullet"])
# Use eventual proxy info
proxy_arg=String[]
proxy_arg = String[]
if haskey(ENV, "http_proxy")
push!(proxy_arg, "--proxy")
push!(proxy_arg, ENV["http_proxy"])
Expand Down
29 changes: 23 additions & 6 deletions src/environments/open_spiel.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import .OpenSpiel: load_game, get_type, provides_information_state_tensor,
provides_observation_tensor, dynamics, new_initial_state, chance_mode,
is_chance_node, information_state_tensor, information_state_tensor_size,
num_distinct_actions, num_players, apply_action, current_player, player_reward,
legal_actions, legal_actions_mask, rewards, history, observation_tensor_size,
observation_tensor, chance_outcomes
import .OpenSpiel:
load_game,
get_type,
provides_information_state_tensor,
provides_observation_tensor,
dynamics,
new_initial_state,
chance_mode,
is_chance_node,
information_state_tensor,
information_state_tensor_size,
num_distinct_actions,
num_players,
apply_action,
current_player,
player_reward,
legal_actions,
legal_actions_mask,
rewards,
history,
observation_tensor_size,
observation_tensor,
chance_outcomes
using StatsBase: sample, weights


Expand Down
1 change: 0 additions & 1 deletion src/environments/structs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ struct OpenSpielObs{O,D,S}
state::S
player::Int32
end

0 comments on commit 2359850

Please sign in to comment.