This file contains hidden or 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
<?php | |
require_once('./connect-php-sdk-master/autoload.php'); | |
// Configure OAuth2 access token for authorization: oauth2 | |
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); | |
$api_instance = new SquareConnect\Api\LocationsApi(); | |
try { | |
$result = $api_instance->listLocations(); |
This file contains hidden or 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
def main(): | |
potential_roms = [] | |
for path in sys.argv[1:]: | |
for base, _, files in os.walk(sys.argv[1]): | |
potential_roms.extend([os.path.join(base, file) for file in files]) | |
print('Importing %i potential games...' % len(potential_roms)) | |
retro.data.merge(*potential_roms, quiet=False) |
This file contains hidden or 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
def merge(*args, quiet=True): | |
import retro | |
known_hashes = {} | |
for game in retro.list_games(): | |
shafile = os.path.join(retro.get_game_path(game), 'rom.sha') | |
with open(shafile) as f: | |
shas = f.read().strip().split('\n') | |
for ext, platform in retro.EMU_EXTENSIONS.items(): | |
if game.endswith('-' + platform): | |
break |
This file contains hidden or 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
while True: | |
# ... | |
rew, new_ep = move(env, 100) | |
if not new_ep and rew <= 0: | |
print('backtracking due to negative reward: %f' % rew) | |
_, new_ep = move(env, 70, left=True) |
This file contains hidden or 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
def move(env, num_steps, left=False, jump_prob=1.0 / 10.0, jump_repeat=4): | |
""" | |
Move right or left for a certain number of steps, | |
jumping periodically. | |
""" | |
_, rew, done, _ = env.step(action) | |
total_rew += rew | |
steps_taken += 1 | |
return total_rew, done |
This file contains hidden or 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
def step(self, a): | |
# ... does all the stuff | |
rew, done, info = self.compute_step(ob) | |
return ob, float(rew), bool(done), dict(info) |
This file contains hidden or 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
export DOCKER_REGISTRY="retrocontestxxxxxxxxxxxxxx" | |
docker login $DOCKER_REGISTRY \ | |
--username "xxxxxxxxxxxxx" \ | |
--password "xxxxxxxxxxxxx" | |
docker build -f rainbow-agent.docker -t $DOCKER_REGISTRY/rainbow-agent:v1 . | |
docker push $DOCKER_REGISTRY/rainbow-agent:v1 | |
retro-contest run --agent $DOCKER_REGISTRY/rainbow-agent:v1 \ |
This file contains hidden or 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 retro.scripts.playback_movie import main | |
main() |
This file contains hidden or 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
#!/usr/bin/python | |
import sys | |
import retro | |
from os import listdir | |
from os.path import isfile, join, isdir | |
def render(file): | |
movie = retro.Movie(file) |
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
Train an agent on Sonic using an open source Rainbow DQN | |
implementation. | |
""" | |
import tensorflow as tf | |
from anyrl.algos import DQN |