we made it


together we made it we made it
我们在一起就做到了,我们做到了

even though we had our backs up against the wall
即使我们走投无路也好。


and they told us
他们告诉我们

we were never going to get it
说我们永远做不到


but we took it on the road on the road
但是我们就此四处奔走

on the roooooad on the road on the road
四处奔走,四处奔走





see i think i survived the worst
看吧,我想虽然我只是在最痛苦的日子里幸存下来了,

but my life is glorious
但是我的生命依旧荣耀

but i know that i need to be hurdled
但是我知道我需要越过障碍,

and i'm so victorious take a look i'm a symbol of greatness back home

我胜利地望一眼我这个是凯旋归家的标志

as force accumalted the wind and but a believe
像疾风(accumalted 查不到)【这句翻译没看懂】


i'm so notorious didn't know i've been
我这么恶名昭彰还不知道我在

buying my bread even though we rapping now 为生计发愁纵然我们在这里玩rap


(yes)


and now when u look on my trip
现在你看看我的旅程

higher level tramping now
我走到了更高的地位




together we made it we made it
我们在一起就做到了,我们做到了

even though we had our backs up against the wall
即使我们走投无路也好。


and they told us
他们告诉我们

we were never going to get it
说我们永远做不到


but we took it on the road on the road
但是我们就此四处奔走

on the roooooad on the road on the road
四处奔走,四处奔走



when it all got started we was steadily

一切开始之时,我们还很坚定(怎么会是was,不是该were?)

just getting rejected
只是被排斥而已

and it seemed like nothing we could do
我们似乎什么也做不到

would ever get us respected
这样反而获得我们的尊重(是的,这一句非常奇怪)

and thus we was stressed
而我们压力巨大

and the worst they probably said was we're pathetic had all the pieces to that puzzle just a way to get connected
可最糟糕的还是他们可能要说我们这样很悲惨,仅仅为了保持而被困惑整的疲惫不堪


and i was fighting
我在奋斗


through every ryhme
在每一个旋律里奋斗 (没有ryhme只有rhyme,想必又是歌词错误吧)

tighting up every line never resting the question
绞紧每一条神经从不放过任何问题

and i was out of my mind
我疯了

and it finally came time to do it or let it die
最终有了机会去拼命地干

so put the chips on the table
所以就把筹码准备好吧

and told me to let it fly ohhh
告诉我自由地去飞吧

singing yea
自由地去歌唱


together we made it we made it
我们在一起就做到了,我们做到了

even though we had our backs up against the wall
即使我们走投无路也好。


and they told us
他们告诉我们

we were never going to get it
说我们永远做不到


but we took it on the road on the road
但是我们就此四处奔走

on the roooooad on the road on the road
四处奔走,四处奔走



look in case you misunderstanded excatly what i'm building
看,万一你误解了我的建树

shit that i could leave for my children
妈的,我还能把这些留给我的孩子(我怀疑原歌词是live for 而不是leave for ,因为说不通)

(children) children (children)


now i only wake up i smile to see how far i come fighting for sales on a strip to get hussle from nights
现在我醒了,我微微地笑了,为我所看见我努力的销售额而微笑了(hussle查不到这个词,应该是hustle吧)

in jail on a bench
在监狱里的长凳上,

using my muscles son (实在不知道该怎么翻译)

to count money ---
为了剩下一点点的钱而已


but now i live when i dream you see me finally getting it
但是当我梦见你看见我最后得到这一切时健在

let's make a toast to the hustle -----
为这些忙碌而干杯把

ohhhh singing
为这些忙碌而歌唱吧
import gymnasium as gym import numpy as np import time env = gym.make("MountainCar-v0") # Q-Learning settings LEARNING_RATE = 0.1 DISCOUNT = 0.95 EPISODES = 25000 SHOW_EVERY = 1000 # Exploration settings epsilon = 1 # not a constant, going to be decayed START_EPSILON_DECAYING = 1 END_EPSILON_DECAYING = EPISODES//2 epsilon_decay_value = epsilon/(END_EPSILON_DECAYING - START_EPSILON_DECAYING) DISCRETE_OS_SIZE = [20, 20] discrete_os_win_size = (env.observation_space.high - env.observation_space.low)/DISCRETE_OS_SIZE def get_discrete_state(state): discrete_state = (state - env.observation_space.low)/discrete_os_win_size return tuple(discrete_state.astype(np.int64)) # we use this tuple to look up the 3 Q values for the available actions in the q-table q_table = np.random.uniform(low=-2, high=0, size=(DISCRETE_OS_SIZE + [env.action_space.n])) # 记录成功次数 success_count = 0 for episode in range(EPISODES): state, _ = env.reset() # Gymnasium返回(state, info) discrete_state = get_discrete_state(state) if episode % SHOW_EVERY == 0: render = True print(f"Episode: {episode}, Success count: {success_count}") else: render = False done = False truncated = False episode_success = False while not done and not truncated: if np.random.random() > epsilon: # Get action from Q table action = np.argmax(q_table[discrete_state]) else: # Get random action action = np.random.randint(0, env.action_space.n) new_state, reward, done, truncated, _ = env.step(action) # Gymnasium返回5个值 new_discrete_state = get_discrete_state(new_state) # If simulation did not end yet after last step - update Q table if not done and not truncated: # Maximum possible Q value in next step (for new state) max_future_q = np.max(q_table[new_discrete_state]) # Current Q value (for current state and performed action) current_q = q_table[discrete_state + (action,)] # And here's our equation for a new Q value for current state and action new_q = (1 - LEARNING_RATE) * current_q + LEARNING_RATE * (reward + DISCOUNT * max_future_q) # Update Q table with new Q value q_table[discrete_state + (action,)] = new_q # Simulation ended - if goal position is achieved elif new_state[0] >= 0.5: # MountainCar的目标位置是0.5 q_table[discrete_state + (action,)] = 0 episode_success = True success_count += 1 print(f"We made it on episode {episode}! Total successes: {success_count}") # 强制渲染成功的过程 if not render: # 重新渲染最后几步来展示成功过程 print("Showing the successful climb...") # 重新模拟最后几步并渲染 temp_state = new_state temp_discrete_state = new_discrete_state for i in range(10): # 展示最后10步 action = np.argmax(q_table[temp_discrete_state]) temp_state, _, temp_done, temp_truncated, _ = env.step(action) temp_discrete_state = get_discrete_state(temp_state) env.render() time.sleep(0.1) if temp_done or temp_truncated: break # 在成功时暂停一下,让你能看到结果 time.sleep(1) discrete_state = new_discrete_state if render: env.render() time.sleep(0.01) # 添加小延迟让渲染更清晰 # Decaying is being done every episode if episode number is within decaying range if END_EPSILON_DECAYING >= episode >= START_EPSILON_DECAYING: epsilon -= epsilon_decay_value # 训练结束后,展示最终的学习效果 print("\nTraining completed! Showing final performance...") for i in range(5): # 展示5次成功运行 state, _ = env.reset() discrete_state = get_discrete_state(state) done = False truncated = False steps = 0 while not done and not truncated and steps < 1000: # 限制最大步数 action = np.argmax(q_table[discrete_state]) state, reward, done, truncated, _ = env.step(action) discrete_state = get_discrete_state(state) env.render() time.sleep(0.02) steps += 1 if state[0] >= 0.5: # MountainCar的目标位置是0.5 print(f"Demo {i+1}: Success in {steps} steps!") time.sleep(1) break env.close() # 保存Q-table # np.save("mountaincar_q_table.npy", q_table)逐行解读代码并写出运用的公式知识点
10-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值