Ejemplo n.º 1
0
    def main_frame(self):
        done = False

        options = [Option(self.screen, "Play", (155, 300), self.color_manager),
                   Option(self.screen, "Settings", (123, 340), self.color_manager),
                   Option(self.screen, "Mute", (145, 380), self.color_manager),
                   Option(self.screen, "Exit", (159, 420), self.color_manager)]

        while not done:
            self.screen.fill(color=self.color_manager.MENU_COLOR)
            logo = pygame.image.load("pictures/logo.png")
            self.screen.blit(logo, (50, 50))
            background_logo = pygame.image.load("pictures/menu_background.png")
            self.screen.blit(background_logo, (0, 0))

            for option in options:
                if option.rect.collidepoint(pygame.mouse.get_pos()):
                    option.hovered = True
                else:
                    option.hovered = False
                option.draw()

            for event in pygame.event.get():
                if event.type == pygame.MOUSEBUTTONDOWN:
                    for option in options:
                        if option.rect.collidepoint(pygame.mouse.get_pos()):
                            if option.text == "Play":
                                self.effect_music.play("music/button_click.mp3")
                                game(self.screen, self.color_manager, self.config_data, self)
                            elif option.text == "Settings":
                                self.effect_music.play("music/button_click.mp3")
                                settings = Settings(self.screen, None, self, self.config_data, self.background_musik, self.effect_music, self.color_manager, "menu", 100, self.screen)
                                th = Thread(target=settings.main)
                                th.start()
                                return
                            elif option.text == "Mute":
                                self.effect_music.play("music/button_click.mp3")
                                self.background_musik.set_volume(0)
                                self.effect_music.set_volume(0)
                                self.config_data["Audio_Settings"]["muted"] = True
                                option.text = "Unmute"
                                option.pos = (122, 380)
                                option.set_rect()
                            elif option.text == "Unmute":
                                self.effect_music.play("music/button_click.mp3")
                                self.background_musik.set_volume(self.audio_settings["menu_background"])
                                self.effect_music.set_volume(self.audio_settings["effects"])
                                self.config_data["Audio_Settings"]["muted"] = False

                                option.text = "Mute"
                                option.pos = (145, 380)
                                option.set_rect()
                            elif option.text == "Exit":
                                self.effect_music.play("music/button_click.mp3")
                                done = True
                                Close_Game(self.config_data)
                if event.type == pygame.QUIT:
                    Close_Game(self.config_data)
            pygame.display.flip()
            self.clock.tick(self.fps)
Ejemplo n.º 2
0
 def __init__(self):
     self.data = Interpreter()
     self.difficulties = ['easy', 'normal', 'hard']
     self.difficultySelected = self.data.getParameter('difficulty')
     self.musicValue = self.data.getParameter('music')
     self.sfxValue = self.data.getParameter('sfx')
     self.buttons = []
     self.menuButtons = []
     self.bigButtons = []
     self.sliders = []
     self.texts = {}
     self.images = []
     self.logo = pygame.image.load('../Assets/menuAssets/logo.png')
     self.logoPos = [5, 0]
     self.animBool = True
     # self.sfxValue = self.data.getParameter('sfx')
     # self.musicValue = self.data.getParameter('music')
     self.loadImages()
     self.mainMenu()
     self.game = game(self)
     self.textGui = textGui()
     self.menuPage = {
         'new': False,
         'load': False,
         'options': False,
         'credits': False,
         'quit': False
     }
     self.screen = pygame.display.set_mode((720, 480))
     self.backgroundMenu = False
     self.sound = Sound()
     self.sound.playMusic(0, 2)
Ejemplo n.º 3
0
def some_random_games_first():

    for episode in range(10):

        env = game()
        env.reset()
        first = True
        for _ in range(goal_steps):

            action = random.randrange(0, 4)

            if first:
                first = False
                action = 2

            env.render()
            observation, reward, done, info = env.step(action)
            a = 0
            if done: break
Ejemplo n.º 4
0
soup = BeautifulSoup(page.content, 'html.parser')
rows = soup.find_all('tr')

refined_org = []
refined = []

