GithubHelp home page GithubHelp logo

codeaudit / pyfiction Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mikulaszelinka/pyfiction

0.0 3.0 0.0 9.13 MB

Python API for interactive fiction games

License: Other

Python 10.57% HTML 86.86% Shell 0.02% JavaScript 2.48% CSS 0.06%

pyfiction's Introduction

pyfiction

Python API for all kinds of text-based games.

Introduction

Text-based games, more commonly known as interactive fiction (IF), come in various formats and use different interpreters that aren't often compatible with each other.

The goal of pyfiction is to wrap the functionality of different IF simulators and to provide a universal API for text games for research purposes.

Pyfiction also includes sample agents that can learn to play the supplied text games.

Requirements

  • Python 3.6 (older versions might work but they aren't tested, Python 3.5 tested briefly)
  • text-games submodule for games 'Saving John' and 'Machine of Death'
  • keras, tensorflow and their dependencies for launching the example agents
  • selenium and chromedriver for running the HTML-based games
  • h5py for saving and loading models
  • pydot for visualising model graphs

Installation

To install the latest published version, simply run:

pip install pyfiction

To install the bleeding-edge version from this repository, run:

git clone --recursive https://github.com/MikulasZelinka/pyfiction
cd pyfiction
pip install -e .

Interface

pyfiction provides a simple agent-environment interface for text-game environments.

agent-environment interface

Simple RL interface [4]. In pyfiction, the agent calls the corresponding functions of the game environment:

  • state, actions, rewards = game.read() (left branch),
  • game.write(action) (right branch).

Examples

To run any example (from the game list below or from this list), simply run:

python file.py

on these files:

or on one of the supported games below.

Currently supported games

The following links lead to training experiments of the SSAQN agent on the supported games:

Additionally, the plan is to integrate the individual games to the OpenAI Gym, see the pull request and the text_games branch for details.

Adding new games

TODO.

Adding new HTML-based games is straightforward; refer to the already implemented games (such as Cat Simulator 2016) and to the differences between their implementations in the games and simulators folders for inspiration.

It is only necessary to a) parse the available state and actions and b) identify and numerically annotate the endings.

References

[1] Language Understanding for Text-based Games Using Deep Reinforcement Learning

[2] Deep Reinforcement Learning with a Natural Language Action Space

[3] Using reinforcement learning to learn how to play text-based games (Master thesis; defended in 09/2017)

[4] Reinforcement Learning: An Introduction

Status

Version 0.1.2, Alpha

pyfiction's People

Contributors

mikulaszelinka avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.