Esempio n. 1
0
# Start the game
state1, reward, done, info = env.step(1)

# Keep base to the left and move only the ball
for i in range(10):
    state1, reward, done, info = env.step(3)
state2, reward, done, info = env.step(3)  # Ball moves one step wrt state 1

# Keep base to the left and move only the ball
for i in range(19):  #
    state3, reward, done, info = env.step(3)
state4, reward, done, info = env.step(
    3)  # Ball moves one step wrt state 3 and breaks wall

preprocessed_state0 = np.expand_dims(np.asarray(crop_state(state1)), axis=0)
encoded_state0 = AE.encode(preprocessed_state0)
flat_encoded_state0 = AE.flat_encode(preprocessed_state0)
predicted_state0 = AE.predict(preprocessed_state0)
predicted_state0 = predicted_state0.reshape(4, 84, 84)
conv_map0 = flat_encoded_state0.reshape(7, 7)

preprocessed_state00 = np.expand_dims(np.asarray(crop_state(state00)), axis=0)
encoded_state00 = AE.encode(preprocessed_state00)
flat_encoded_state00 = AE.flat_encode(preprocessed_state00)
predicted_state00 = AE.predict(preprocessed_state00)
predicted_state00 = predicted_state00.reshape(4, 84, 84)
conv_map00 = flat_encoded_state00.reshape(7, 7)

preprocessed_state1 = np.expand_dims(np.asarray(crop_state(state1)), axis=0)
encoded_state1 = AE.encode(preprocessed_state1)
flat_encoded_state1 = AE.flat_encode(preprocessed_state1)
Esempio n. 2
0
# Start the game
state1, reward, done, info = env.step(1)

# Keep base to the left and move only the ball
for i in range(10):
    state1, reward, done, info = env.step(3)
state2, reward, done, info = env.step(3)  # Ball moves one step wrt state 1

# Keep base to the left and move only the ball
for i in range(19):  #
    state3, reward, done, info = env.step(3)
state4, reward, done, info = env.step(3)  # Ball moves one step wrt state 3 and breaks wall

preprocessed_state0 = np.expand_dims(np.asarray(crop_state(state1)), axis=0)
encoded_state0 = AE.encode(preprocessed_state0)
flat_encoded_state0 = AE.flat_encode(preprocessed_state0)
predicted_state0 = AE.predict(preprocessed_state0)
predicted_state0 = predicted_state0.reshape(4,84, 84)
conv_map0 = flat_encoded_state0.reshape(7,7)

preprocessed_state00 = np.expand_dims(np.asarray(crop_state(state00)), axis=0)
encoded_state00 = AE.encode(preprocessed_state00)
flat_encoded_state00 = AE.flat_encode(preprocessed_state00)
predicted_state00 = AE.predict(preprocessed_state00)
predicted_state00 = predicted_state00.reshape(4,84, 84)
conv_map00 = flat_encoded_state00.reshape(7,7)

preprocessed_state1 = np.expand_dims(np.asarray(crop_state(state1)), axis=0)
encoded_state1 = AE.encode(preprocessed_state1)
flat_encoded_state1 = AE.flat_encode(preprocessed_state1)