for it in rows:
    ID = it.get("id")
    if ID == "row_":
        f = it.find('a', class_="primary")
        y = it.find('span', class_="smallerfont dull")
        r = it.find('td', class_="collection_rank")
        year = "N/A"
        if y is not None:
            year = y.text.strip("()")
        g = game(f.text, year, "".join(r.text.split()), f["href"])
        refined_org.append(g)

for item in refined_org:
    if (item.isBoardGame()):
        refined.append(item)

for item in range(len(refined)):
    print(f"{item} -> {refined[item].display()}")

option = input("Which option did you mean? [submit number]: ")
selected = refined[int(option)]
print(f"Selected: {selected.name}")

SECOND_URL = f"https://api.geekdo.com/xmlapi/boardgame/{selected.getGameId()}"
detailspage = requests.get(SECOND_URL)
Ejemplo n.º 5
0
#modified to fit our self-created observations/input layer and snake game.

from Game import Game as game
import pygame
from pygame.locals import *
import random
import tflearn
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
from statistics import median, mean
from collections import Counter
import numpy as np

#env creating the game instance and a reset.
env = game()
env.reset()

#setting initial value for action.
action = -1

#learning rate
LR = 1e-3

#goal steps for the snake game.
goal_steps = 300

#score requirement for the initial dataset, goes up with the mean of new data.
score_requirement = 50

#games to be played for each generation.
Ejemplo n.º 6
0
    try:
        name = sys.argv[2]
        delete_file(name)
    except IndexError:
        print(" А стираем то что?")
elif command == 'copy':
    try:
        name = sys.argv[2]
        new_name = sys.argv[3]
        copy_file(name, new_name)
    except IndexError:
        print("Что копируем и куда?")
elif command == 'cd':
    try:
        name = sys.argv[2]
        cd(name)
    except IndexError:
        print(' А на какую директорию меняем?')
elif command == "game":
    game()

elif command == 'help':
    print("'list'- список файлов и папок")
    print("'create_file'- создание файла")
    print("'create_folder'- создание папки")
    print("'delete'- удаление файла или папки")
    print("'copy'- копирование файла или папки")
    print("'cd'- смена рабочей директории")
    print("'game'- игра")
