Skip to content

Commit 925c738

Browse files
committed
0.1.0 - Initial Release (with TicTacToe)
1 parent 944339d commit 925c738

18 files changed

+3813
-10
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,6 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
# Temp Files
132+
temp.*

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
# kaggle-environments
1+
# [<img src="https://kaggle.com/static/images/site-logo.png" height="50" style="margin-bottom:-15px" />](https://kaggle.com) Environments
2+
3+
> **ALPHA RELEASE** - Breaking changes may be introduced!
4+
5+
```bash
6+
pip install kaggle-environments
7+
```
8+
9+
## TLDR;
10+
11+
```python
12+
from kaggle_environments import make
13+
14+
# Setup a tictactoe environment.
15+
env = make("tictactoe")
16+
17+
# Basic agent which marks the first available cell.
18+
def my_agent(obs):
19+
return [c for c in range(len(obs.board)) if obs.board[c] == 0][0]
20+
21+
# Run the basic agent against a default agent which chooses a "random" move.
22+
env.run([my_agent, "random"])
23+
24+
# Render an html ipython replay of the tictactoe game.
25+
env.render(mode="ipython")
26+
```

kaggle_environments/__init__.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2020 Kaggle Inc
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from importlib import import_module
16+
from os import listdir
17+
from .core import *
18+
from . import utils
19+
20+
version = "0.1.0"
21+
22+
__all__ = ["environments", "evaluate", "make", "register", "utils", "version"]
23+
24+
# Register Environments.
25+
26+
for name in listdir(utils.envs_path):
27+
try:
28+
env = import_module(f".envs.{name}.{name}", __name__)
29+
register(name, {
30+
"agents": getattr(env, "agents", []),
31+
"html_renderer": getattr(env, "html_renderer", None),
32+
"interpreter": getattr(env, "interpreter"),
33+
"renderer": getattr(env, "renderer"),
34+
"specification": getattr(env, "specification"),
35+
})
36+
except:
37+
pass

0 commit comments

Comments
 (0)