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
const nums = { | |
'零': 0, | |
'壹': 1, | |
'贰': 2, | |
'叁': 3, | |
'肆': 4, | |
'伍': 5, | |
'陆': 6, | |
'柒': 7, | |
'捌': 8, |
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 gym | |
from stable_baselines.common.policies import MlpPolicy | |
from stable_baselines.common.vec_env import SubprocVecEnv, DummyVecEnv | |
from stable_baselines.bench import Monitor | |
from stable_baselines import PPO2 | |
from stable_baselines.results_plotter import load_results, ts2xy | |
import os | |
import numpy as np | |
import time |
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
# 先装好 ssserver | |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | |
python get-pip.py | |
# 本地新建配置 | |
cat '{ \ | |
"server": "0.0.0.0", \ | |
"server_port": 8388, \ | |
"local_address": "127.0.0.1", \ | |
"local_port": 1080, \ |
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
// Copyright (c) 2006 Damien Miller <[email protected]> | |
// | |
// Permission to use, copy, modify, and distribute this software for any | |
// purpose with or without fee is hereby granted, provided that the above | |
// copyright notice and this permission notice appear in all copies. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
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 gym | |
import sys | |
import time | |
import pickle | |
import os | |
env = gym.make('MountainCar-v0') | |
##### |
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
function parseUrl (url) { | |
var a = document.createElement('a') | |
a.setAttribute('href', url) | |
var search = a.search | |
var query = {} | |
var kvs = search.split(/[\?&]/g) | |
kvs.forEach(function (kv) { | |
kv = kv.split('=') | |
if (kv.length === 2) { | |
query[kv[0]] = kv[1] |
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
/* DeviceUID.h | |
#import <Foundation/Foundation.h> | |
@interface DeviceUID : NSObject | |
+ (NSString *)uid; | |
@end | |
*/ | |
// Device.m |
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
/** | |
* toArray :: ArrayLike => Array | |
*/ | |
const toArray = (arrLike) => [].slice.call(arrLike, 0); | |
/** | |
* Currying a function | |
*/ |
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
class Gena { | |
constructor(config) { | |
this.currentGeneration = 0 | |
this.populations = [] | |
this.fitnesses = [] | |
this.mutateProbability = config.mutateProbability || 0.5 // 0 ~ 1 | |
this.generationsSize = config.generationsSize || 100 | |
this.populationSize = config.populationSize || 100 | |
this.doneFitness = config.doneFitness || 1 // 0 ~ 1 |
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
/** | |
* @param {Object} settings | |
* - {String} current | |
* - {Object} states | |
* - {Object} actions | |
* @constructor | |
*/ | |
function StateMachine(settings) { | |
this._current = settings.initState | |
this.actions = settings.actions |
NewerOlder