save_info('Окончание работы')
Ejemplo n.º 7
0
async def process_message(message):
    channel_id = str(message.channel.id)
    if message.content[0] == COMMANDS_PREFIX:  #is command
        args = message.content.split(' ')
        if args[0] == f'{COMMANDS_PREFIX}start_game':
            game_exists = False

            res = ACTIVE_GAMES.get(channel_id, False)
            if res == False:
                game_exists = False
            else:
                game_exists = True

            if game_exists:
                afk = not ACTIVE_GAMES[channel_id].is_alive()
            else:
                afk = True

            if not afk:
                await lock.acquire()
                await message.channel.send(Resources.GAME_ALREADY_RUNNING)
                lock.release()
                return

            if len(args) == 1:
                ACTIVE_GAMES[channel_id] = game(message.author.id)

                ACTIVE_GAMES[channel_id].new_message([message.id])

                ACTIVE_GAMES[channel_id].generate_map()
                rendered = ACTIVE_GAMES[channel_id].render_to_emodji()
                task = asyncio.create_task(
                    send_pole_rendered(message.channel, rendered))
                await task

                return

            private = False

            if 'private' in args:
                private = True
            size = False
            n_bombs = False
            for i in range(1, len(args)):
                if 'X' in args[i]:
                    pr = args[i].split('X')
                    if len(pr) != 2:
                        await lock.acquire()
                        await message.channel.send(Resources.HELP_START)
                        lock.release()
                        return
                    try:
                        size = (int(pr[0]), int(pr[1]))
                    except:
                        await lock.acquire()
                        await message.channel.send(Resources.HELP_START)
                        lock.release()
                        return
                else:
                    try:
                        n_bombs = int(args[i])
                    except:
                        pass
            if size == False:
                if n_bombs == False:
                    gm = game(message.author.id, private=private)
                else:
                    gm = game(message.author.id,
                              number_of_bombs=n_bombs,
                              private=private)

            elif n_bombs == False:
                try:
                    gm = game(message.author.id, size, private=private)
                except:
                    await lock.acquire()
                    await message.channel.send(
                        f'Min size:{MIN_SIZE}, Max size:{MAX_SIZE}')
                    lock.release()
                    return
            else:
                try:
                    gm = game(message.author.id,
                              size,
                              n_bombs,
                              private=private)
                except:
                    await lock.acquire()
                    await message.channel.send(
                        f'Min size:{MIN_SIZE}, Max size:{MAX_SIZE}')
                    lock.release()
                    return

            gm.new_message([message.id])

            ACTIVE_GAMES[channel_id] = gm
            ACTIVE_GAMES[channel_id].generate_map()
            rendered = ACTIVE_GAMES[channel_id].render_to_emodji()
            task = asyncio.create_task(
                send_pole_rendered(message.channel, rendered))
            await task

            return

        elif args[0] == f'{COMMANDS_PREFIX}end_game':
            try:
                ACTIVE_GAMES[channel_id]
            except:
                await lock.acquire()
                await message.channel.send(Resources.NO_ACTIVE_GAMES)
                lock.release()
                return
            await lock.acquire()
            if ACTIVE_GAMES[channel_id].user_id != message.author.id:
                return

            ACTIVE_GAMES[channel_id].new_message([message.id])

            await message.channel.send(Resources.GAME_ENDED)

            ids = ACTIVE_GAMES[channel_id].last_messages.copy()
            del ACTIVE_GAMES[channel_id]
            lock.release()
            task = asyncio.create_task(
                delete_prev_messages(message.channel, ids))
            await task

        elif args[0] == f'{COMMANDS_PREFIX}open' or args[
                0] == f'{COMMANDS_PREFIX}o':
            try:
                ACTIVE_GAMES[channel_id]
            except:
                return

            if ACTIVE_GAMES[channel_id].private and ACTIVE_GAMES[
                    channel_id].user_id != message.author.id:
                return

            ACTIVE_GAMES[channel_id].new_message([message.id])

            if len(args) != 3:
                await lock.acquire()
                await message.channel.send(Resources.XY)
                lock.release()
                return

            position = False
            try:
                position = (int(args[1]) - 1, int(args[2]) - 1)
            except:
                await lock.acquire()
                await message.channel.send(
                    "Ok...F*****g values must be inputted")
                lock.release()
                return

            res = ACTIVE_GAMES[channel_id].open_tile(position)
            rendered = ACTIVE_GAMES[channel_id].render_to_emodji()

            await send_pole_rendered(message.channel, rendered)

            if not res:
                return
            if ACTIVE_GAMES[channel_id].is_alive():

                if ACTIVE_GAMES[channel_id].check_win():
                    await lock.acquire()
                    await message.channel.send(Resources.WIN)
                    ids = ACTIVE_GAMES[channel_id].last_messages.copy()
                    del ACTIVE_GAMES[channel_id]
                    lock.release()
                    task = asyncio.create_task(
                        delete_prev_messages(message.channel, ids))
                    await task

            else:
                await lock.acquire()
                await message.channel.send(Resources.GAMEOVER)
                try:
                    ids = ACTIVE_GAMES[channel_id].last_messages.copy()
                    del ACTIVE_GAMES[channel_id]
                except:
                    return
                lock.release()
                task = asyncio.create_task(
                    delete_prev_messages(message.channel, ids))
                await task

        elif args[0] == f'{COMMANDS_PREFIX}put_flag' or args[
                0] == f'{COMMANDS_PREFIX}pf':
            try:
                ACTIVE_GAMES[channel_id]
            except:
                return

            if ACTIVE_GAMES[channel_id].private and ACTIVE_GAMES[
                    channel_id].user_id != message.author.id:
                return

            ACTIVE_GAMES[channel_id].new_message([message.id])

            if len(args) != 3:
                await lock.acquire()
                await message.channel.send(Resources.XY)
                lock.release()
                return

            position = False
            try:
                position = (int(args[1]) - 1, int(args[2]) - 1)
            except:
                await lock.acquire()
                await message.channel.send(
                    "Ok...F*****g values must be inputted")
                lock.release()
                return

            res = ACTIVE_GAMES[channel_id].put_flag(position)
            rendered = ACTIVE_GAMES[channel_id].render_to_emodji()

            await send_pole_rendered(message.channel, rendered)

            if not res:
                return
            if ACTIVE_GAMES[channel_id].is_alive():

                if ACTIVE_GAMES[channel_id].check_win():
                    await lock.acquire()
                    await message.channel.send(Resources.WIN)
                    ids = ACTIVE_GAMES[channel_id].last_messages.copy()
                    del ACTIVE_GAMES[channel_id]
                    lock.release()
                    task = asyncio.create_task(
                        delete_prev_messages(message.channel, ids))
                    await task

            else:
                await lock.acquire()
                await message.channel.send(Resources.GAMEOVER)
                ids = ACTIVE_GAMES[channel_id].last_messages.copy()
                del ACTIVE_GAMES[channel_id]
                lock.release()
                task = asyncio.create_task(
                    delete_prev_messages(message.channel, ids))
                await task

        elif args[0] == f'{COMMANDS_PREFIX}remove_flag' or args[
                0] == f'{COMMANDS_PREFIX}rf':
            try:
                ACTIVE_GAMES[channel_id]
            except:
                return

            if ACTIVE_GAMES[channel_id].private and ACTIVE_GAMES[
                    channel_id].user_id != message.author.id:
                return

            ACTIVE_GAMES[channel_id].new_message([message.id])

            if len(args) != 3:
                await lock.acquire()
                await message.channel.send(Resources.XY)
                lock.release()
                return

            position = False
            try:
                position = (int(args[1]) - 1, int(args[2]) - 1)
            except:
                await lock.acquire()
                await message.channel.send(
                    "Ok...F*****g values must be inputted")
                lock.release()
                return

            res = ACTIVE_GAMES[channel_id].remove_flag(position)
            rendered = ACTIVE_GAMES[channel_id].render_to_emodji()

            await send_pole_rendered(message.channel, rendered)

            if not res:
                return

        elif args[0] == f'{COMMANDS_PREFIX}help':
            await lock.acquire()
            await message.channel.send(Resources.HELP + '\n' +
                                       Resources.HELP_START)
            lock.release()
            return
