70

GitHub - Microsoft/jericho: A learning environment for Interactive Fiction games...

 5 years ago
source link: https://github.com/Microsoft/jericho
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Jericho ?Build Status PyPI version

Jericho is an environment that connects learning agents with interactive fiction games. Jericho uses Frotz and Ztools to provide a fast, python-based interface to Z-machine games.

Requirements

Linux, Python 3, and basic build tools like gcc.

Install

pip3 install --user jericho

Usage

from jericho import *
env = FrotzEnv("roms/zork1.z5", seed=12)
# Take an action in the environment using the step() fuction.
# The resulting text observation and game score is returned.
observation, score, done, info = env.step('open mailbox')
# Reset the game to start anew
env.reset()
# Game have different max scores
env.get_max_score()
# Saving the game is possible with save_str()
saved_game = env.save_str()
# Loading is just as easy
env.load_str(saved_game)

# Jericho supports visibilty into the game including viewing the RAM
env.get_ram()
# And the object tree
env.get_world_objects()
# As well as shortcuts for particular objects, such as the player
env.get_player_object()
# And their inventory
env.get_inventory()
# Or their location
env.get_player_location()

# It's also possible to teleport the player to a location
env.teleport_player(123)
# Or to teleport an object to the player
env.teleport_obj_to_player(164)
# Be careful with these methods as they can teleport objects that aren't meant to be moved.
# NOTE: after teleportation, need to look twice before description updates.

# Finally, to detect whether an action was recognized by the parser and changed the game state
env.step('hail taxi')
if env.world_changed():
  print('We found a valid action!')

Supported Games

Game Download MD5 Hash The Acorn Court acorncourt.z5 a61400439aa76f8faba3b8f01edd4a72 Adventureland Adventureland.z5 a42545bd17330ae5e6fed02270ccfb4a Adventure Advent.z5 ee2242e155fd8910921b0f8e04019a3a Afflicted afflicted.z8 064272be87de7106192b6fb743c4dfc4 Anchorhead anchor.z8 c043df8624e0e1e9fda92f1a74b6e402 The Awakening awaken.z5 9ba48c72d96ab3e7956a8570b12d34d6 Balances Balances.z5 f2cb8f94a7e8df3b850a758da26fa387 Ballyhoo ballyhoo.z3 5d54e326815b0ed3aff8efb8ff02ef2f Curses! curses.z5 f06a42a29a5a4e6aa70958c9ae4c37cd Cutthroats cutthroat.z3 216eeeba1c8017a77343dc8482f6f185 Deephome: A Telleen Adventure deephome.z5 5e56a6e5cdeecded434a8fd8012fc2c6 Detective detective.z5 822655c9be83e292e06d3d3b1d6a9734 Dragon Adventure Dragon.z5 96d314997e5d3a5a793c83845977d44d Enchanter enchanter.z3 ad3cdea88d81033fe29167688bd98c31 The Enterprise Incidents enter.z5 4c48ba2c5523d78c5f7f9b7809d16b1d Goldilocks is a FOX! gold.z5 f275ddf32ce8a9e744d53c3b99c5a658 The Hitchhiker's Guide to the Galaxy hhgg.z3 6666389f60e0c8e4ceb08242a263bb52 Hollywood Hijinx hollywood.z3 1ea91a064941a3f612b20833f0a47df7 Hunter, in Darkness huntdark.z5 253b02c8012710577085b9fd3a155cb7 Infidel infidel.z3 425fa66869309d7ed7f8ef04a492fbb7 Inhumane inhumane.z5 84d3ce7ccfafb873736490811a0cc78c The Jewel of Knowledge jewel.z5 1eef9c0fa009ca4adf4872cfc5249d45 Return to Karn karn.z5 ec55791be814db3663ad1aec0d6b7690 Leather Goddesses of Phobos lgop.z3 8241afdadbdcdb934ee06afc6ba59b67 All Quiet on the Library Front library.z5 daf57133d346442b983bd333fb586cc4 Mother Loose loose.z5 31a0c1e360dce94aa5bece5240691d17 Lost Pig LostPig.z8 aaf0b90fbb31717481c02832bf412070 The Ludicorp Mystery ludicorp.z5 646a63307f77dcdcd011f330277ae262 The Lurking Horror lurking.z3 5f42ff092a2f30471ae98150ef4da2e1 The Moonlit Tower Moonlit.z5 bf75b9651cff0e2d04302f19c443588e Monsters of Murdac Murdac.z5 570179d4f21b2f600862dbffbb5afc3e Night at the Computer Center night.z5 72125f159cccd581786ac16a2828d4e3 9:05 905.z5 4c5067169b834d247a30bb08d1039896 OMNIQuest omniquest.z5 80ea198bca425b6d819c74bfa854236e Party Foul partyfoul.z8 d221daa82708c4e54447f1a884c239ef Pentari pentari.z5 f24c6863468823b744e910ccfe997c6d Planetfall planetfall.z3 6487dc814b280f5603c53155de378d27 Plundered Hearts plundered.z3 6ae4fd54b7e55675ec7e54ec4dd26462 Reverberations reverb.z5 be6d5fa9587a079782b64739e629461f Seastalker seastalker.z3 ee339dbdbb0792f67e20bd71bafe0ea5 The Meteor, the Stone and a Long Glass of Sherbet sherbet.z5 53bf7a60017e06998cc1542cf35f76fa Sherlock sherlock.z5 35240654d83f9e7073973d338f9657b8 Snack Time! snacktime.z8 0ff228d12d7cb470dc1a8e9a5151769b Sorcerer sorcerer.z3 20f1468a058d0a6de016ae70022e651c Spellbreaker spellbrkr.z3 7a92ce19a39bedd970d0f1e296981f71 SPIRITWRAK spirit.z5 808039c4e9554bdd15d7793539b3bd97 The Temple temple.z5 22a0ddac6be15540616c10f1007197f3 Theatre theatre.z5 33dcc5085acb290d1817e07653c13480 Trinity trinity.z4 3bf1a444a1fc2057130ecb9806117233 Tryst of Fate tryst205.z5 fc65ad8d4588da92fd39871f6f7463db The Weapon weapon.z5 c632204be3849d6c5bb6f4eb5aca3cc0 Wishbringer wishbringer.z3 87ed53d854f7e57c36106fca3b9cf5a6 Raising the Flag on Mount Yo Momma yomomma.z8 5b10162a7a134e7b4c381ecedfb4bc44 Escape from the Starship Zenon zenon.z5 631cc926b4251f5a5f646d3a6bdac8c6 Zork I zork1.z5 b732a93a6244ddd92a9b9a3e3a46c687 Zork II zork2.z5 5bcd91ee055e9bd42812617571be227b Zork III zork3.z5 ffda9ee2d428fa2fa8e75a1914ff6959 Zork: The Undiscovered Underground ztuu.z5 d8e1578470cbc676e013e03d72c93141

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK