We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2 in line 1.
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
hanzi;pinyin;meaning | |
滔滔不绝;tāo tāo bù jué;parlare senza sosta, fluire ininterrottamente | |
嘲笑;cháo xiào;prendere in giro, deridere | |
讨好;tǎo hǎo;cercare di compiacere, ingraziarsi | |
郑重;zhèng zhòng;serio, solenne | |
当面;dāng miàn;in faccia, alla presenza di qualcuno | |
人家;rén jia;altra gente, gli altri | |
附和;fù hè;fare eco, assecondare | |
大伙儿;dà huǒr;tutti, noi tutti, voi tutti | |
和睦;hé mù;armonioso, in buoni rapporti |
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 wolf_goat_cabbage_qlearning import WolfGoatCabbageQLearning | |
def main(): | |
wcg_arena = WolfGoatCabbageQLearning( | |
start_state=[['🥦', '🐐', '⛵', '🐺'], [], []], | |
goal_state=[[], [], ['⛵', '🐐', '🥦', '🐺']], | |
gamma=0.8, | |
max_episodes=1000, | |
epsilon_greedy=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
class RLKey: | |
def __init__(self, k1, k2): | |
self.k1 = k1 | |
self.k2 = k2 | |
def __hash__(self): | |
return hash((tuple(frozenset(x) for x in self.k1), | |
tuple(frozenset(x) for x in self.k2))) | |
def __eq__(self, other): |
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 train(self): | |
convergence_count = 0 | |
q_s_a = defaultdict(int) | |
q_s_a_prec = copy.deepcopy(q_s_a) | |
episode = 1 | |
scores = [] | |
eps_list = [] | |
rewards = {} | |
for episode in range(1,self.max_episodes): |
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(self, state, what, where_from, where_to): | |
state[where_from].remove(what) | |
state[where_to].add(what) | |
def get_next_state(self, starting_state, action): | |
next_state = copy.deepcopy(starting_state) | |
if action == 'MOVE_PLAYER_FROM_LEFT_TO_BOAT': | |
if '⛵' in next_state[0]: |
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
class WolfGoatCabbageQLearning: | |
def __init__(self, start_state, goal_state, gamma=0.8, max_episodes=50000, | |
epsilon_greedy=True, min_epsilon=0.1, max_epsilon=1.0): | |
self.start_state = tuple(set(x) for x in start_state) | |
self.goal_state = tuple(set(x) for x in goal_state) | |
self.gamma = gamma | |
self.max_episodes = max_episodes |
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 get_reward(self, state): | |
# GOAT and WOLF cannot be left unsupervised together | |
# GOAT and CABBAGE cannot be left unsupervised together | |
if state[2] == self.goal_state[2]: | |
return 100 | |
if {'🐐', '🐺'} <= state[0] and '⛵' not in state[0]: | |
return -100 | |
if {'🐐', '🥦'} <= state[0] and '⛵' not in state[0]: | |
return -100 | |
if {'🐐', '🐺'} <= state[2] and '⛵' not in state[2]: |
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
""" | |
Have yourself a merry coding Christmas... | |
""" | |
from num2words import num2words | |
def sing(): | |
things_my_true_love_gave_to_me = [ | |
(1, 'partridge in a pear tree'), | |
(2, 'turtle doves'), |
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
Leap.loop(controllerOptions, function(frame) { | |
// Body of callback function | |
var result = ""; | |
var extendedFingers = 0; | |
if (frame.hands.length > 0) { | |
var hand = frame.hands[0]; | |
for(var f = 0; f < hand.fingers.length; f++){ | |
var finger = hand.fingers[f]; | |
if (finger.extended) extendedFingers++; | |
} |
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
<html> | |
<head> | |
<title>Leap Test</title> | |
<style type="text/css"> | |
#out { | |
font-size: 60px; | |
} | |
</style> | |
NewerOlder