Файл приключений в Колоссальной пещере: расшифровка из двоичного (?) В читаемый формат (Python)

Вам нужно перебирать элементы a.

a = ['a', 'b', 'c']
str = "a123"
found_a_string = False
for item in a:    
    if item in str:
        found_a_string = True

if found_a_string:
    print "found a match"
else:
    print "no match found"
-2
задан Sam Rubanowitz 18 March 2019 в 22:33
поделиться

1 ответ

Ничего подобного взламывать и ковыряться в классических играх.

Какая версия? Оригинал написан на Фортране и работает на PDP-11. Итак, это не тот, который у вас есть.

Возможно, у вас последняя версия OSS? https://gitlab.com/esr/open-adventure

Итак, вам нужно взглянуть на конкретную реализацию игры и взять структуры данных, которые она использует, чтобы сохранить состояние игры.

Это то, что вы хотите сделать:

git clone https://gitlab.com/esr/open-adventure.git open-adventure
make
./advent

Это запускает игру и помещает вас в нее.

Welcome to Adventure!!  Would you like instructions?

> no

You are standing at the end of a road before a small brick building.
Around you is a forest.  A small stream flows out of the building and
down a gully.

> save

I can suspend your Adventure for you so that you can resume later, but
it will cost you 5 points.

Is this acceptable?

> yes

OK

File name: saved_game

Richs-MBP:open-adventure randrews$ ls -l saved_game 
-rw-r--r--  1 randrews  staff  3192 Mar 18 19:11 saved_game
Richs-MBP:open-adventure randrews$ file saved_game
saved_game: data
Richs-MBP:open-adventure randrews$ strings saved_game
E'HTH

Все в порядке. Итак, мы идем за исходником игры.

saveresume.c - отличное место для начала.

Внутри мы находим ссылку на struct game_t в коде, который suspend() описывает игру. И эта структура определена в advent.h

Она выглядит следующим образом:

struct game_t {
    int32_t lcg_x;
    int abbnum;                  // How often to print int descriptions
    score_t bonus;               // What kind of finishing bonus we are getting
    loc_t chloc;                 // pirate chest location
    loc_t chloc2;                // pirate chest alternate location
    turn_t clock1;               // # turns from finding last treasure to close
    turn_t clock2;               // # turns from warning till blinding flash
    bool clshnt;                 // has player read the clue in the endgame?
    bool closed;                 // whether we're all the way closed
    bool closng;                 // whether it's closing time yet
    bool lmwarn;                 // has player been warned about lamp going dim?
    bool novice;                 // asked for instructions at start-up?
    bool panic;                  // has player found out he's trapped?
    bool wzdark;                 // whether the loc he's leaving was dark
    bool blooded;                // has player drunk of dragon's blood?
... it is big! ...
    obj_t link[NOBJECTS * 2 + 1];// object-list links
    loc_t place[NOBJECTS + 1];   // location of object
    int hinted[NHINTS];          // hinted[i] = true iff hint i has been used.
    int hintlc[NHINTS];          // hintlc[i] = how int at LOC with cond bit i
    int prop[NOBJECTS + 1];      // object state array */
};

И это то, что находится в вашем файле. Получите удовольствие, взяв код игры C и используя функции приостановки / возобновления, чтобы загрузить сохраненный файл и взломать его, чтобы вы напились крови драконов!

0
ответ дан Rich Andrews 18 March 2019 в 22:33
поделиться
Другие вопросы по тегам:

Похожие вопросы: