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
| if (curr_s == goal) { | |
| solution.push_back(curr_move); // push current node into solution | |
| // starts from end of closed and finds the current parent while setting the curr state to that parent. Pushes these parents to the solution | |
| for (auto it = closed.rbegin(); it != closed.rend() && !(it->getState().isNullState()); ++it) { | |
| if (it->getState() == curr_move.getParent()) { | |
| solution.push_back(*it); | |
| curr_move = *it; | |
| it = closed.rbegin(); | |
| } |
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
| @commands.command(brief='Gives a random dog pic', description='Gives a random dog pic') | |
| async def dogceo(self, ctx): | |
| url = 'https://dog.ceo/api/breeds/image/random' | |
| async with aiohttp.ClientSession() as session: | |
| async with session.get(url) as r: | |
| if(r.status==200): | |
| await ctx.send(('😒\n' if (random.randint(0, 10)) < 2 else '') + (await r.json())['message']) | |
| else: | |
| await ctx.send('Something went wrong accessing the dogs') |
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
| @commands.command(brief="Rock, paper, scissors", description='Play a game of rock, paper, scissors') | |
| async def roshambo(self, ctx): | |
| message = ctx.message | |
| computer_choice = random.randint(0, 2) | |
| player_choice = 0 | |
| play = True | |
| wins = 0 | |
| losses = 0 | |
| draws = 0 | |
| games = 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
| @commands.command(brief='Eat a taco', description='Makes the cat eat a taco and increments the public taco counter') | |
| async def taco(self, ctx): | |
| # create a string from message author and query to see if they have said this command before | |
| author = '{}'.format(ctx.message.author) | |
| query = {author : {'$exists' : True}} | |
| cursor = botmain.taco_collection.find_one(query) | |
| # if author does not exist, create and set to 1 for taco count | |
| if(cursor == None): | |
| botmain.taco_collection.update_one({'_id' : botmain.taco_result['_id']}, | |
| {'$set': |
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
| @commands.command(Brief='Gets the weather', description="Gets the current weather in a city, format='=weather cityname' ") | |
| async def weather(self, ctx, *args): | |
| API_Key = MY_SPECIFIC_API_KEY_HERE | |
| city_name = '' | |
| for word in args: | |
| city_name += str(word + ' ') | |
| city_name = city_name[:-1] | |
| # Provide a valid city name | |
| url = f"http://api.openweathermap.org/data/2.5/weather?q={city_name}&appid={API_Key}" |
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
| #include <iostream> | |
| #include <fstream> | |
| #include <bitset> | |
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| for (auto s = V.begin(); s != V.end()-1; s++) { | |
| bitset<32> A = *s; | |
| auto aVal = A.to_ulong(); |