Skip to content

Commit

Permalink
0.1.5 - Player legends and pytorch
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjeffries committed Jan 9, 2020
1 parent 456c477 commit ca3922d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion kaggle_environments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .core import *
from . import utils

version = "0.1.4"
version = "0.1.5"

__all__ = ["environments", "evaluate", "make", "register", "utils", "version"]

Expand Down
6 changes: 6 additions & 0 deletions kaggle_environments/envs/connectx/connectx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"version": "1.0.0",
"agents": [2],
"configuration": {
"timeout": {
"description": "Seconds an agent can run before timing out.",
"type": "integer",
"minimum": 1,
"default": 5
},
"columns": {
"description": "The number of columns on the board",
"type": "integer",
Expand Down
6 changes: 2 additions & 4 deletions kaggle_environments/envs/identity/identity.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
},
"observation": {},
"action": {
"description": "The number to return as a reward.",
"type": "integer",
"minimum": 0,
"default": 0
"description": "Reward = action if number, otherwise 0.",
"type": ["number", "string", "null"]
},
"reset": {
"status": "ACTIVE"
Expand Down
9 changes: 6 additions & 3 deletions kaggle_environments/envs/identity/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ def interpreter(state, env):

# Validate and assign actions as rewards !(min <= action <= max).
for agent in state:
if agent.action < env.configuration.min or agent.action > env.configuration.max:
agent.status = f"Invalid action: {agent.action}"
value = 0
if isinstance(agent.action, (int, float)):
value = agent.action
if value < env.configuration.min or value > env.configuration.max:
agent.status = f"Invalid action: {value}"
else:
agent.reward = agent.action + \
agent.reward = value + \
gauss(0, 1) * env.configuration.noise // 1
agent.status = "DONE"

Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
gym
jsonschema
numpy
scipy
scipy
https://download.pytorch.org/whl/cpu/torch-1.3.1%2Bcpu-cp37-cp37m-linux_x86_64.whl
https://download.pytorch.org/whl/cpu/torchvision-0.4.2%2Bcpu-cp37-cp37m-linux_x86_64.whl

0 comments on commit ca3922d

Please sign in to comment.