def cadbury(data):
    """
    Searches the input string for keywords, or commands.
    If keywords are found, it calls appropriate function.
    List of functions:
    (1) Open maps for a place
    (2) Play Game
    (3) Tell the time.
    (4) Google, or search for a string online.
    (5) Open Google
    (6) Play Song on Youtube
    (7) Reading News feed 
    """
    #Splitting each sentence in a list of words.
    word_list = word_tokenize(data)

    #Setting up stop_words: words that are redundant.
    stop_words = set(stopwords.words('english'))

    #Creating space for a list of sentences without stop_words.
    if "search" not in word_list and "google" not in word_list and "Search" not in word_list and "Google" not in word_list:
        filtered_sentence = [w for w in word_list if not w in stop_words]
    else:
        filtered_sentence = [w for w in word_list]

    if ("bored" in filtered_sentence):
        speak("Let's play a game then!!")
        game()
    elif 'time' in filtered_sentence:
        speak(time.strftime("%A") + " " + str(datetime.datetime.now())[:16])
    elif 'song' in filtered_sentence and filtered_sentence.index(
            'play') < filtered_sentence.index('song'):
        filtered_sentence = [
            w for w in filtered_sentence
            if w != "called" and w != "named" and w != "titled"
        ]
        pos = filtered_sentence.index('song') + 1
        speak("Opening Youtube Searches for {}".format(filtered_sentence[pos]))
        playSong(filtered_sentence[pos])
    elif 'game' in filtered_sentence and filtered_sentence.index(
            'play') < filtered_sentence.index('game'):
        game()
    elif 'google' in filtered_sentence or "Google" in filtered_sentence:
        if len(filtered_sentence) > 1:
            if 'open' in filtered_sentence and 'google' in filtered_sentence and filtered_sentence.index(
                    'open') < filtered_sentence.index('google'):
                google()
            if 'open' in filtered_sentence and 'Google' in filtered_sentence and filtered_sentence.index(
                    'open') < filtered_sentence.index('Google'):
                google()
            else:
                pos = 0
                if 'google' in filtered_sentence:
                    pos = filtered_sentence.index('google') + 1
                elif 'Google' in filtered_sentence:
                    pos = filtered_sentence.index('Google') + 1
                if 'word' in filtered_sentence and filtered_sentence[
                        -1] != 'word':
                    filtered_sentence = [
                        w for w in filtered_sentence if w != "word"
                    ]

                search_string = ''.join(filtered_sentence[pos:])
                google_search(search_string)
        else:
            speak("If you want me to open google, say 'open google'")
            speak("If you want me to search for a word," "say 'google <word>'")
    elif 'search' in filtered_sentence:
        if filtered_sentence[-1] == "search":
            speak("What would you like me to search?")
            for j in range(5):
                search_string = hear()
                if (search_string != 'error'):
                    google_search(search_string)
                    break
            return None
        pos = filtered_sentence.index('search') + 1
        search_string = " ".join(filtered_sentence[pos:])
        google_search(search_string)
    elif 'location' in filtered_sentence:
        if filtered_sentence[-1] == "location":
            speak("What place should I look for?")
            for j in range(5):
                location = hear()
                if (location != "error"):
                    maps(location)
                    break
            return None

        pos = filtered_sentence.index('location') + 1
        loc = "".join(filtered_sentence[pos:])
        maps(loc)
    elif 'news' in filtered_sentence:
        speak("Here are the top 5 stories for you.")
        NewsFeed = feedparser.parse(
            "https://timesofindia.indiatimes.com/rssfeedstopstories.cms")
        for j in range(5):
            entry = NewsFeed.entries[j]
            speak("Number {}".format(j + 1))
            speak(entry.title)
            speak(entry.summary)
            print("=======================================")
    else:
        speak("I am not aware of this command. Could you try something else?")
    return None
