gym_nethack package¶
Submodules¶
gym_nethack.agents module¶
-
class
gym_nethack.agents.
TestAgent
(test_policy=None, **kwargs)[source]¶ Bases:
libs.rl.core.Agent
A Keras-RL agent for purely heuristic policies, i.e., no learning done, no neural network model required.
-
backward
(reward, valid_action_indices, terminal)[source]¶ Updates the agent after having executed the action returned by forward. If the policy is implemented by a neural network, this corresponds to a weight update using back-prop.
- # Argument
- reward (float): The observed reward after executing the action returned by forward. terminal (boolean): True if the new state of the environment is terminal.
- # Returns
- List of metrics values
-
compile
()[source]¶ Compiles an agent and the underlaying models to be used for training and testing.
- # Arguments
- optimizer (keras.optimizers.Optimizer instance): The optimizer to be used during training. metrics (list of functions lambda y_true, y_pred: metric): The metrics to run during training.
-
forward
(observation, valid_action_indices)[source]¶ Takes the an observation from the environment and returns the action to be taken next. If the policy is implemented by a neural network, this corresponds to a forward (inference) pass.
- # Argument
- observation (object): The current observation from the environment.
- # Returns
- The next action to be executed in the environment.
-
policy
¶
-
gym_nethack.configs module¶
gym_nethack.conn module¶
gym_nethack.fileio module¶
gym_nethack.misc module¶
gym_nethack.nhdata module¶
-
class
gym_nethack.nhdata.
Armor
(name, type, material, buc, condition, enchantment, full_name)¶ Bases:
tuple
-
buc
¶ Alias for field number 3
-
condition
¶ Alias for field number 4
-
enchantment
¶ Alias for field number 5
-
full_name
¶ Alias for field number 6
-
material
¶ Alias for field number 2
-
name
¶ Alias for field number 0
-
type
¶ Alias for field number 1
-
-
class
gym_nethack.nhdata.
CMD
[source]¶ Bases:
object
-
APPLY
= 'a'¶
-
CAST
= 'Z'¶
-
CLOSE
= 'c'¶
-
class
DIR
[source]¶ Bases:
object
-
DOWN
= '>'¶
-
E
= 'l'¶
-
N
= 'k'¶
-
NE
= 'u'¶
-
NW
= 'y'¶
-
S
= 'j'¶
-
SE
= 'n'¶
-
SW
= 'b'¶
-
UP
= '<'¶
-
W
= 'h'¶
-
-
DROP
= 'd'¶
-
EAT
= 'e'¶
-
ENGRAVE
= 'E'¶
-
EXCHANGE
= 'x'¶
-
FIRE
= 'f'¶
-
INVENTORY
= '~'¶
-
KICK
= '\x04'¶
-
MORE
= ' '¶
-
OPEN
= 'o'¶
-
PAY
= 'p'¶
-
PICKUP
= ','¶
-
PUTON
= 'P'¶
-
QUAFF
= 'q'¶
-
QUIVER
= 'Q'¶
-
READ
= 'r'¶
-
REMOVE
= 'R'¶
-
SEARCH
= 's'¶
-
class
SPECIAL
[source]¶ Bases:
object
-
CHAT
= '#chat'¶
-
DIP
= '#dip'¶
-
FORCE
= '#force'¶
-
INVOKE
= '#invoke'¶
-
JUMP
= '#jump'¶
-
LOOT
= '#loot'¶
-
MONSTER
= '#monster'¶
-
OFFER
= '#offer'¶
-
PRAY
= '#pray'¶
-
RIDE
= '#ride'¶
-
RUB
= '#rub'¶
-
SIT
= '#sit'¶
-
TURN
= '#turn'¶
-
WIPE
= '#wipe'¶
-
-
TAKEOFF
= 'T'¶
-
TELEPORT
= '\x14'¶
-
THROW
= 't'¶
-
WAIT
= '.'¶
-
WEAR
= 'W'¶
-
WIELD
= 'w'¶
-
ZAP
= 'z'¶
-
-
class
gym_nethack.nhdata.
Item
(name, type, buc, full_name)¶ Bases:
tuple
-
buc
¶ Alias for field number 2
-
full_name
¶ Alias for field number 3
-
name
¶ Alias for field number 0
-
type
¶ Alias for field number 1
-
-
class
gym_nethack.nhdata.
Potion
(name, type, buc, use_type, full_name)¶ Bases:
tuple
-
buc
¶ Alias for field number 2
-
full_name
¶ Alias for field number 4
-
name
¶ Alias for field number 0
-
type
¶ Alias for field number 1
-
use_type
¶ Alias for field number 3
-
-
class
gym_nethack.nhdata.
Ring
(name, type, buc, condition, enchantment, full_name)¶ Bases:
tuple
-
buc
¶ Alias for field number 2
-
condition
¶ Alias for field number 3
-
enchantment
¶ Alias for field number 4
-
full_name
¶ Alias for field number 5
-
name
¶ Alias for field number 0
-
type
¶ Alias for field number 1
-
-
class
gym_nethack.nhdata.
Weapon
(name, type, material, dsize, buc, condition, enchantment, full_name)¶ Bases:
tuple
-
buc
¶ Alias for field number 4
-
condition
¶ Alias for field number 5
-
dsize
¶ Alias for field number 3
-
enchantment
¶ Alias for field number 6
-
full_name
¶ Alias for field number 7
-
material
¶ Alias for field number 2
-
name
¶ Alias for field number 0
-
type
¶ Alias for field number 1
-
gym_nethack.nhutil module¶
-
class
gym_nethack.nhutil.
Passage
(first_room, first_position)[source]¶ Bases:
object
Helper class to maintain info about map corridors and what rooms they lead to.
-
next_id
= 0¶
-
-
gym_nethack.nhutil.
assert_setup
(starting_items, inventory, cur_monster, top_line, monster_positions, stats, start_ac)[source]¶
-
gym_nethack.nhutil.
save_nh_conf
(proc_id, secret_rooms=False, character='Bar', race='Human', clvl=1, st=0, dx=0, mtype=None, create_mons=False, ac=999, inven=[], dlvl=1, lyc=None, stateffs=1, adj_mlvl=True, create_items=True, seed=-1)[source]¶