コード例 #1
0
def question(caves, wumpus_location, super_bat_1, super_bat_2, deep_pit,
             player_location, player_name, arrows, add_arrows):
    print(f'Вы находитесь в комнате с тремя дверьми {player_location}')

    if wumpus_location in player_location:
        print('Как же неприятно пахнет! Думаю, Вампус совсем близко')
    elif super_bat_1 in player_location or super_bat_2 in player_location:
        print('Слышется шелест крыльев. Поблизости летучие мыши.')
    print('Какую из них открыть?')
    try:
        answer = int(input('> '))
    except:
        print('Неверная команда. Попробуйте еще раз.')
        question(caves, wumpus_location, super_bat_1, super_bat_2, deep_pit,
                 player_location, player_name, arrows, add_arrows)
    flag = False

    try:
        # Проверка на правильность выбора следующей комнаты
        while flag == False:
            if not int(answer) in player_location:
                print(
                    f'Вы можете выбрать только одну из {player_location} комнат'
                )
                answer = int(input('> '))
            else:
                flag = True
    except:
        death(player_name)

    # Выбор действий
    print(
        'Выберите действие для продолжения: а) выстрелить в выбранную комнату; '
        'б) войти в выбранную комнату; в) выбрать другую комнату; г) остаться на месте'
    )
    choice = input('> ')
    # print('choice', choice)
    if choice.lower() == 'а':
        if arrows > 0:
            answer = int(answer)
            return shoot(caves, wumpus_location, super_bat_1, super_bat_2,
                         deep_pit, player_location, player_name, answer,
                         arrows, add_arrows)
        print(
            'У вас больше нет стрел. Попробуйте поискать их в одной из комнат.'
        )
        return question(caves, wumpus_location, super_bat_1, super_bat_2,
                        deep_pit, player_location, player_name, arrows,
                        add_arrows)
    elif choice.lower() == 'б':
        return cave_location(caves, wumpus_location, super_bat_1, super_bat_2,
                             deep_pit, player_name, answer, arrows, add_arrows)
    elif choice.lower() == 'в':
        return question(caves, wumpus_location, super_bat_1, super_bat_2,
                        deep_pit, player_location, player_name, arrows,
                        add_arrows)
    elif choice.lower() == 'г':
        print('Вы погибли от голода и холода. Нужно было больше двигаться :(')
        return new_game(player_name)
    return death(player_name)
コード例 #2
0
def family():

    choice = raw_input("Our family?")
    if choice.lower() == "all":
        for i in range(len(FAMILY)):
            print "%s is %d years old." % (FAMILY[i][0], FAMILY[i][1])
    if choice.lower().startswith("add"):
        FAMILY.append((raw_input("Do you have a name for your person?"),
                       input_number_between(
                           "Since how many years is this person on earth ?", 0,
                           150)))
        print "Oh a new family member! "
コード例 #3
0
def check_user_choice(choice: str) -> str:
    """
    Function that checks user's choice.

    The choice can be uppercase or lowercase string, but the choice must be
    either rock, paper or scissors. If it is, then return a choice that is lowercase.
    Otherwise return 'Sorry, you entered unknown command.'
    :param choice: user choice
    :return: choice or an error message
    """
    choices = "rock", "paper", "scissors"

    return choice.lower() if choice.lower(
    ) in choices else 'Sorry, you entered unknown command.'
コード例 #4
0
ファイル: grandma_talk.py プロジェクト: luiswill/grandma-talk
def family():

    choice = raw_input("Our family?")
    if choice.lower() == "all":
        for i in range(len(FAMILY)):
            print "%s is %d years old." % (FAMILY[i][0], FAMILY[i][1])
    if choice.lower().startswith("add"):
        FAMILY.append(
            (
                raw_input("Do you have a name for your person?"),
                input_number_between("Since how many years is this person on earth ?", 0, 150),
            )
        )
        print "Oh a new family member! "
