It's a game code that I made by myself, can anyone fix it' There's no one to ask.

Asked 2 years ago, Updated 2 years ago, 19 views

playertoken=20

computertoken=20

deck=[0,0,0]

comdeck=[0,0,0]

value=0

comvalue=0

mass=0

def gameover():
    print("Game has ended.")

def bating():
    print("Do you want to bet?"")
    answer=input()

    if (answer=="yes"):
        print("How many bets do you want" (10 or less)
        mass=input()

        mass=int(mass)

        playertoken-mass

        computertoken-mass
        if(mass>11|mass<0):

            mass=0
            print ("Please reset the value")
            mass=input()

def winordefeat():

    if(computertoken==0):
        print("You won!!)")
        gameover()
    if(playertoken==0):
        print("You have lost...".")
        gameover()

def who():
    first=deck[0]*deck[1]
    second=deck[1]*deck[2]
    third=deck[0]*deck[2]

    comfirst=comdeck[0]*deck[1]
    comfirst=int(comfirst)
    comsecond=comdeck[1]*comdeck[2]
    comsecond=int(comsecond)
    comthird=comdeck[0]*comdeck[2]
    comthird=int(comthird)
    if(comfirst>comsecond):
        if(comfirst>comthird):
            comvalue=comfirst
        if(comfirst<comsecond):
            comvalue=comsecond
    elif(comsecond>comfirst):
       comvalue=comsecond
       if(comsecond<comthird):
           comvalue=comthird
    else:
        comvalue=comthird


    if(value!=first|second|third):
        print ("multiplicate from 3 values")
    if(value==first|second|third):
        if(value>comvalue):
            return playertoken+mass ,computertoken-mass


def card game start ():
    print ("Game rules use 3 cards to make the greatest number by multiplication")

    print("You can bet if you think the sum of that number is greater than the sum of your opponent's cards.")

    print ("Betting is based on 1 when the game starts")

    print("If you think your number sum is low, you can abstain for the next edition.")

    print("You can only see how many numbers are on one of your opponent's decks")

    print("If your own token count is zero, you win if you make the losing computer's token zero.") 

    publicdeck=[i for i in range(1,10)]
    deck.pop(publicdeck)*3
    comdeck.pop(publicdeck)*3
    for i in range(playertoken):
        playertoekn=-1
        computertoken=-1
        deck
        comdeck[:1]
        bating()
        who()
    winordefeat()

Card game start ()

python

2022-09-20 22:25

1 Answers

I don't know if I read the sauce correctly... First of all... I can only see how many numbers are on the other deck. I don't think I'm keeping my promise. Including that, overall, there's very little that the user chooses or checks for something, so I'm a little confused about that.

According to the scenario you wrote down, as long as there is even one token for the user, the deployment in the next step should always be carried out.

If you look at the code you've written so far, you basically have a sense of when to use the method and when not to use it, so if you rewrite the service flow you'll implement with them, it'll be done quickly. (In this case, it's better to rewrite the existing code than to fix it.)

Good luck.

PS. By the way, is it right to give 3 cards to the computer and 3 cards to me randomly? Or are we going to give them 1 to 10 cards at the beginning and throw away 3 cards each time we play? The more I look at the code, the more confusing the rules are.


2022-09-20 22:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.