8000 Some of the car racing env from the OG GYM and a new environment by bojake · Pull Request #13 · SciSharp/Gym.NET · GitHub
[go: up one dir, main page]

Skip to content

Some of the car racing env from the OG GYM and a new environment #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adjust for changes to env interface
  • Loading branch information
bojake committed Mar 23, 2023
commit 130634684db5b54cea47fb43b99aa00921407fbe
5 changes: 2 additions & 3 deletions src/Gym.Environments/Envs/Aether/CarRacingEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,11 @@ private bool CreateTrack()
return (true);
}

public override void Close()
public override void CloseEnvironment()
{
if (_viewer != null)
{
_viewer.Close();
_viewer.Dispose();
_viewer.CloseEnvironment();
_viewer = null;
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/Gym.Environments/Envs/Classic/LEMLanderEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public override Image Render(string mode = "human")
{
if (_viewerFactory == null)
_viewerFactory = NullEnvViewer.Factory;
_viewer = _viewerFactory(VIEWPORT_W, VIEWPORT_H, "lemlander-v1");
_viewer = _viewerFactory(VIEWPORT_W, VIEWPORT_H, "lemlander-v1").GetAwaiter().GetResult();
}
}
// Define the buffer image for drawing
Expand All @@ -218,12 +218,11 @@ public override Image Render(string mode = "human")
_viewer.Render(img);
return (img);
}
public override void Close()
public override void CloseEnvironment()
{
if (_viewer != null)
{
_viewer.Close();
_viewer.Dispose();
_viewer.CloseEnvironment();
_viewer = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Gym.Tests/Envs/Aether/CarRacingEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void Run(IEnvironmentViewerFactoryDelegate factory, NumPyRandom random_st
}
finally
{
env.Close();
env.CloseEnvironment();
}
}
private object Driver(CarRacingEnv env, float[] s)
Expand Down
2 changes: 1 addition & 1 deletion tests/Gym.Tests/Envs/Classic/LEMLanderEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void Run(IEnvironmentViewerFactoryDelegate factory, NumPyRandom random_st
}
finally
{
env.Close();
env.CloseEnvironment();
}
}
[TestMethod]
Expand Down
0