ngoxuanphong / ENV

Reinforcement Learning System

Home Page:https://ngoxuanphong.github.io/ENV/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VIS - Environment for Reinforcement Learning

vis is an open source Python library for developing and comparing reinforcement learning algorithms by providing a standard API to communicate between learning algorithms and environments, as well as a standard set of environments compliant with that API

Python package

Wiki Docs

Installation

We are support Python 3.7, 3.8, 3.9, 3.10 on Linux and Windows
To install the base vis library, use:

  • Using pip:

    Update later
  • Directly from source (recommended):

    git clone https://github.com/ngoxuanphong/vis.git
    cd vis
    pip install -r requirements.txt

API

import env

env.make()
# Run game
print(env.run())

# Visualization one game
env.render(Agent = env.Agent_random)

#Play with bot in game
env.render(Agent = 'human')
import env
from numba import njit
import numpy as np

@njit()
def Agent(state, agent_data):
    validActions = env.getValidActions(state)
    actions = np.where(validActions==1)[0]
    action = np.random.choice(actions)
    return action, agent_data
    
env.make()
env.run(Agent, num_game = 1000, agent_model = [0], level = 0)

env.render(Agent = Agent)

Example

Please refer to Wiki for complete usage details

Environment

vis includes 20 games, which are listed below along with the number of actions, observations, time run, win rate they have:

Game Win-lv0 win-lv1 win-lv2 Time-lv0 Time-lv1 Time-lv2 Graphics Link
Catan 2440 354 7 252 230 183 True Catan
CatanNoExchange 2491 424 22 168 1021 96 True CatanNoExchange
Century 1970 7 36 61 True Century
Durak 2540 460 15 21 True Durak
Exploding_Kitten 2044 1695 24 35 True Exploding_Kitten
Fantan 2464 114 17 31 Fantan
GoFish 2466 2517 497 9 34 13 True GoFish
Imploding_Kitten 1646 1274 62 51 True Imploding_Kitten
MachiKoro 2468 31 3 11 9 8 True MachiKoro
Poker 1100 1112 81 127 True Poker
Sheriff 2481 4 365 29 29 19 True Sheriff
Splendor 2517 21 4 105 154 85 True Splendor
Splendor_v2 2632 9 4 50 180 123 True Splendor_v2
Splendor_v3 2700 681 28 34 33 41 True Splendor_v3
StoneAge 2485 40 0 65 229 100 True StoneAge
SushiGo 2096 144 187 8 14 14 True SushiGo
TicketToRide 2017 0 84 313 True TicketToRide
TLMN 2532 766 279 23 25 31 True TLMN
WelcomeToTheDungeon_v1 2512 830 5 11 WelcomeToTheDungeon_v1
WelcomeToTheDungeon_v2 2458 889 443 8 11 23 WelcomeToTheDungeon_v2

Please refer to Wiki for more details.