Skip to content
Sign UpLog In
Profile icon

hadthelad

@hadthelad
Repls
Community
hadthelad
hadthelad
shared a Post
2 years ago
why is my function not calling
im making a poker game (you dont have to know how to play it) and i made a function called smartcomputerstart() which for some reason doesn't do anyth
poker (Texas holdem)
Python
xxpertHacker
xxpertHacker
Call print in the function, you'll see that it is indeed being called.2 years ago
hadthelad
hadthelad
shared a Post
2 years ago
so basically i want an input statement (under variable:age) where u can only input integers and if you input anything else than it says try again. but
bank simulator
Python
Wumi4
Wumi4
Well, you can't compare a variable and a type! So there are 2 solutions for this: Converts your variable to a string and use: if age.isdigit(): #... Or a more shorter way is to use isinstance(): if isinstance(age, int): #... `2 years ago
hadthelad
hadthelad
shared a Post
2 years ago
u dont have to know how to play poker to solve this one because my problem lies with the function smartcomputerstart(). The problem is that i have tol
poker (Texas holdem)
Python
JBloves27
JBloves27
The reason why it doesn't work is because you did not state it. Whenever you make a function, you have to state it. Like this: def function(): print('hi') function() Because im stating it, then it will work. You can call the function any amount of time. I hope this helps!2 years ago
LeoXu2
LeoXu2
When you call the function on line 174 I think you have to do smartcomputerstart() with parentheses instead of just smartcomputerstart2 years ago
OldWizard209
OldWizard209
I think you didn't call the function.2 years ago
hadthelad
hadthelad
shared a Post
2 years ago
so i made an ai for my poker game and it runs but doesnt pop up with any messages or impact the game in any way. the smart computer start function i h
poker (Texas holdem)
Python
PattanAhmed
PattanAhmed
@hadthelad Hi, I have no idea what you are planning to do, Sorry! But for your side note, You can change those If Statements into Elif Statements for increasing the speed of Executing Comment me below if you want some Help Thanks! Hope this helps > Please mark my answer if this helps2 years ago
DynamicSquid
DynamicSquid
I don't understand, what are you trying to do? Oh, also, just a tip, you might want to change those if statements to an elif statement since it's faster2 years ago
hadthelad
hadthelad
shared a Post
2 years ago
so i wrote my ai code for my poker game and whats its supposed to do is the person playing makes a decision, then the ai is supposed to react to that.
poker (Texas holdem)
Python
DavidShen2
DavidShen2
A few questions: is smartcomputerstart() supposed to do nothing and why is there a '' everywhere? I haven't looked very closely yet but if smartcoumputerstart() is the ai, it doesn't do anything since there is no code for it.2 years ago
gibbsfreenergy
gibbsfreenergy
I HAVE TO MENTION! I FEEL SO SAD FOR YOU! I'M SORRY! Do you remember me?2 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so i created this function and it seems to be good but it keeps coming up with this error for this one singular line, take a look: dsfsofdsp[ifdsjofa
poker (Texas holdem)
Python
PattanAhmed
PattanAhmed
@hadthelad Ok: Hope this helps: Please mark my answer if this helps.3 years ago
Codejira
Codejira
From the error message I understand that opponentcards and opponentcards_twoare lists. You can't subtract a list from another list. What are you trying to validate?3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so here is the line that has an error: hel sdkjfuoafk and here is the error it gave me: the error of my ways so could you tell me what the error i
poker (Texas holdem)
Python
CodingRobot12
CodingRobot12
try to convert those two variables into integers: the opponentcards and the opponentcards_two3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so this is just me being curious but how do you make an if statement where say for example you import random: import random and make random randint
poker (Texas holdem)
Python
CodingCactus
CodingCactus
import random num1 = random.randint(1,10) num2 = random.randint(1,10) if abs(num1 - num2) > 5: print ('difference is greater than 5') else: print('difference is 5 or less')3 years ago
VulcanWM
VulcanWM
You should use the code: import random num1 = random.randint(1,10) num2 = random.randint(1,10) print("The first number is ", str(num1)) print("The second number is ", str(num2)) if num1 - num2 5: print("The difference is bigger than 5.") elif num2 - num1 5: print("The difference is bigger than 5.") elif num1 - num2 Mark this as the answer, if this was helpful or useful3 years ago
VulcanWM
VulcanWM
So you're saying if the difference between the two numbers is bigger than 2 numbers, it does something, and if it isn't, it does something else?3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so im trying to make my program so it will randomize the number of the card and the suite of the card, now i have done the number of the card being ra
poker (Texas holdem)
Python
Bookie0
Bookie0
Hum, i dont know if this is what you want, but you could do something like this...: suites = ['hearts', 'spades', 'diamonds', 'clubs'] rand_suites = random.choice(suites) cards = ['J', 'Q', 'A', '2', '3', '4', '5', '6', '7', '8', '9', '10'] rand_cards = random.choice(cards) number_randomizer = 1 while True: print ((randsuites)+(randcards)) print (number_randomizer) number_randomizer += 1 Hope this helps! =)3 years ago
k9chelsea2
k9chelsea2
I think I know how however I don't want to give you false info lul3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so im trying to make a poker game (texas holdem) and i dont really know how to make the ai know when to stay, fold, and raise. is there a way i could
poker (Texas holdem)
Python
gibbsfreenergy
gibbsfreenergy
I wish I could help but I don't how poker is played. What do u mean by 'AI'? Do you mean the product of your code?3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so im trying to make a poker game (texas holdem) and i dont really know how to make the ai know when to stay, fold, and raise. is there a way i could
poker (Texas holdem)
Python
Kandagor
Kandagor
You need to contact the developers of other successful poker games with this question. I think only they can answer all your questions. I am engaged in creating applications and games, but I am currently at the initial stage and will not be able to answer all your questions regarding ai. But I am studying gambling, and so far, I like the design of the game the most of all poker games https://sunpower-world.com/. She's probably one of the best. Look at the AI in this game, and maybe you will find1 year ago
Muffinlavania
Muffinlavania
I dont know poker.. but you use if statements def smartcomputer():#Call this when you want it to judge if (good card roll) or (other good card roll): #Then do whatever for the hand #LIKE if opponent_cards=[4,5,6]: draw(2) #IDK something `3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so im trying to make a function but for some reason the line of code underneath it keeps coming up with an error saying expected indent as seen here:
poker (Texas holdem)
Python
Nettakrim
Nettakrim
it sees def oppenent_choice(): player_choice=input(...) as being part of the same function try doing def opponent_choice(): "" player_choice=input(...) ``3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so im trying to make a poker (texas holdem) game and my first order of business was to make a deck of cards with the values of the real life cards, ra
poker (Texas holdem)
Python
Bookie0
Bookie0
umm i think you can just make a list: cards = ["Jack", "Queen", "Ace", etc.] then do rand_cards = random.choice(cards) (but first import random) and print(rand_cards)` hope this helps! =) 3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so im trying to make a poker game and im just making a test to see if my random.randint works and it keeps coming up with errors basically saying you
poker (Texas holdem)
Python
SixBeeps
SixBeeps
You forgot one ) on line 163 years ago
hadthelad
hadthelad
shared a Post
3 years ago
could you guys tell me a way to make it so that when someone is inputting something for their story it says to try again if you clicked enter without
random story generator
Python
SixBeeps
SixBeeps
You can use a while loop for that. response = "" while response == "": response = input() `3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
hi so im relatively still new to python and i decided to make a random story generator, so if you know what it is you know how your able to select the
random story generator
Python
Kai_Justice
Kai_Justice
I'm not sure but if you want to make something where they absolutely have to put a valid gender then try something like this: while True: protagonist_gender = input('\nwhat is your protagonists gender:') # <<< takes input each time loop restarts if protagonist_gender in ['boy', 'girl', 'woman', 'man', 'male', 'female']: print(protagonist_gender, 'is a valid gender') break # <<< Ends loop else: print("Sorry,", protagonist_gender, 'is not a valid gender') # <<< Since loop doesn'3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
so im making a story generator and im trying to make it when you type and invalid gender when it asks you to pick the gender of the protagonists. but
random story generator
Python
hadthelad
hadthelad
shared a Post
3 years ago
i have no idea how the hell this is a syntax error: syntax error bruh
random story generator
Python
Kopamed
Kopamed
Just stop adding str() to all of them. It s already a string by default3 years ago
Codejira
Codejira
Many have been tricked by this one :-) Python expects a closing bracket that's missing on line 10.3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
is there a way to increase the size of text in python?
Bookie0
Bookie0
Thanks for selecting my answer!3 years ago
AphixDev
AphixDev
You can use Tkinter to do so, though, but if you want to do GUI stuff, you should use a different language...3 years ago
AphixDev
AphixDev
Sadly, no. Python is not a graphics language right off the bat. You can increase the size of text in lanugaues such as HTML immediately.3 years ago
hadthelad
hadthelad
shared a Post
3 years ago
its just blackjack, so yeah. https://repl.it/@hadthelad/blackjack tell me what you guys think. (don't judge im new)
blackjack
Python