This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a program of the 4th project of Nand2Tetris | |
// https://www.nand2tetris.org/project04 | |
// The program runs an infinite loop that listens to the keyboard input. | |
// When a key is pressed (any key), the program blackens the screen, i.e. | |
// writes "black" in every pixel; the screen should remain fully black as | |
// long as the key is pressed. | |
// When no key is pressed, the program clears the screen, i.e. writes "white" | |
// in every pixel; the screen should remain fully clear as long as no key is pressed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import OrderedDict | |
import numpy as np | |
from gym import GoalEnv, spaces | |
class BitFlippingEnv(GoalEnv): | |
""" | |
Simple bit flipping env, useful to test HER. | |
The goal is to flip all the bits to get a vector of ones. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import OrderedDict | |
import numpy as np | |
from gym import GoalEnv, spaces | |
class BitFlippingEnv(GoalEnv): | |
""" | |
Simple bit flipping env, useful to test HER. | |
The goal is to flip all the bits to get a vector of ones. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import numpy as np | |
import scipy.stats | |
class LinearSoftmaxAgent(object): | |
"""Act with softmax policy. Features are encoded as | |
phi(s, a) is a 1-hot vector of states.""" | |
def __init__(self, state_size, action_size): | |
self.state_size = state_size |