Ejemplo n.º 9
0
from MainMenu import Main as menu
from Game import Game as game
from GameOver import Main as gg
import sys

game_name = "Asteroids"
name = -1
state = 1
score = -1


def exit_game():
    sys.exit()


while 1:
    if state == 1:
        state = menu.load(game_name, score, name)
    elif state == 2:
        state, score = game.main(game())
    elif state == 3:
        state, name = gg.load(game_name, str(score))
    elif state == 4:
        exit_game()
Ejemplo n.º 10
0
class MyClass(object):
    gamenew = game()

    def executegame(self):
        self.gamenew.gamce()
        print 'test'
Ejemplo n.º 11
0
    # Sets screen size parameters
    game_size = 25
    resolution = 32

    # Wins of Blue and Orange Players
    win_count = [0, 0]

    playGame = True
    while playGame:

        # Loads the start screen
        # - map_select is easy/medium/hard/custom
        # - seed is used to randomly generate map
        # - player_number if multi-player, given by server
        # - map_name if custom map used
        map_select, seed, player_number, map_name = start(
            game_size, resolution)

        # Runs the local game
        if player_number == -1:
            winner, win_msg = game(game_size, resolution, map_select, seed,
                                   map_name)
        # Runs the multi-player game
        else:
            winner, win_msg = asyncio.get_event_loop().run_until_complete(
                gameOnline.game(game_size, resolution, map_select, seed,
                                player_number - 1))

        # Runs the Game Over screen
        win_count = over(game_size, resolution, winner, win_msg, win_count)
Ejemplo n.º 12
0
    numberOfPlayers = int(artificialPlayerCount + physicalPlayerCount)
    n = int(f.readline())
    m = int(f.readline())

    colors = [CRED, CGREEN, CYELLOW, CBLUE, CVIOLET, CBEIGE]
    random.shuffle(colors)
    players = []
    lands = [[Land(i, j) for j in range(n)] for i in range(m)]
    i = 0
    for i in range(physicalPlayerCount):
        players.append(
            Player(input("player " + str(i) + " please enter your name: "),
                   False, colors[i], i))

    for j in range(artificialPlayerCount):
        players.append(
            Player("player " + str(j + i + 1), True, colors[j + i + 1],
                   j + i + 1))

    random.shuffle(players)

    for i in range(n):
        for j in range(m):
            lands[i][j] = Land(i, j)

    filling_matrix(n, m, numberOfPlayers, players, lands)
    filling_adjacency_lists(n, m, lands)
    game(n, m, players, lands)

    print('\x1b[6;30;42m' + 'Success!' + '\x1b[0m')
