Code Monkey home page Code Monkey logo

jericho's Introduction



Documentation Status Build Status PyPI version

A lightweight python-based interface connecting learning agents with interactive fiction games.


Requirements

Linux, Python 3, Spacy, and basic build tools like gcc,make & curl.

Install

pip3 install jericho
python3 -m spacy download en_core_web_sm

Documentation

Agents

Citing Jericho

If Jericho is used in your research, please cite the following:

@article{hausknecht19,
  title={Interactive Fiction Games: A Colossal Adventure},
  author={Hausknecht, Matthew and Ammanabrolu, Prithviraj and C\^ot\'{e} Marc-Alexandre and Yuan Xingdi},
  journal={CoRR},
  year={2019},
  url={http://arxiv.org/abs/1909.05398},
  volume={abs/1909.05398}
}

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.

jericho's People

Contributors

aaptel avatar chiijlaw avatar gabrielfelipeg avatar jens321 avatar marccote avatar mathieutuli avatar mhauskn avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar nikisix avatar sanchit-agarwal avatar ysymyth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jericho's Issues

Compilation errors on MacOS Catalina

Issue

I am having issues installing Jericho using pip (that is issued when trying to install TextWorld). The compilation error I get is:

src/ztools/infodump.c:479:5: error: implicit declaration of function 'configure_inform_tables' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        configure_inform_tables(obj_data_end, &inform_version, &class_numbers_base, &class_numbers_end,
        ^
    1 warning and 1 error generated.
    make: *** [src/ztools/infodump.o] Error 1
    make: *** Waiting for unfinished jobs....

You can see the full stacktrace here.

Setup

  • Python 3.8.5 (using Anaconda)
  • MacOS Catalina (10.15.7)
  • Apple clang version 12.0.0 (clang-1200.0.32.21)

Question

Is there any plan to support MacOS as well or this package is meant to be installed on Linux only?

Windows support

I'm wondering how much work would it be to add Windows support to Jericho?

For instance, we would need to de/allocate the frotz library according to the current OS (see microsoft/TextWorld#146 (comment)).

Also, we would need to make sure we can build the frotz library as DLL (or something).

is there a way to see what the engine parses a command as?

Hello, thanks for a great code release.

Is there a way to see what the engine parses the command as?
For example when I enter env.step('w'), the game seems to parse it as env.step('west').
Here, I'd like to be able to get the parsed command, 'west', if possible.

Thank you!

linker issue: multiple definition of - first defined here

I'm having difficulty installing jericho, a dependency I need for TextWorld. Specifically, I'm having trouble building that frotz library. cd-ing into the frotz directory and running make library -j4 gives this linker error:

    /usr/bin/ranlib src/ztools.a
    /usr/bin/ld: src/dumb/dumb_input.o:(.bss+0xa8): multiple definition of `do_more_prompts'; src/dumb/dumb_init.o:(.bss+0xa8): first defined here
    /usr/bin/ld: src/dumb/dumb_input.o:(.bss+0x0): multiple definition of `f_setup'; src/dumb/dumb_init.o:(.bss+0x0): first defined here
    /usr/bin/ld: src/dumb/dumb_output.o:(.bss+0x0): multiple definition of `f_setup'; src/dumb/dumb_init.o:(.bss+0x0): first defined here
    /usr/bin/ld: src/dumb/dumb_output.o:(.bss+0xa8): multiple definition of `do_more_prompts'; src/dumb/dumb_init.o:(.bss+0xa8): first defined here
    /usr/bin/ld: src/dumb/dumb_pic.o:(.bss+0x0): multiple definition of `f_setup'; src/dumb/dumb_init.o:(.bss+0x0): first defined here
    /usr/bin/ld: src/dumb/dumb_pic.o:(.bss+0xa8): multiple definition of `do_more_prompts'; src/dumb/dumb_init.o:(.bss+0xa8): first defined here
    /usr/bin/ld: src/dumb/dumb_blorb.o:(.bss+0x40): multiple definition of `f_setup'; src/dumb/dumb_init.o:(.bss+0x0): first defined here
    /usr/bin/ld: src/dumb/dumb_blorb.o:(.bss+0xe8): multiple definition of `do_more_prompts'; src/dumb/dumb_init.o:(.bss+0xa8): first defined here

For reference:

  • running 5.12.8-arch1-1
  • gcc --version = gcc (GCC) 11.1.0
  • make --version = GNU Make 4.3
  • I have all required packages installed

I have attempted to do the following in an attempt to resolve this:

  • downgrading to different gcc and make versions, with no success there. I only downgraded to gcc-7 and gcc-8
  • resolving definitions in code by including various extern decorators. I reached a state of the code that allowed me to compile, but then I ran it with TextWorld and the game crashed and it couldn't find the variable definitions. So basically I couldn't successfully alter the code to find this issue. I didn't do an extensive code read/fix though, and my C is a little rusty. This is super hacky and it makes sense why it fails to run properly.
  • Downgrading to different versions of Jericho. This linker issue persists for all versions as far as I can tell

Is this an issue that others have encountered or is there something about my system that is causing this that I can fix?

Thanks

How to get possible actions at each step?

How do I get the possible actions at each step? the admissible_actions is None when I use this object class

infos = EnvInfos(
            inventory=True,
            description=True,
            admissible_commands=True,
            intermediate_reward=True,
            command_templates=True,
            score=True,
            max_score=True,
            extras=["walkthrough"],
        )

env.world_changed() outputs True everytime for game Reverberations

I was trying to use env.world_changed() for the game Reverberations. But, it returns True everytime even when the command really didn't lead to state change. Sample script:

import jericho
current_game_name = 'reverb'
current_game_file = current_game_name + '.z5'
t  = jericho.FrotzEnv(current_game_file, seed=12)
_,_, _, _ = t.step('verbose')

for i in range(20):
    current_game_text, score, _, _= t.step(' ')

current_game_text, score, _, _= t.step('look')
print('BEFORE LOOK: {}'.format(current_game_text))
print('\n')
current_game_text, score, _, _= t.step('get boost')
print('\"get boost\" feedback: {}'.format(current_game_text))
print('World changed? {}'.format(t.world_changed()))
print('\n')
current_game_text, score, _, _= t.step('look')
print('AFTER LOOK: {}'.format(current_game_text))

Output:

BEFORE LOOK: 
Behind the Counter
You are behind the counter at "Mr. Tasty's Pizza Parlor". To the southwest is the rest of the restaurant.


"get boost" feedback: You can't see any such thing.
World changed? True


AFTER LOOK: 
Behind the Counter
You are behind the counter at "Mr. Tasty's Pizza Parlor". To the southwest is the rest of the restaurant.

Is it an issue with the game or code? I assumed that the code would work for all the supported games in the suite.

Dictionary errors on MacOS Monterey

I am having issues running some of the methods like env.get_dictionary() and env.get_valid_actions().
Both of them are giving the error: Error: Word count doesn't match dictionary size!

This is the code snippet I'm using:

  from jericho import *

  env = FrotzEnv("../roms/jericho-game-suite/zork1.z5")
  initial_observation, info = env.reset()
  valid_actions = env.get_valid_actions()
  vocab = env.get_dictionary()

Setup

  • Python 3.9.12 (using miniconda)
  • MacOS Monterey (12.6)
  • Jericho 3.1.0

Can you please help me figure out if I'm missing anything here?

'load_bindings()' and action generation grammar parsing error

Hi there,

I was trying to generating the action by following the doc's example.

It looks like the jericho.load_bindings() doesn't work anymore, and has been changed to _load_bindings()code.

However, when I try with jericho._load_bindings(), I got another error with the dictionary parsing KeyError: 'grammar'

I'm assuming the text-game dictionary follows the pattern as suggested here, not quite sure what might be wrong with my action generation. Or there might be a new version of the text-games?

Below are my light-testing codes and errors for reference:

from jericho import *
from jericho.template_action_generator import TemplateActionGenerator

bindings = jericho._load_bindings('z-machine-games-master/jericho-game-suite/zork1.z5')
act_gen = TemplateActionGenerator(bindings)
interactive_objs = ['phone', 'keys', 'wallet']
act_gen.generate_actions(interactive_objs)

File "/Users/reneejia/opt/anaconda3/lib/python3.7/site-packages/jericho/template_action_generator.py", line 32, in __init__ grammar = rom_bindings['grammar'].split(';') KeyError: 'grammar'

Thanks in advance!

games stuck at certain steps (location ids)

I have been using Jericho for some projects, trinity always gets stuck at these steps when calling env.get_valid_actions()

TRINITY_STUCK_STEPS = set(
    [8, 13, 23, 29, 33, 35, 39, 43, 47, 49, 58, 59, 60, 65, 68, 69]
)

Actually, later I found it's the location id that matters. Here are the ones for trinity and sherlock

TRINITY_STUCK_LOC_ID = (79, 354, 144, 355, 531, 179, 371, 121, 438, 576, 323, 319, 575, 80, 316)
SHERLOCK_STUCK_LOC_ID = (111, 3, 37, 33, 93, 71, 5, 73, 1, 85, 295, 52, 57, 21, 69, 27, 12)

Few questions on using Jericho > 3.0.0

  1. Is any word outside of get_world_objects() not interactable? For instance, from what i understood so far, get_dictionary() is to extract any ‘word’ recognizable in the game and get_world_objects() is to extract any ‘object’ interactable in the game. This means any ‘word’ in get_dictionary() that is not in get_world_objects() will not be interactable, so I can discard them when selecting objects?

  2. Is there any way to get template/object index for valid actions? get_valid_actions() is probably the closest thing, but it does not provide template or object index. Is there any way to extract this?

  3. If there is a way to extract template/object index for valid actions (2), what is the object index? Is it get_world_objects() or get_dictionary()?

  4. Finally, how should I interpret fields in jericho.ZObject? The example of it in the official document is ‘Obj4: cretin Parent180 Sibling181 Child0 Attributes [7, 9, 14, 30] Properties [18, 17, 7]’. Does Parent180 refer to Obj180? Does this apply to Sibling181 and Child0? How about Attributes and Properties? Where do I get the chart or dataset for this?

Thank you in advance

Known Errors in Supported Games

Game Command Error Type
balances.z5 take her Fatal Error: Illegal Object
seastalker.z3 help claws Fatal Error: Illegal attribute
sherbet.z5 carry my Fatal Error: Illegal object

Verify quality of valid action detection

  • 905.z5
  • acorncourt.z5
  • advent.z5
  • adventureland.
  • afflicted.z8
  • anchor.z8
  • awaken.z5
  • balances.z5
  • ballyhoo.z3
  • curses.z5
  • cutthroat.z3
  • deephome.z5
  • detective.z5
  • dragon.z5
  • enchanter.z3
  • enter.z5
  • gold.z5
  • hhgg.z3
  • hollywood.z3
  • huntdark.z5
  • infidel.z3
  • inhumane.z5
  • jewel.z5
  • karn.z5
  • library.z5
  • loose.z5
  • lostpig.z8
  • ludicorp.z5
  • lurking.z3
  • moonlit.z5
  • murdac.z5
  • night.z5
  • omniquest.z5
  • partyfoul.z8
  • pentari.z5
  • planetfall.z3
  • plundered.z3
  • reverb.z5
  • seastalker.z3
  • sherlock.z5
  • snacktime.z8
  • sorcerer.z3
  • spellbrkr.z3
  • spirit.z5
  • temple.z5
  • theatre.z5
  • trinity.z4
  • tryst205.z5
  • weapon.z5
  • wishbringer.z3
  • yomomma.z8
  • zenon.z5
  • zork1.z5
  • zork2.z5
  • zork3.z5
  • ztuu.z5

Max score not achieved with walkthrough

Hi team, I had the agent go through the walkthrough for zork1.z5, and the scores don't add up to the maximum score and sometimes decrease along the way. The image below shows how the score changes over time

We also found out that the games where trajectories achieve the max_score are,

['905.z5', 'acorncourt.z5', 'adventureland.z5', 'afflicted.z8', 'awaken.z5',
 'ballyhoo.z3', 'detective.z5', 'dragon.z5', 'enter.z5', 'gold.z5',
 'huntdark.z5', 'infidel.z3', 'inhumane.z5', 'jewel.z5', 'library.z5',
 'loose.z5', 'ludicorp.z5', 'moonlit.z5', 'night.z5', 'omniquest.z5',
 'plundered.z3', 'reverb.z5', 'seastalker.z3', 'snacktime.z8', 'temple.z5',
 'weapon.z5', 'wishbringer.z3', 'zenon.z5']

whereas trajectories NOT achieving the max_score are

['zork1.z5', 'advent.z5', 'anchor.z8', 'balances.z5', 'curses.z5',
 'cutthroat.z3', 'deephome.z5', 'enchanter.z3', 'hhgg.z3', 'hollywood.z3',
 'karn.z5', 'lostpig.z8', 'lurking.z3', 'murdac.z5', 'partyfoul.z8',
 'pentari.z5', 'planetfall.z3', 'sherlock.z5', 'sorcerer.z3', 'spellbrkr.z3',
 'spirit.z5', 'theatre.z5', 'trinity.z4', 'tryst205.z5', 'yomomma.z8',
 'zork2.z5', 'zork3.z5', 'ztuu.z5']

Why do you think this is happening?

image

Getting the same walkthrough from .get_walkthrough() regardless of seed number

I keep getting the same walkthrough from .get_walkthrough() regardless of seed number. Is it normal? Then, what does seed do in Jericho? It seems like observation is the same for different seed as well under the same walkthrough. Below is my code

seed = 1

env = FrotzEnv(dir_rom)
env.seed(seed=seed)
obs, _ = env.reset()
get_walkthrough = env.get_walkthrough()

I am using jericho 3.0.4.
jericho==3.0.4

Additionally, there is no argument use_walkthrough_seed in FrotzEnv.reset()

Install Jericho on MacOS

I faced this error while installing Jericho on MacOS. pip install jericho==2.4.0

Collecting jericho==2.4.0
  Using cached jericho-2.4.0.tar.gz (1.1 MB)
    ERROR: Command errored out with exit status 1:
     command: /Users/dryu0002/opt/miniconda3/envs/main/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/p8/554sljys76v20vq9x3lyvj640000gq/T/pip-install-whrl4li9/jericho_32d99cbf407e4e18912c167420fdfb17/setup.py'"'"'; __file__='"'"'/private/var/folders/p8/554sljys76v20vq9x3lyvj640000gq/T/pip-install-whrl4li9/jericho_32d99cbf407e4e18912c167420fdfb17/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/p8/554sljys76v20vq9x3lyvj640000gq/T/pip-pip-egg-info-h_q5hocn
         cwd: /private/var/folders/p8/554sljys76v20vq9x3lyvj640000gq/T/pip-install-whrl4li9/jericho_32d99cbf407e4e18912c167420fdfb17/
    Complete output (43 lines):
    rm -f src/*.h src/*.a
    rm -f src/libfrotz.so
    rm -f src/curses/defines.h
    rm -f frotz_python_interface/libfrotz.so
    find . -name *.o -exec rm -f {} \;
    find . -name *.O -exec rm -f {} \;
    #gcc -O3 -fPIC -o src/common/buffer.o -c src/common/buffer.c
    #gcc -O3 -fPIC -o src/common/err.o -c src/common/err.c
    #gcc -O3 -fPIC -o src/common/fastmem.o -c src/common/fastmem.c
    #gcc -O3 -fPIC -o src/common/files.o -c src/common/files.c
    gcc -O3 -fPIC -I/opt/local/include -o src/common/buffer.o -c src/common/buffer.c
    gcc -O3 -fPIC -I/opt/local/include -o src/common/err.o -c src/common/err.c
    gcc -O3 -fPIC -I/opt/local/include -o src/common/files.o -c src/common/files.c
    gcc -O3 -fPIC -I/opt/local/include -o src/common/fastmem.o -c src/common/fastmem.c
    src/common/buffer.c:21:20: fatal error: string.h: No such file or directory
     #include <string.h>
                        ^
    compilation terminated.
    src/common/files.c:21:19: fatal error: stdio.h: No such file or directory
     #include <stdio.h>
                       ^
    src/common/fastmem.c:25:19: fatal error: stdio.h: No such file or directory
     #include <stdio.h>
                       ^
    compilation terminated.
    compilation terminated.
    In file included from src/common/err.c:21:0:
    src/common/frotz.h:16:20: fatal error: signal.h: No such file or directory
     #include <signal.h>
                        ^
    compilation terminated.
    make: *** [src/common/fastmem.o] Error 1
    make: *** Waiting for unfinished jobs....
    make: *** [src/common/files.o] Error 1
    make: *** [src/common/buffer.o] Error 1
    make: *** [src/common/err.o] Error 1
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/p8/554sljys76v20vq9x3lyvj640000gq/T/pip-install-whrl4li9/jericho_32d99cbf407e4e18912c167420fdfb17/setup.py", line 27, in <module>
        subprocess.check_call(['make', 'library', '-j', '4'], cwd=FROTZPATH)
      File "/Users/dryu0002/opt/miniconda3/envs/main/lib/python3.7/subprocess.py", line 363, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['make', 'library', '-j', '4']' returned non-zero exit status 2.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/89/15/c0c5cb4bd06973af85545333b549458ddb620094b152852310915f892bb6/jericho-2.4.0.tar.gz#sha256=4e551c31f32adbc5606c967bf70aa2aa22e1793208ce75b6c077b013d4a089cf (from https://pypi.org/simple/jericho/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement jericho==2.4.0
ERROR: No matching distribution found for jericho==2.4.0

If I clone the git and use cd jericho; pip3 install ., I face the same problem

My set up is,

  • MacOS Big Sur Version 11.0.1
  • Python 3.7.9
  • gcc 4.8.5
  • Xcode 12.4

Or, is there any installation documents for MacOS?

Thank you in advance

Missing ends of words?

Hi,
When trying to print the dictionary in Zork for example, only the first 6 letters are returned.

Any ideas why this may be happening?
Thanks!

Sample code (used this zork z5 file, as there was no link on this site).

from jericho import *
env = FrotzEnv("zork1.z5", seed=12)
initial_state = env.reset()
print(env.get_dictionary())

yields

[$ve, ., ,, ", a, across, activa, advent, advert, again, air, air-p, all, altar, an, ancien, and, answer, antiqu, apply, around, art, ask, at, attach, attack, aviato, awake, away, ax, axe, back, bag, banish, bar, bare, barf, barrow, basket, bat, bathe, bauble, beauti, beetle, begone, behind, bell, below, beneat, bird, birds, bite, black, blade, blast, blessi, block, bloody, blow, blue, board, boarde, boards, boat, bodies, body, bolt, bones, book, bookle, books, bottle, box, bracel, branch, brandi, brass, break, breath, brief, broken, brown, brush, bubble, bug, buoy, burn, burned, burnin, but, button, cage, canary, candle, canvas, carpet, carry, carved, case, casket, cast, catch, chain, chalic, chant, chase, chasm, chest, chests, chimne, chomp, chuck, chute, clean, clear, cliff, cliffs, climb, clockw, close, clove, coal, coffin, coil, coins, coloni, come, comman, consum, contai, contro, count, cover, crack, crawlw, cretin, cross, crysta, cup, curse, cut, cyclop, d, dam, damage, damn, dark, dead, deflat, derang, descri, destro, diagno, diamon, dig, dinner, dirt, disemb, disenc, dispat, dive, dome, donate, door, douse, down, drink, drip, drive, driver, drop, dryer, dumbwa, dusty, e, east, eat, echo, egg, egypti, elonga, elvish, emeral, enamel, enchan, encrus, engrav, enormo, enter, evil, examin, except, exit, exorci, exquis, exting, eye, fall, fantas, fasten, fcd#, fear, feeble, feed, feel, fence, fermen, fiends, fierce, fight, figuri, filch, fill, find, fine, finepr, firepr, fix, flamin, flathe, flip, float, floor, fluore, follow, foobar, food, footpa, for, forbid, force, ford, forest, fork, free, freeze, frigid, froboz, from, front, frotz, fry, fuck, fudge, fumble, g, garlic, gas, gate, gates, gaze, get, ghosts, giant, give, glamdr, glass, glue, go, gold, golden, gothic, grab, graces, granit, grate, gratin, grease, green, ground, group, grue, guide, guideb, gunk, h2o, hand, hand-, hands, hatch, head, heap, hello, hemloc, hemp, her, here, hi, hide, him, hit, hold, hop, hot, house, huge, hungry, hurl, hurt, i, ignite, imbibe, impass, in, incant, incine, inflat, injure, inscri, insert, inside, intnum, into, invent, invisi, is, it, ivory, jade, jewel, jewele, jewels, jump, key, kick, kill, kiss, kitche, knife, knives, knock, l, label, ladder, lake, lamp, land, lanter, large, launch, leaf, leafle, leak, lean, leap, leathe, leave, leaves, ledge, letter, lid, lift, light, liquid, liquif, listen, lock, long, look, lose, lower, lowere, lubric, lunch, lungs, lurkin, machin, magic, mail, mailbo, make, man, mangle, manual, map, marble, massiv, match, matchb, matche, materi, me, melt, metal, mirror, molest, monste, mounta, mouth, move, mumble, murder, myself, n, nail, nails, narrow, nasty, ne, nest, no, north, northe, northw, nut, nw, odor, odysse, of, off, offer, oil, old, on, one, onto, open, orcris, orient, out, over, overbo, own, owners, ozmoo, page, paint, painti, pair, panel, paper, parchm, passag, paste, pat, patch, path, pdp1, peal, pedest, pepper, person, pet, pick, piece, pierce, pile, pines, pipe, place, plasti, platin, play, plug, plugh, poke, poseid, pot, pour, pray, prayer, press, print, procee, pull, pump, punctu, pursue, push, put, q, quanti, quit, raft, rail, railin, rainbo, raise, ramp, range, rap, rape, read, red, reflec, releas, remain, remove, repair, repent, reply, restar, restor, ricket, ring, river, robber, rocky, roll, rope, rub, rug, run, rusty, s, sack, sailor, sand, sandwi, sapphi, save, say, scarab, scepte, sceptr, score, scream, screw, screwd, script, se, search, seawor, secure, see, seedy, seek, self, send, set, shady, shake, sharp, sheer, shit, shout, shovel, shut, sigh, silent, silver, sinist, sit, skelet, skim, skip, skull, slag, slay, slice, slide, small, smash, smell, smelly, sniff, solid, song, songbi, south, southe, southw, spill, spin, spirit, spray, squeez, stab, stairc, stairs, stairw, stand, stare, startl, stay, steep, step, steps, stilet, stone, storm, strang, stream, strike, stuff, super, superb, surpri, surrou, suspic, sw, swallo, swim, swing, switch, sword, table, take, talk, tan, taste, taunt, teeth, tell, temple, the, them, then, thief, thiefs, throug, throw, thru, thrust, tie, timber, to, tomb, tool, toolch, tools, tooth, torch, toss, touch, tour, trail, trap, trap-, trapdo, treasu, tree, trees, triden, troll, trophy, trunk, tube, tug, turn, twisti, u, ulysse, unatta, under, undern, unfast, unhook, unlock, unrust, unscri, untie, up, useles, using, valve, vampir, verbos, versio, viciou, viscou, vitreo, w, wade, wait, wake, walk, wall, walls, water, wave, wear, west, what, whats, where, white, win, wind, windin, window, winnag, wish, with, wooden, wrench, writin, xyzzy, y, yank, yell, yellow, yes, z, zork, zorkmi, zzmgck]

Tracking Incomplete Walkthroughs for Supported Games

Here's a list of the supported games for which we have a walkthrough.

python tools/test_games.py roms/*

roms/905.z5           PASS
roms/acorncourt.z5    PASS
roms/advent.z5        PASS
roms/adventureland.z5 PASS
roms/afflicted.z8     PASS
roms/anchor.z8        FAIL	Done but score 99/100
roms/awaken.z5        PASS
roms/balances.z5      FAIL	Done but score 50/51
roms/ballyhoo.z3      PASS
roms/curses.z5        FAIL	Done but score 450/550
roms/cutthroat.z3     PASS
roms/deephome.z5      PASS
roms/detective.z5     PASS
roms/dragon.z5        PASS
roms/enchanter.z3     PASS
roms/enter.z5         PASS
roms/gold.z5          PASS
roms/hhgg.z3          PASS
roms/hollywood.z3     PASS
roms/huntdark.z5      PASS
roms/infidel.z3       PASS
roms/inhumane.z5      PASS
roms/jewel.z5         PASS
roms/karn.z5          PASS
roms/lgop.z3          /data/src/jericho/jericho/jericho.py:399: UnsupportedGameWarning: Game 'roms/lgop.z3' is not fully supported. Score, move, change detection will be disabled.
  warnings.warn(msg, UnsupportedGameWarning)
SKIP	Unsupported game
roms/library.z5       PASS
roms/loose.z5         PASS
roms/lostpig.z8       FAIL	Done but score 6/7
roms/ludicorp.z5      PASS
roms/lurking.z3       PASS
roms/moonlit.z5       PASS
roms/murdac.z5        FAIL	Done but score 249/250
roms/night.z5         PASS
roms/omniquest.z5     PASS
roms/partyfoul.z8     PASS
roms/pentari.z5       PASS
roms/planetfall.z3    PASS
roms/plundered.z3     PASS
roms/reverb.z5        PASS
roms/seastalker.z3    PASS
roms/sherlock.z5      PASS
roms/snacktime.z8     PASS
roms/sorcerer.z3      PASS
roms/spellbrkr.z3     PASS
roms/spirit.z5        PASS
roms/temple.z5        PASS
roms/theatre.z5       FAIL	Done but score 47/50
roms/trinity.z4       PASS
roms/tryst205.z5      PASS
roms/weapon.z5        PASS
roms/wishbringer.z3   PASS
roms/yomomma.z8       FAIL	Done but score 34/35
roms/zenon.z5         PASS
roms/zork1.z5         PASS
roms/zork2.z5         PASS
roms/zork3.z5         PASS
roms/ztuu.z5          PASS

Environment stuck in a state of Zork1

The environment get stuck when trying to get_valid_actions() after loading this state and applying step('put sack in egg').

The state is attached by a pickle file state.pickle.zip, and the following code can reproduce the problem.

import jericho
import pickle

env = jericho.FrotzEnv('zork1.z5')
with open('state.pickle', 'rb') as f:
    state = pickle.load(f)
env.set_state(state)

env.step('put sack in egg')
env.get_valid_actions() # stuck here

Score underflow in some games with negative rewards

Some games can give negative rewards for particular commands with no limit on how many you can get.

For instance, in dragon.z5, players can type rescue to put back in the game any lost possessions. Doing so incurs a penalty of 2 points. Here's a simple program that shows the underflowing behavior.

import matplotlib.pyplot as plt

import jericho

env = jericho.FrotzEnv("./dragon.z5")

SIZEOF_CHAR = 2**8

scores = []
for i in range(SIZEOF_CHAR):
    obs, score, done, infos = env.step("rescue")
    scores.append(infos["score"])

print(env.step("score")[0])

plt.title("Score is underflowing in dragon.z5")
plt.plot(scores, label="score")
plt.plot((SIZEOF_CHAR / 4, SIZEOF_CHAR / 4), (-255, 255), color="red", linestyle="dashed")
plt.plot((3*SIZEOF_CHAR / 4, 3*SIZEOF_CHAR / 4), (-255, 255), color="red", linestyle="dashed", label="underflow")
plt.legend()

plt.savefig("dragon_score_underflow.png")

plt.show()

The above code will generate this graph where we can see the underflowing happening.
dragon_score_underflow

Also, when the command score is sent after all those rescue commands we get
You have so far scored -512 out of a possible 25, in 257 turns.
This means that the game can support bigger negative scores. Actually, the Z-Machine uses short numbers to store the score which should be reflected here: https://github.com/microsoft/jericho/blob/master/frotz/src/games/dragon.c#L76-L78

Running tests

What command are you guys using to run tests? Might want to add that to the Readme.md as well

So far, I've just tried:

(default) jericho ➤ python -m unittest tests

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

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.