#๐Ÿ”’ Bidding System In Card Game

53 messages ยท Page 1 of 1 (latest)

raw swift
#

Hello, I am creating a card game called Tarneeb which eqaully splits a deck of 52 cards amongst 4 different players so that each player has 13 cards. In doing so, each player can look at their cards and place a bid on how many times they will win. It ranges from 7 to 13 and there is a pass which means they would not like to bid. I am struggling to make the bidding system. Any help would be amazing.

ripe flaxBOT
#

@raw swift

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

raw swift
#

I am also trying to make it so each players bid will be like this [pass, 9, 10, 13] where index 0 represents player 1 etc. I am using pygame for this game. I will attach my code below.

knotty perch
#

sounds a lot like bridge ๐Ÿ™‚

raw swift
knotty perch
#

what's the problem? (I haven't looked at the code, and don't intend to until I better understand your problem)

raw swift
#

ive attached a simplified version in the description

#

but to further extend

#

i created a method called getBid()

#

which I tried to make so it does what i described above

#

however

knotty perch
#

I'm not following your explanation

raw swift
#

wdum sorry?

knotty perch
#

I don't understand you

raw swift
#

which part do u not understand?

knotty perch
#

any of it

#

I don't understand your problem, and I haven't even looked at the code because it's enormously complex

#

if you cannot clearly describe your probem, I can't help you

raw swift
#

my problem is that my getBid is not working with is my method to get different bids from the players. The reason it is not working is because instead of it printing what i want such as [pass, 13, 7, 8] as an example, it instead prints out the same number i click on and not in the position it is mean to. eg. [0, 0, 10, 0] whereas 10 needs to be in the first index since it is player 1 who startted the bid

#

have a look at my code 90% of it is independent of my getBid method anyways

knotty perch
#

ok I'll look at getBid

#

it's confusing

raw swift
#

which part i can explain it

knotty perch
#

why would bid.draw(screen): ever return False?

raw swift
#

it wouldnt

knotty perch
#

then why do you have an if that checks?

raw swift
#

but i use it so that it can check if the number button has been clicked

knotty perch
#

I didn't understand that at all

raw swift
#

.draw() is part of my button code which i also sent

knotty perch
#

oh, it can return False

#

part of why this is confusing is that you're mixing up UI stuff -- drawing things on the screen and observing the mouse -- with your logic about the game. You should keep them as separated as you can.

raw swift
#

i suppose so

#

so no luck with getBid()?

knotty perch
#

nope

#

it's too hard for me to tell what it's doign

raw swift
#

okay no worries

knotty perch
#

and I can't run your program to see, since I don't have the bitmaps

raw swift
#

i understand

#

no worries at all then thank u for trying atleast

knotty perch
#

if I were you I'd write as much of the game as possible as a pure-python library that doesn't do any I/O -- including drawing -- at all.

#

Then write a program that combines that library with the UI stuff.

#

that way you can easily write tests for the library

raw swift
#

ill take that on board for the next features i add

raw swift
#

for sure man ill take a look into it

knotty perch
#

I don't know about your game, but I found the logic of "who gets to call when" to be surprisingly complicated ๐Ÿ˜

raw swift
#

i havent necessarily created that at all

#

ive only define attributes and stuff for each player

#

my objective was to make it work all together after getBids is done

ripe flaxBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.