Ejemplo n.º 13
0
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    screen.blit(fundo_floresta, (0, 0))
    screen.blits([(text_title_menu1, (120, 2)), (soldier1, (45, 50)),
                  (soldier2, (237, 50)), (soldier3, (45, 250)),
                  (soldier4, (237, 250)), (text_title_menu2, (110, 450))])

    if pygame.mouse.get_pressed()[0]:
        pos = pygame.mouse.get_pos()
        if 45 <= pos[0] <= 213 and 50 <= pos[1] <= 243:
            screen.blit(soldier1_click, (45, 50))
            pygame.display.update()
            sleep(0.2)
            run = game(8)
        if 237 <= pos[0] <= 405 and 50 <= pos[1] <= 243:
            screen.blit(soldier2_click, (237, 50))
            pygame.display.update()
            sleep(0.2)
            run = game(12)
        if 45 <= pos[0] <= 213 and 250 <= pos[1] <= 443:
            screen.blit(soldier3_click, (45, 250))
            pygame.display.update()
            sleep(0.2)
            run = game(16)
        if 237 <= pos[0] <= 405 and 250 <= pos[1] <= 443:
            screen.blit(soldier4_click, (237, 250))
            pygame.display.update()
            sleep(0.2)
            run = game(20)
Ejemplo n.º 14
0
def helen(data):
    #Splitting each sentence in a list of words.
    word_list = word_tokenize(data)
    
    #Setting up stop_words: words that are redundant.
    stop_words = set(stopwords.words('english'))

    #Creating space for a list of sentences without stop_words.
    if "search" not in word_list and "google" not in word_list and "Search" not in word_list and "Google" not in word_list:
        filtered_sentence = [w for w in word_list if not w in stop_words]
    else:
        filtered_sentence = [w for w in word_list]
    
    if ("bored" in filtered_sentence):
        Speaking_engine("Let's play a game then!!")
        game()
    elif 'time' in filtered_sentence:
        Speaking_engine(time.strftime("%A") + " "+ str(datetime.datetime.now())[:16])    
        timedate()
    elif 'song' in filtered_sentence and filtered_sentence.index('play') < filtered_sentence.index('song'):
        filtered_sentence = [w for w in filtered_sentence if w != "called" and w != "named" and w != "titled"]
        pos = filtered_sentence.index('song') + 1
        Speaking_engine("Opening Youtube Searches for {}".format(filtered_sentence[pos]))
        playSong(filtered_sentence[pos])  

    elif 'game' in filtered_sentence and filtered_sentence.index('play') < filtered_sentence.index('game'):
        game()

    elif 'google' in filtered_sentence or "Google" in filtered_sentence:
        if len(filtered_sentence) > 1:
            if 'open' in filtered_sentence and 'google' in filtered_sentence and filtered_sentence.index('open') < filtered_sentence.index('google'):
                google()
            if 'open' in filtered_sentence and 'Google' in filtered_sentence and filtered_sentence.index('open') < filtered_sentence.index('Google'):
                google()
            else:
                pos = 0
                if 'google' in filtered_sentence:
                    pos = filtered_sentence.index('google') + 1
                elif 'Google' in filtered_sentence:
                    pos = filtered_sentence.index('Google') + 1
                if 'word' in filtered_sentence and filtered_sentence[-1] != 'word':
                    filtered_sentence =[w for w in filtered_sentence if w != "word"]

                search_string = ''.join(filtered_sentence[pos:])
                google_search(search_string)
        else:
            Speaking_engine("If you want me to open google, say 'open google'")
            Speaking_engine("If you want me to search for a word,"
                "say 'google <word>'")

    elif 'search google' in filtered_sentence or 'search on google' in filtered_sentence or 'google' in filtered_sentence:
        if filtered_sentence[-1] == "search":
            Speaking_engine("What would you like me to search?")
            for j in range(5):
                search_string = Microphone_engine()
                if(search_string!='error'):
                    google_search(search_string)
                    break
            return None
        pos = filtered_sentence.index('search') + 1
        search_string = " ".join(filtered_sentence[pos:])
        google_search(search_string)
    elif 'location' in filtered_sentence:
        if filtered_sentence[-1]=="location":
            Speaking_engine("What place should I look for?")
            for j in range(5):
                location = Microphone_engine()
                if(location!="error"):
                    maps(location)
                    break
            return None
           
        pos = filtered_sentence.index('location')+1
        loc = "".join(filtered_sentence[pos:])
        maps(loc)
    elif 'news' in filtered_sentence:
        Speaking_engine("Here are the top 5 stories for you.")
        NewsFeed = feedparser.parse("https://timesofindia.indiatimes.com/rssfeedstopstories.cms")
        for j in range(5):
            entry = NewsFeed.entries[j]
            Speaking_engine("Number {}".format(j+1))
            print(Speaking_engine(entry.title))
            #print(Speaking_engine(entry.summary))
            print("=======================================")
    elif 'email' in filtered_sentence:
        email()
        print("==============================================")
    elif 'time' in filtered_sentence:
        timedate()
    elif 'calculate' in filtered_sentence:
        calculation()
    elif 'application' in filtered_sentence:
        Speaking_engine('Which Application do you want to open')
        input=Microphone_engine()
        open_application(input)
    elif 'play music' in filtered_sentence:
        path='G:\Music\English Chartbusters\ColdPlay'
        music = ['Everglow','Paradise','Adventure Of A Lifetime','Hymn For The Weekend','A Head Full Of Dreams']
        random_music=path+random.choice(music)+'.mp3'
        os.system(random_music)
    elif 'search' in filtered_sentence:
        Speaking_engine("What would you like to search for?")
        query=Microphone_engine()
        try:
            try:
                app_id = "V8QYE3-V8W86UARPP"
                client = wolframalpha.Client(app_id)
                res = client.query(query)
                results = next(res.results).text
                Speaking_engine('WOLFRAM-ALPHA says - ')
                Speaking_engine('Got it.')
                Speaking_engine(results)
                    
            except:
                results = wikipedia.summary(query, sentences=2)
                Speaking_engine('Got it.')
                Speaking_engine('WIKIPEDIA says - ')
                Speaking_engine(results)
        
        except:
            webbrowser.open('www.google.com')
    else:
        Speaking_engine("I am not aware of this command. Could you please try something else?")
    return None  
