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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
interface OracleInterface{ | |
function receiveRequest() external returns (uint256); | |
} | |
contract BaseContract{ | |
uint public randomNumber = 0; | |
OracleInterface public obj; | |
mapping(uint256=>bool) myRequests; |
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
# dependency inversion principle | |
########################################## | |
class FXConverter: | |
def convert(self, from_currency, to_currency, amount): | |
print(f'{amount} {from_currency} = {amount * 1.2} {to_currency}') | |
return amount * 1.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
import gym | |
# Initialize the CartPole environment with rendering mode set to 'rgb_array' | |
env = gym.make('CartPole-v0', render_mode="rgb_array") | |
# Wrap the environment with the RecordVideo wrapper to record videos | |
# The episode_trigger lambda function ensures that a video is recorded every 10 episodes | |
env = gym.wrappers.RecordVideo(env, "./vid", episode_trigger=lambda episode_id: episode_id % 10 == 0) | |
# Reset the environment to get the initial observation and additional info |