コード例 #5
0
    async def coin(self, ctx, choice, amount: int):
        async with self.bot.pool.acquire() as conn:
            user_amount = await conn.fetchrow(
                "SELECT * FROM user_stats WHERE user_id = $1", ctx.author.id)
            choice = choice.lower()
            if amount < 50 or amount >= 50000:
                return await ctx.send(
                    "You may not bet less then 50 uwus or more than 50000 on a coinflip"
                )
            if choice != "heads" and choice != "tails":
                return await ctx.send("Please only use heads or tails")
            if amount > user_amount['uwus']:
                return await ctx.send(
                    "You don't have the funds to bet that much")

            status = await ctx.send("Flipping the coin...")
            await asyncio.sleep(3)
            await status.delete()
            side = secrets.choice(["heads", "tails"])
            if side == "heads":
                emote = heads
            else:
                emote = tails

            if choice == side:
                await conn.execute(
                    "UPDATE user_stats SET uwus = user_stats.uwus + $1 WHERE user_id = $2",
                    amount, ctx.author.id)
                return await ctx.send(f"{emote} You won {amount} uwus!")
            else:
                await conn.execute(
                    "UPDATE user_stats SET uwus = user_stats.uwus - $1 WHERE user_id = $2",
                    amount, ctx.author.id)
                return await ctx.send(f"{emote} You lost.")
コード例 #6
0
def toontorial():
    global cog_health
    global species
    global name
    tom = "Tutorial Tom: "
    loop = 0
    while loop == 0:
        name = raw_input(tom + "Hi there! What is your name? ")
        species = raw_input(tom + "What species are you? ")
        if species.lower() not in toon_species:
            species = raw_input(tom + "That's not a species! Please input a species.")
        choice = raw_input(tom + "You are a %s, and your name is %s. Correct? Y/N: " % (species, name))
        if choice.lower() == 'y':
            loop = 1
    raw_input(tom + "Ok %s, as you've probably heard, Toontown has been overrun by cogs!" % name)
    raw_input(tom + "In order to defeat them, you must use your gags to make them happy. They HATE being happy!")
    raw_input(tom + "Gasp! There's a cog outside as we speak! Go defeat that cog!")
    addTask("Defeat a Flunky")
    raw_input("")
    print "You have encountered a Flunky! Pick a gag to damage him!"
    cog_health = 6
    while cog_health > 0:
        gag = pickGag()
        if gag.lower() == 'cupcake':
            print "You threw a cupcake at the Flunky! It did 4 damage!"
            cog_health -= 4
            raw_input("")
            flunky()
        elif gag.lower() == 'squirting flower':
            print "You used a squirting flower on the Flunky! It did 2 damage!"
            cog_health -= 2
            raw_input("")
            flunky()
    cogDie()
    raw_input("Go back to the playground to get more gags!")
コード例 #7
0
def valid_choice(choice):
    '''
    Checks if the RPS choice is valid
    :param choice: RPS choice
    '''
    choice = choice.lower()
    if not (choice == "rock" or choice == "paper" or choice == "scissors"):
        raise ValueError(f"I don't understand {choice}. Try again")
コード例 #8
0
    def create_hero(self):
        """Prompt for Hero information.
        return Hero with values from user Input
        """
        name = ""
        health = ""
        while not name.isalpha():
            name = input("Please input a hero name: ")

        while not health.isnumeric():
            health = input(f"What is the starting health of {name}? ")

        hero = Hero(name, int(health))

        choice = ""
        while not choice.isalpha():
            choice = input(f"Does {hero.name} have abilities? (y/n) ")

        if choice.lower()[0] == "y":
            while not choice.isnumeric():
                choice = input("How many? ")

            for _ in range(int(choice)):
                hero.add_ability(self.create_ability())

        choice = ""
        while not choice.isalpha():
            choice = input(f"Does {hero.name} have weapons? (y/n) ")
        if choice.lower()[0] == "y":
            while not choice.isnumeric():
                choice = input("How many? ")

            for _ in range(int(choice)):
                hero.add_weapon(self.create_weapon())

        choice = ""
        while not choice.isalpha():
            choice = input(f"Does {hero.name} have armors? (y/n) ")
        if choice.lower()[0] == "y":
            while not choice.isnumeric():
                choice = input("How many? ")

            for _ in range(int(choice)):
                hero.add_armor(self.create_armor())

        return hero
コード例 #9
0
ファイル: uwus.py プロジェクト: CapnS/uwu-bot
    async def coin(self, ctx, choice, amount: int):
        async with self.bot.pool.acquire() as conn:
            user_amount = await conn.fetchrow(
                "SELECT uwus FROM user_stats WHERE user_id = $1",
                ctx.author.id)
            choice = choice.lower()
            if amount < 50 or amount > 50000:
                return await ctx.send(
                    "You may not bet less then `50` uwus or more than `50000` on a coinflip",
                    delete_after=30,
                )
            if choice != "heads" and choice != "tails":
                return await ctx.send("Please only use heads or tails",
                                      delete_after=30)
            if amount > user_amount["uwus"]:
                return await ctx.send(
                    "You don't have the funds to bet that much",
                    delete_after=30)

            status = await ctx.send("Flipping the coin...")
            await asyncio.sleep(2)
            await status.delete()
            side = secrets.choice(["heads", "tails"])
            if side == "heads":
                emote = heads
            else:
                emote = tails

            if choice == side:
                booster = await conn.fetchrow(
                    "SELECT boost_type, boost_amount, active_boosters FROM user_boosters WHERE user_id = $1",
                    ctx.author.id,
                )
                if not booster or booster["boost_type"] == "XP":
                    await conn.execute(
                        "UPDATE user_stats SET uwus = user_stats.uwus + $1 WHERE user_id = $2",
                        amount,
                        ctx.author.id,
                    )
                    return await ctx.send(f"{emote} You won `{amount}` uwus!")
                if booster["boost_type"] == "uwus":
                    amount = amount * booster["boost_amount"]
                    await conn.execute(
                        "UPDATE user_stats SET uwus = user_stats.uwus + $1 WHERE user_id = $2",
                        amount,
                        ctx.author.id,
                    )
                    return await ctx.send(
                        f"{emote} You won `{amount}` uwus! You have an {booster['active_boosters']} activated! Enjoy the extra uwus"
                    )
            else:
                await conn.execute(
                    "UPDATE user_stats SET uwus = user_stats.uwus - $1 WHERE user_id = $2",
                    amount,
                    ctx.author.id,
                )
                return await ctx.send(f"{emote} You lost.")
コード例 #10
0
def check_version():
    # check github for latest microDEX version
    try:
        latest_version = download_text("version")
        latest = latest_version.split(maxsplit=21)[:20]
        for j in latest:
            try:
                latest = float(
                    "".join(i for i in j if i in "0123456789.")
                )
                break
            except:
                pass
        current = float(
            "".join(i for i in VERSION if i in "0123456789.")
        )
        if latest > current:
            print(it("red", "      WARN: NEW VERSION AVAILABLE!"))
            print(
                it(
                    "yellow",
                    "      github/litepresence/extinction-event/EV",
                )
            )
            choice = ""
            while choice.lower() not in ["y", "n"]:
                choice = input("      Y/N UPGRADE?  ")
            if choice == "y":
                # backup and overwrite microDEX.py
                current_version = race_read("metaNODE.py")
                backup = "microDEX" + ("%.8f" % current) + ".py"
                race_write(backup, current_version)
                race_write("microDEX.py", latest_version)
                sys.exit("microDEX version updated please RESTART")
        else:
            print("      This is the latest microDEX version.")
    except:
        print(it("yellow", "      WARN: Skipping version test..."))

    print("")
    print(it("cyan", "AFFIRMING system compatibility..."))
    # confirm python 3 and linux OS
    if "linux" not in platform:
        raise Exception(
            "not a linux box, format drive and try again..."
        )
    if version_info[0] < 3:
        raise Exception(
            "% is DED, long live Python 3.4+" % version_info[0]
        )
    print("")
    print("      found python", version_info[0], "running on", platform)
    print("")
    time.sleep(0.2)
コード例 #11
0
ファイル: cli.py プロジェクト: zephyr-y/cloud189
 def rmode(self):
     """适用于屏幕阅读器用户的显示方式"""
     choice = input("以适宜屏幕阅读器的方式显示(y): ")
     if choice and choice.lower() == 'y':
         config.reader_mode = True
         self._reader_mode = True
         info("已启用 Reader Mode")
     else:
         config.reader_mode = False
         self._reader_mode = False
         info("已关闭 Reader Mode")
コード例 #12
0
async def rps(ctx, choice: str = None):
    if not choice:
        await ctx.send("Please give a choice! (Rock, Paper or Scissors)")
        return

    choice.lower()
    choices = ["rock", "paper", "scissors"]
    computer = choices[randint(0, 2)]

    if choice == "rock":
        if computer == "paper":
            await ctx.send(
                f"You lost! (Your choice: {choice}, My choice: {computer})")
        elif computer == "rock":
            await ctx.send(
                f"It's a tie! (Your choice: {choice}, My choice: {computer})")
        else:
            await ctx.send(
                f"You won! (Your choice: {choice}, My choice: {computer})")
    elif choice == "paper":
        if computer == "scissors":
            await ctx.send(
                f"You lost! (Your choice: {choice}, My choice: {computer})")
        elif computer == "paper":
            await ctx.send(
                f"It's a tie! (Your choice: {choice}, My choice: {computer})")
        else:
            await ctx.send(
                f"You won! (Your choice: {choice}, My choice: {computer})")
    elif choice == "scissors":
        if computer == "rock":
            await ctx.send(
                f"You lost! (Your choice: {choice}, My choice: {computer})")
        elif computer == "scissors":
            await ctx.send(
                f"It's a tie! (Your choice: {choice}, My choice: {computer})")
        else:
            await ctx.send(
                f"You won! (Your choice: {choice}, My choice: {computer})")
    else:
        await ctx.send("Please give a valid choice! (Rock, Paper or Scissors)")