Ejemplo n.º 15
0
import csv
import random
import Search_MCTS as level2
import Search_MCTS_Reinforce as level3
import Search_pureMC as level1
from Game import game

if __name__ == '__main__':
    g = game()

    # 턴 정하기
    user_turn = ""
    while user_turn != 'O' and user_turn != 'X':
        user_turn = input('O(선턴)나 X(후턴)를 입력해 먼저 시작할 지를 결정해주세요')
        user_turn = user_turn.upper()
    com_turn = "X" if user_turn == "O" else "O"

    # turn_now 가 0이면 유저 선턴 1이면 빠요엔 선턴
    emcee = 0 if user_turn == "O" else 1

    # 난이도 선택
    level = ""
    while level != "1" and level != "2" and level !="3":
        level = input("난이도 숫자를 입력 해주세요\n 1)MD.Weird 2)Weird the Sorcerer 3)Dr.Weird")
    EyesOfAgamotto = dict()
    Battle_Count = 0
    csv_name = 'Data_csv.csv'
    if level == "3":
        # 유저 선턴 기준
        with open(csv_name, mode='r') as csv_file:
            csv_reader = csv.DictReader(csv_file)
Ejemplo n.º 16
0
        self.comicEquip = 0
        self.dragonEquip = 0
        self.lockEquip = 0


player = player()
gameRun = True

while gameRun == True:
    print("WELCOME TO GAME")
    name = input("Enter Name: ")
    player.name = name

    while gameRun == True:
        # MAIN MENU
        print("Main Menu")
        print("(1) Start Adventure")
        print("(2) Shop")
        print("(3) Equip")
        print("(4) Exit Game")
        menuInput = integer_input(4)
        if menuInput == (1):
            game(player)
        elif menuInput == (2):
            shop(player)
        elif menuInput == (3):
            equip(player)
        elif menuInput == (4):
            print("Bye")
            gameRun = False