コード例 #13
0
 def look_around(self):
     room = self.investigator.location
     print(room.description + "\n")
     for suspect in room.characters_present:
         print(suspect.description + "\n")
     if room.dead_body:
         print("And in the center of the room there is a dead body.")
         choice = input("Would you like to take a closer look? Yes or no?")
         if choice.lower() == "yes":
             self.inspect_body()
         else:
             print("Ew gross who wants to see a dead body?!")
コード例 #14
0
    async def coin_flip(self, ctx, choice, amount: int):
        won = False
        points = db.field(
            "SELECT points FROM member_points WHERE member_id = ? AND guild_id = ?;",
            ctx.author.id, ctx.guild.id)

        if amount > points:
            await ctx.send("You don't have enough :coin: !")
            return
        if amount < 10:
            await ctx.send("Minimum bet of 10 :coin:.")
            return

        # for some reason choice() not working so using randint
        flip = randint(0, 1)
        if flip == 0:
            flip = "tails"
        else:
            flip = "heads"

        await ctx.send(f"**{flip}**!")

        if flip not in ["tail", "tails", "t", "head", "heads", "h"]:
            await ctx.send("Wrong argument. Try 'heads' or 'tails'.")
        elif flip == "tails" and choice.lower() in ["tail", "tails", "t"]:
            won = True
        elif flip == "heads" and choice.lower() in ["head", "heads", "h"]:
            won = True
        else:
            won = False

        if won:
            await self.reward_points(ctx, amount)
            await ctx.send(f"You win {amount * 2} :coin:!")

        else:
            await self.remove_points(ctx, amount)
            await ctx.send(f"You lost {amount} :coin:...")

        db.commit()
コード例 #15
0
def roulette(bet, choice):
    bet = int(bet)
    n = randint(0, 36)
    print(f'The number is {n}.')
    if choice.lower() == 'even':
        if n % 2 == 0:
            print('You won!')
            return bet
        else:
            print('You lose!')
            return -bet
    elif choice.lower() == 'odd':
        if n % 2 == 0:
            print('You lose!')
            return -bet
        else:
            print('You won!')
            return bet
    elif choice == str(n):
        print('You won!')
        return bet
    else:
        print('You lose!')
        return -bet
コード例 #16
0
ファイル: Fun.py プロジェクト: PrincessLunaZ/Terrabot
    async def rps(self, ctx, choice: str):
        """Play rock-paper-scissors"""
        try:
            userChoice = choice.lower()

            if userChoice != "rock" and userChoice != "paper" and userChoice != "scissors":
                await ctx.send(
                    "You can only choose from rock, paper or scissors")
            else:
                temp = random.randint(1, 3)
                if temp == 1:
                    botChoice = "rock"
                elif temp == 2:
                    botChoice = "paper"
                elif temp == 3:
                    botChoice = "scissors"

                # This is kind of ugly but it works
                if userChoice == botChoice:
                    await ctx.send(
                        "I choose **{}**. The game was a tie!".format(
                            botChoice))
                elif userChoice == "rock":
                    if botChoice == "paper":
                        await ctx.send(
                            "I choose **{}**. I win!".format(botChoice))
                    elif botChoice == "scissors":
                        await ctx.send(
                            "I choose **{}**. You win!".format(botChoice))
                elif userChoice == "paper":
                    if botChoice == "scissors":
                        await ctx.send(
                            "I choose **{}**. I win!".format(botChoice))
                    elif botChoice == "rock":
                        await ctx.send(
                            "I choose **{}**. You win!".format(botChoice))
                elif userChoice == "scissors":
                    if botChoice == "rock":
                        await ctx.send(
                            "I choose **{}**. I win!".format(botChoice))
                    elif botChoice == "paper":
                        await ctx.send(
                            "I choose **{}**. You win!".format(botChoice))
        except Exception as e:
            await ctx.send(e)
コード例 #17
0
def cho_han(bet, choice):
    bet = int(bet)
    n = randint(1,12)
    print(f'The number is {n}.')
    if choice.lower() == 'even':
        if n % 2 == 0:
            print('You won!')
            return bet
        else:
            print('You lose!')
            return -bet
    else:
        if n % 2 == 0:
            print('You lose!')
            return -bet
        else:
            print('You won!')
            return bet
コード例 #18
0
ファイル: fun.py プロジェクト: ickqy/kBot
    async def rps(self, ctx, choice: str):
        """`Play Rock Paper Sccisors with the bot`"""
        choice = choice.lower()
        rps = ["rock", "paper", "scissors"]
        bot_choice = rps[randint(0, len(rps) - 1)]

        await ctx.reply(f"You chose ***{choice.capitalize()}***." +
                        f" I chose ***{bot_choice.capitalize()}***.")
        if bot_choice == choice:
            await ctx.reply("It's a Tie!")
        elif bot_choice == rps[0]:

            def f(x):
                return {
                    "paper": "Paper wins!",
                    "scissors": "Rock wins!"
                }.get(x, "Rock wins!")

            result = f(choice)
        elif bot_choice == rps[1]:

            def f(x):
                return {
                    "rock": "Paper wins!",
                    "scissors": "Scissors wins!"
                }.get(x, "Paper wins!")

            result = f(choice)
        elif bot_choice == rps[2]:

            def f(x):
                return {
                    "paper": "Scissors wins!",
                    "rock": "Rock wins!"
                }.get(x, "Scissors wins!")

            result = f(choice)
        else:
            return
        if choice == "noob":
            result = "Noob wins!"
        await ctx.reply(result)
コード例 #19
0
def write_tweet_REPL(random_text):
    """takes <140 text and returns it plus twitter options"""

    while True:
        # This will print info about credentials to make sure
        # they're correct
        print api.VerifyCredentials()
        #tweet the tweet
        status = api.PostUpdate(random_text)
        #print the tweeted tweet and verify successful posting
        #if successful.
        print status.text

        choice = raw_input("Enter to tweet again [q to quit] > ")
        choice = choice.lower()
        if choice == 'q':
            print 'Thank you for tweeting.'
            break
        else:
            random_text = make_text(chains, n_gram_size)
コード例 #20
0
def getWebdata(choice):
    print('웹 크롤링을 시작합니다.')
    # 발급된 계정의 인증키
    GEVOLUTION_API_KEY = 'MNOP826189'
    # g:구글플레이, a:애플 앱스토어
    market = choice.lower()
    # game:게임, app:일반앱, all:전체(게임+일반앱)
    app_type = 'game'
    # 1:무료, 2:유료,3:매출,4:신규무료,5:신규유료
    rank_type = 1
    # 1~OO위까지 출력 (max:100)
    rank = 100
    url = 'http://api.gevolution.co.kr/rank/xml/?aCode={code}&market={market}&appType={app_type}&rankType={rank_type}&rank={rank}'.format(code=GEVOLUTION_API_KEY, market=market, app_type=app_type, rank_type=rank_type, rank=rank)
    fp = urlopen(url)
    doc = xmltodict.parse( fp.read() )
    print('웹 크롤링이 완료되었습니다.')
    fp.close()
    
    game_df = makeDataFrame(doc, rank)
    checkData(game_df)
コード例 #21
0
def main(pswd):
    key = bytes(pswd, 'UTF-8')
    key_len = len(key)
    sen_len = str(key_len).encode('UTF-8')
    sen_len += b' ' * (32 - len(sen_len))
    key = base64.b64encode(sen_len)
    fkey = Fernet(key)
    global masterpass
    while True:
        menu()
        while True:
            with open('passwords.txt', 'r') as fl:
                contents = fl.read()
            choice = input()
            if choice.lower().strip() == 'q' or choice.lower().strip(
            ) == 'n' or choice.lower().strip() == 'r' or choice.lower().strip(
            ) == 'd' or choice.lower().strip() == 'c':
                break
            else:
                print('Please enter \'q\', \'n\', \'d\', \'r\', or \'c\'')
        if choice.lower().strip() == 'q':
            exit()
        elif choice.lower().strip() == 'n':
            pltfm = input(
                'What platform will this password be used for? Type \'q\' to go back. '
            )
            pltfm = pltfm.lower().strip()
            if pltfm == 'q':
                continue
            with open('passwords.txt', 'a') as f:
                f.write('\n')
                pfmss = re.findall('Platform: \'(.*)\', Password:'******'There is already a password for that platform stored.'
                    )
                    continue
                passw = randomString(15)
                passw1 = bytes(passw, 'UTF-8')
                passw1 = fkey.encrypt(passw1)
                passw1 = str(passw1)
                passw1 = passw1.strip('b\'\'')
                f.write(f'Platform: \'{pltfm}\', Password: \'{passw1}\'')
            print(f'A password has been created for {pltfm}: {passw}')
        elif choice.lower().strip() == 'r':
            with open('passwords.txt', 'r') as fl:
                contents = fl.read()
                pltfrm = input(
                    'What platform do you want the password for? Type \'q\' to go back. Type \'l\' for a list of all '
                    'platforms. ')
                if pltfrm.lower().strip() == 'q':
                    continue
                elif pltfrm.lower().strip() == 'l':
                    pfms = re.findall('Platform: \'(.*)\', Password:'******'Platform: \'(.*)\', Password: '******'Platform: \'{pltfrm}\', Password: \'(.*)\'',
                        contents)
                    password = pwds[0]
                    password = bytes(fkey.decrypt(bytes(password, 'UTF-8')))
                    password = str(password)
                    password = password.strip('b\'\'')
                    print(f'Your password for {pltfrm} is {password}')
                else:
                    print('You dont have a password stored for that platform.')
        elif choice.lower().strip() == 'c':
            while True:
                oldpass = input(
                    'Please enter the old password. Type \'q\' to go back. ')
                if oldpass.lower().strip() == 'q':
                    break
                if bcrypt.checkpw(bytes(oldpass, 'UTF-8'), masterpass):
                    newpass = bytes(
                        input(
                            'Please now enter your new password. Type \'q\' to go back. '
                        ), 'UTF-8')
                    if newpass.lower().strip() == 'q':
                        break
                    newpass = bcrypt.hashpw(newpass, bcrypt.gensalt())
                    newpass = str(newpass)
                    newpass = newpass.strip('b\'\'')
                    cfl = open('passwords.txt', 'r')
                    lines = cfl.readlines()
                    lines[0] = f'MasterPassword: \'{newpass}\'\n'

                    cfl = open('passwords.txt', 'w')
                    cfl.writelines(lines)
                    cfl.close()
                    break
                else:
                    continue
        elif choice.lower().strip() == 'd':
            pf = input(
                'What is the name of the platform you want to delete? Type \'q\' to go back. Type \'l\' for a list of '
                'all platforms. ').lower().strip()
            pfs = re.findall('Platform: \'(.*)\', Password:'******'q':
                continue
            elif pf == 'l':
                for p in pfs:
                    print(p)
                continue
            if pfs.__contains__(pf):
                print('Sorry, this feature is still in development.')
                continue
            else:
                print('You dont have a password stored for that platform.')
コード例 #22
0
ファイル: hangman.py プロジェクト: dzyubam/Hangman
def getChoice(menu):
    print menu
    choice = raw_input("Make your choice: ")
    choice = choice.lower()
    return choice
コード例 #23
0
def valid_choice(choice):
    choice = choice.lower()
    if choice == "rock" or choice == "paper" or choice == "scissors":
        return True
    else:
        raise Exception(f"I don't understand {your_choice}. Try again.")
コード例 #24
0
 def check(m):
     user = ctx.author
     if m.author.id == user.id and m.content.lower() == choice.lower():
         return True
     return False
コード例 #25
0
        
deck = Standard_deck()
deck.shuffle_card()
new_card = deck.nextCard()
print("\n",new_card)
choice = input("Higher (h) or lower (l): ")
streak = 0

while(choice == 'h' or choice=='l'):
    if not deck.hasCard():
        deck = Standard_deck()
        
        deck.shuffle_card()
    old_card = new_card
    new_card = deck.nextCard()
    if (choice.lower()=='h' and new_card.value > old_card.value or\
        choice.lower() =='l' and new_card.value < old_card.value):
        streak += 1
        print('right! that is',streak,'in a row')
    elif (choice.lower()=='h' and new_card.value < old_card.value or\
          choice.lower() =='l' and new_card.value > old_card.value):
            streak = 0
            print("Wrong")
    else:
        print('Push')
    print('\n',new_card)
    choice = input('higher (h) or lower (l): ')


## Tic-Tac-Toy
class tic_tac_toe: